サポートセンター(24h365日無休) 03-5304-8161


HDD追加後のパーティション作成は parted を使います。
非対話型のパーティション作成方法を紹介します。

1パーティションを設定します。

以下の例では20GBのディスクを追加し、第1パーティションにすべての容量を指定します。

# parted /dev/sdb mklabel gpt mkpart P1 ext4 0% 100%
Information: You may need to update /etc/fstab.
2作成したパーティションをフォーマットします。

以下の例では ext4 を指定します。

# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242368 blocks
262118 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2153775104
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
3UUID を確認します。
# blkid /dev/sdb1
/dev/sdb1: UUID="35fa0c74-8790-4f46-acbe-0e6fcb523e57" TYPE="ext4"
PARTLABEL="primary" PARTUUID="ef5e90bb-65b7-466b-a5be-e8e25bc541c0"
4/etc/fstab に追加します。

例としてマウントポイントを /mnt にします。

UUID=35fa0c74-8790-4f46-acbe-0e6fcb523e57 /mnt ext4 defaults 0 0
5マウント操作をします。
# mount /mnt