4.4. 使用 fdisk 设置分区类型
您可以使用 fdisk 工具设置分区类型或标志。
先决条件
- 磁盘上的一个分区。
流程
启动交互式
fdiskshell:# fdisk block-device查看当前的分区表以确定副分区号码:
Command (m for help): print您可以在
Type列中看到当前的分区类型,在Id列中看到相应的类型 ID 。输入分区类型命令并使用其次编号选择一个分区:
Command (m for help): type Partition number (1-3, default 3): 2可选:显示分区类型:
对于有 MBR 分区表的磁盘:
Hex code or alias (type L to list all codes): L对于有 GPT 分区表的磁盘:
Partition type or alias (type L to list all): L
设置分区类型:
对于有 MBR 分区表的磁盘:
Hex code or alias (type L to list all codes): 8e对于有 GPT 分区表的磁盘:
Partition type or alias (type L to list all): 44
写入更改并退出
fdiskshell:Command (m for help): write The partition table has been altered. Syncing disks.
验证
验证您的更改:
# fdisk --list block-device