4.4. Setting a partition type with fdisk
You can set a partition type or flag by using the fdisk utility.
Prerequisites
- A partition on the disk.
Procedure
Start the interactive
fdiskshell:# fdisk block-deviceView the current partition table to determine the minor partition number:
Command (m for help): printYou can see the current partition type in the
Typecolumn and its corresponding type ID in theIdcolumn.Enter the partition type command and select a partition by using its minor number:
Command (m for help): type Partition number (1-3, default 3): 2Optional: Display the partition types:
For disks with an MBR partition table:
Hex code or alias (type L to list all codes): LFor disks with a GPT partition table:
Partition type or alias (type L to list all): L
Set the partition type:
For disks with an MBR partition table:
Hex code or alias (type L to list all codes): 8eFor disks with a GPT partition table:
Partition type or alias (type L to list all): 44
Write your changes and exit the
fdiskshell:Command (m for help): write The partition table has been altered. Syncing disks.
Verification
Verify your changes:
# fdisk --list block-device