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

转载于:https://blog.51cto.com/ygtq666/2049522

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值