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

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