新版本fdisk可以识别gpt格式分区


最近在尝试将一块大于2T的硬盘进行分区是发现fdisk不能处理超过2T的硬盘。一开始一头雾水,反复测试几次也不行。以为是系统问题,检查是64位系统。想不通。后来才找到相应文章介绍。有两种分区mbr和gpt。具体介绍见:MBR 与 GPT 的区别,以及 parted 的使用,操作大于2T的硬盘分区

当时作者使用的时候,fdisk 还不支持gpt。

我查看我在使用的gpt版本是:fdisk from util-linux 2.29.2

我先查看了一下分区格式:

# parted /dev/sdb p
Error: /dev/sdb: unrecognised disk label
Model: ATA xxxxx (scsi)                                        
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:

 

# fdisk -l /dev/sdb
Disk /dev/sdb: 3 TiB, xxxxx bytes, xxxx 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

将分区改为gpt分区:

# parted /dev/sdb mklabel gpt
Information: You may need to update /etc/fstab.

再用fdisk查看。发现它特别注明了分区类型为gpt分区。

# fdisk -l /dev/sdb
Disk /dev/sdb: 3 TiB, xxx bytes, xxxx 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: xxxx

看了parted的使用方式。我也想试试用fdisk。竟然是可以使用的。

 

# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition number (1-128, default 1):

也就是fdisk现在已经开始支持gpt分区了。

仔细回顾了一下之前fdisk的提示信息,才发现已经很明确的提示了:

Device does not contain a recognized partition table.
The size of this disk is 5.5 TiB (6001175126016 bytes). DOS partition table format can not be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Archives