[root@chy002 ~]# parted /dev/sdb #一定要输入硬盘名字,默认是操作第一块硬盘
GNU Parted 3.1
使用 /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel #定义分区类型,是mbr还是gpt呢?
新的磁盘标签类型? gpt
(parted) mkpart #创建新分区
分区名称? []? chyuanliu
文件系统类型? [ext2]? ext4
起始点? 1 #单位是MB
结束点? 1000
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name 标志
1 1049kB 1000MB 999MB chyuanliu

(parted) mkpart chyuanliu1 xfs 1001 2000 #也可以一起写
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name 标志
1 1049kB 1000MB 999MB chyuanliu
2 1001MB 2000MB 998MB chyuanliu1

(parted) rm 1
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name 标志
2 1001MB 2000MB 998MB chyuanliu1

(parted)quit #保存退出

分区完之后格式化和挂载即可

[root@chy002 ~]# mkfs.ext4 /dev/sdb1
[root@chy002 ~]# mount /dev/sdb1 /tmp/chyuanliu1/

使用fdisk -l /dev/sdb 会发现,磁盘类型变成了gpt而不是dos

最后修改:2021 年 12 月 17 日 10 : 30 AM
感谢您的,打赏!