确认分区表格式和文件系统

运行以下命令确认数据盘的分区表格式。

fdisk -lu

如果仅需要查看分区/dev/vdb1,运行 fdisk -lu /dev/vdb

  • 如果Systemdos,说明数据盘使用的是MBR分区表格式。
  • 如果Systemgpt,说明数据盘使用的是GPT分区表格式。
-bash-4.2# fdisk -lu

Disk /dev/vda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b2d99

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048  1048575966   524286959+  83  Linux

Disk /dev/vdb: 3221.2 GB, 3221225472000 bytes, 6291456000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x27534958

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048  4194303999  2097150976   83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/vdc: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: D9A52256-8F44-4137-A491-9D1C5BCFB7C1


#         Start          End    Size  Type            Name
 1         2048   1048573951    500G  Microsoft basic primary
-bash-4.2# 
-bash-4.2# fdisk -lu /dev/vdb

Disk /dev/vdb: 3221.2 GB, 3221225472000 bytes, 6291456000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x27534958

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048  4194303999  2097150976   83  Linux

运行blkid <PartitionName>确认文件系统的类型

blkid

本示例中,/dev/vdb1的文件系统类型为ext4。

-bash-4.2# blkid
/dev/vda1: UUID="1114fe9e-2309-4580-b183-d778e6d97397" TYPE="ext4" 
/dev/vdb1: UUID="f3d1d5f7-fb78-4fd9-99ff-b8abc23e328c" TYPE="ext4" 
/dev/vdc1: UUID="6905cd33-6791-494a-b61c-5ec52b56be7f" TYPE="ext4" PARTLABEL="primary" PARTUUID="0b7afc94-a290-4503-81fe-3156cca93c72" 
-bash-4.2# 
-bash-4.2# blkid /dev/vdb1
/dev/vdb1: UUID="f3d1d5f7-fb78-4fd9-99ff-b8abc23e328c" TYPE="ext4" 

判断分区为GPT/MBR:

运行后执行如下命令:

sudo fdisk -l

在disklabel中就可以看到分区方式。
GPT显示如下:

MBR 显示如下:


判断分区为GPT/MBR:

parted命令。

sudo parted -l

如下图所示,也可以看到分区方式,与fdisk的显示类似。