一、磁盘分区
1、查看当前分区是mbr 还是gpt
[root@centos8 ~]$ fdisk -l /dev/sdb
Disk /dev/sdb: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3AF87A15-A7E2-4BBD-A36D-850FA9291997
2、将磁盘创建分区表msdos 为mbr分区 参数gpt为gpt分区
[root@centos8 ~]$ parted /dev/sdb mklabel msdos
3、查看分区信息、文件系统类型、分区容量、主分区还是扩展分区还是逻辑分区
```bash
[root@centos8 ~]$ parted /dev/sda print
Model: ATA CentOS8-0 SSD (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 316MB 315MB primary ext4 boot
2 316MB 13.2GB 12.9GB primary xfs
3 13.2GB 15.3GB 2147MB primary linux-swap(v1)
4 15.3GB 21.5GB 6127MB extended
5 15.3GB 21.5GB 6126MB logical xfs
4、创建分区
[root@centos8 ~]$ parted /dev/sdb mkpart primary 1 101
Information: You may need to update /etc/fstab.
[root@centos8 ~]$ parted /dev/sdb print
Model: ATA CentOS8-1 SSD (scsi)
Disk /dev/sd