作成開始 : 令和6年(2024年)03月09日(土) 最終更新 : 令和6年(2024年)03月09日(土)
Q4OS でHDDを増設・マウントしてみた。
lshw は Synaptic パッケージマネージャからインストールしました。【ページトップへ戻る】
sudo su で rootユーザになります。
root@q4os-v200:/home/takaq# lshw -C disk
*-disk
description: ATA Disk
product: SAMSUNG HD256GJ
physical id: 0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 0002
serial: S2AYJ9EB301012
size: 232GiB (250GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=a5421ff1
*-cdrom
description: DVD-RAM writer
product: DVD+-RW AD-7200S
vendor: Optiarc
physical id: 1
bus info: scsi@1:0.0.0
logical name: /dev/cdrom
logical name: /dev/sr0
version: 101A
serial: [
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: ansiversion=5 status=nodisc
*-disk
description: ATA Disk
product: ST3160815AS
physical id: 0.0.0
bus info: scsi@3:0.0.0
logical name: /dev/sdb
version: A
serial: 9RX7F83W
size: 149GiB (160GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=90909090
root@q4os-v200:/home/takaq#
/dev/sdb として 149GiB (160GB)のディスクが認識されていることが分かります。
fdisk でも確認できます。
root@q4os-v200:/home/takaq# fdisk -l
Disk /dev/sda: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: SAMSUNG HD256GJ
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa5421ff1
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 486395903 486393856 231.9G 83 Linux
/dev/sda2 486397950 488396799 1998850 976M 5 Extended
/dev/sda5 486397952 488396799 1998848 976M 82 Linux swap / Solaris
Disk /dev/sdb: 149.01 GiB, 160000000000 bytes, 312500000 sectors
Disk model: ST3160815AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 312475711 312475648 149G a5 FreeBSD
root@q4os-v200:/home/takaq#
root@q4os-v200:/home/takaq# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 231.9G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 149G 0 disk
└─sdb1 8:17 0 149G 0 part
sr0 11:0 1 1024M 0 rom
root@q4os-v200:/home/takaq#
q4os上で増設したHDDが扱えるようにフォーマット、パーティションの作成をしていきま す。【ページトップへ戻る】
fdiskコマンドでパーティション削除、作成をします。fdisk /dev/sdb の後は、quit するまで対話形式です。
root@q4os-v200:/home/takaq# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty MBR (DOS) partition table
s create a new empty Sun partition table
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): p
Disk /dev/sdb: 149.01 GiB, 160000000000 bytes, 312500000 sectors
Disk model: ST3160815AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090
Command (m for help): i
No partition is defined yet!
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-312499999, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-312499999, default 312499999):
Created a new partition 1 of type 'Linux' and of size 149 GiB.
Command (m for help): q
root@q4os-v200:/home/takaq#
ここで、「新しいボリュームを検出しました。どうしますか!?」と聞いてきますが、何もしないで抜けます。
もともと存在していたパーティションを削除し、新しくパーティションを作成しました。
root@q4os-v200:/home/takaq# fdisk -l /dev/sdb【ページトップへ戻る】
Disk /dev/sdb: 149.01 GiB, 160000000000 bytes, 312500000 sectors
Disk model: ST3160815AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 312475711 312475648 149G a5 FreeBSD
root@q4os-v200:/home/takaq#
root@q4os-v200:/home/takaq# mkfs -t ext4 /dev/sdb1【ページトップへ戻る】
mke2fs 1.47.0 (5-Feb-2023)
/dev/sdb1 contains a ufs file system
Proceed anyway? (y,N) y
Creating filesystem with 39059456 4k blocks and 9764864 inodes
Filesystem UUID: c561728d-e2fe-4917-870a-9dcd185a8bac
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
root@q4os-v200:/home/takaq#
マウント先のディレクトリ作成【ページトップへ戻る】
root@q4os-v200:/home/takaq# mkdir /DATA
マウント
root@q4os-v200:/home/takaq# mount /dev/sdb1 /DATA
root@q4os-v200:/home/takaq# df
ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置
udev 1975560 0 1975560 0% /dev
tmpfs 400740 2676 398064 1% /run
/dev/sda1 238269176 21072132 205020816 10% /
tmpfs 2003688 20704 1982984 2% /dev/shm
tmpfs 5120 12 5108 1% /run/lock
tmpfs 400736 28 400708 1% /run/user/1000
/dev/sdb1 152675856 28 144847556 1% /DATA
root@q4os-v200:/home/takaq#
/dev/sdb1がマウントされていることが確認できました。
コマンド操作でマウントできましたが、パソコンが再起動するとマウントが外れてしまいます。【ページトップへ戻る】
そこで、パソコン起動時に自動でマウントされるようにします。
blkidコマンドでUUIDを確認します。
root@q4os-v200:/home/takaq# blkid
/dev/sdb1: UUID="c561728d-e2fe-4917-870a-9dcd185a8bac" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="90909090-01"
/dev/sda5: UUID="4f0abe62-a6f5-4544-b6aa-114c7f9db362" TYPE="swap" PARTUUID="a5421ff1-05"
/dev/sda1: UUID="304d4106-5722-4979-93cb-6d4cac80cb76" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="a5421ff1-01"
root@q4os-v200:/home/takaq#
UUIDをメモしておきます。
(長いのでコピペかな!)
c561728d-e2fe-4917-870a-9dcd185a8bac になっていますね。
/etc/fstabに追記します。
root@q4os-v200:/home/takaq# vi /etc/fstab
UUID=c561728d-e2fe-4917-870a-9dcd185a8bac /DATA ext4 defaults 1 2 を追記します。
root@q4os-v200:/home/takaq# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=304d4106-5722-4979-93cb-6d4cac80cb76 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=4f0abe62-a6f5-4544-b6aa-114c7f9db362 none swap sw 0 0
UUID=c561728d-e2fe-4917-870a-9dcd185a8bac /DATA ext4 defaults 1 2
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
root@q4os-v200:/home/takaq#
OS再起動してマウントされていたらOKです。
【前のページへ戻る】