
Linuxでfdiskコマンドで、新規のディスクにパーティションを作成します。
パーティションを作成する!(MBR)
新規ディスクにMBRのパーティションを作成します。例として、未使用のデバイス「/dev/sde」を指定しています。
# fdisk /dev/sde
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xcbaa612f.
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): 1
First sector (2048-41943039, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039, default 41943039):
Created a new partition 1 of type 'Linux' and of size 20 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
パーティションを作成する!(GPT)
新規ディスクにGPTのパーティションを作成します。GPTのバーティションを作成する場合は、最初にGPTのディスクラベルを作成します。例として、未使用のデバイス「/dev/sdb」を指定しています。
# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x4b12b1c5.
Command (m for help): g
Created a new GPT disklabel (GUID: 4A273752-8BB5-3349-AB22-09F9DAEFBB73).
Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-41943006, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943006, default 41943006):
Created a new partition 1 of type 'Linux filesystem' and of size 20 GiB.
Command (m for help): q
おわりに
fdiskコマンドでは、MBRおよびGPTのパーティションを作成することができます。既存のパーティションが存在しても確認のプロンプトは表示されないので、十分注意して作業を行う必要があります。
関連記事
