parted命令分區

[root@KING ~]# parted /dev/sdb1 =》進行分區
(parted) mklabel gpt =》通過mklabel調整分區表,調整爲gpt類型
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost.
Do you want to continue?
Yes/No? yes

(parted) mkpart primary 0 10 =>通過mkpart 分區,分10M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore =》提示選擇ignore忽略就可以了.
(parted) p =》P查看分區
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary

(parted) mkpart primary linux-swap 11 21 =》分swap分區
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary
2 11.0MB 21.0MB 10.0MB primary

(parted) mkpart logical ext4 22 32 =》分邏輯分區
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary
2 11.0MB 21.0MB 10.0MB primary
3 22.0MB 32.0MB 10.0MB logical

(parted) rm 3 =》通過rm刪除第三個分區
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary
2 11.0MB 21.0MB 10.0MB primary =》已經刪除第三個分區

parted非交互式分區:
parted /dev/sdb mkpart primary 0 10 ignore
parted /dev/sdb mkpart primary linux-swap 11 21 ignore
parted /dev/sdb mkpart logical ext4 22 32 ignore
parted /dev/sdb p

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章