fdisk
显示或制作一个磁盘分区表。
格式
fdisk [-f] [block I/O device]
说明
[root@sylixos:/root]# help fdisk
show or make disk partition table
eg. fdisk /dev/blk/udisk0
fdisk -f /dev/blk/sata0
fdisk -fgpt /dev/blk/sata0
fdisk [-f] [-fgpt] [block I/O device]
[root@sylixos:/root]#
此命令显示或制作一个磁盘分区表。有3种用法;
- 无选项:表示显示当前磁盘分区表。
- 选项-f:用于制作磁盘分区表。
- 选项 -fgpt:用于制作 GPT 分区表。
备注:
制作磁盘分区表需要先确定此磁盘没有被挂载。使用showmount
命令查看是否被挂载,如挂载使用umount
命令卸载。分区完毕需要重新启动并将分好的每个区进行初始化才可以使用。
样例
[root@sylixos:/root]# fdisk /dev/blk/hdd-0
block device : /dev/blk/hdd-0
block type : SATA
block serial : Z9AMA7BT
block firmware: CC43
block product : ST1000DM010-2EP102
block media : N/A
MBR partition >>
PART ACT SIZE(KB) OFFSET(KB) TYPE
---- --- ---------- ---------- -------------------------------------
0 * 97676156 1024 Win95 FAT32 Partition
1 879085404 97677180 SylixOS True Power Safe Partition
total partition 2
[root@sylixos:/root]#
[root@sylixos:/root]# fdisk -f /dev/blk/hdd-0
block device /dev/blk/hdd-0 total size: 953869 (MB), reserved: 1024 (KB)
please input how many partition(s) you want to make (1 ~ 4) : 2
please input how many bytes align (4K 8K ...) : 4096
please input the partition 0 size percentage(%) or capacity(M) 0 means all left space : 20
is this partition active(y/n) : y
please input the file system type
1: FAT 2: TPSFS 3: LINUX 4: RESERVED
1
please input the partition 1 size percentage(%) or capacity(M) 0 means all left space : 0
is this partition active(y/n) : n
please input the file system type
1: FAT 2: TPSFS 3: LINUX 4: RESERVED
2
making partition...
block device : /dev/blk/hdd-0
block type : SATA
block serial : Z9AMA7BT
block firmware: CC43
block product : ST1000DM010-2EP102
block media : N/A
MBR partition >>
PART ACT SIZE(KB) OFFSET(KB) TYPE
---- --- ---------- ---------- -------------------------------------
0 * 195352312 1024 Win95 FAT32 Partition
1 781409248 195353336 SylixOS True Power Safe Partition
total partition 2
[root@sylixos:/root]#