fdisk
是 Linux 系统中用于磁盘分区管理的工具,而 GPT(GUID Partition Table)是一种现代的磁盘分区表格式,用以替代较旧的 MBR(Master Boot Record)分区表格式。以下是对 GPT 和使用 fdisk
进行 GPT 分区的详细解释:
GPT (GUID Partition Table):
fdisk:
fdisk
是一个交互式命令行工具,用于创建和管理磁盘分区。以下是使用 fdisk
创建 GPT 分区的基本步骤:
fdisk
。/dev/sdb
。fdisk
提示符下,输入 g
创建新的 GPT 分区表。n
,然后按照提示选择分区号、起始扇区和结束扇区。t
,然后选择合适的分区类型代码。w
。sudo fdisk /dev/sdb
在 fdisk
提示符下:
Command (m for help): g
Created a new GPT disklabel (GUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-xxxxxxx, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-xxxxxxx, default xxxxxxx):
Created a new partition 1 of type 'Linux filesystem' and of size XXXX MB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
问题: 使用 fdisk
创建 GPT 分区后,磁盘无法被系统识别。
原因: 可能是由于分区表未正确写入磁盘或文件系统未正确格式化。
解决方法:
partprobe
命令通知内核重新读取分区表。partprobe
命令通知内核重新读取分区表。通过以上步骤,可以成功创建并使用 GPT 分区。
领取专属 10元无门槛券
手把手带您无忧上云