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

  1. Start the interactive fdisk shell:

    # fdisk block-device
  2. View the current partition table to determine the minor partition number:

    Command (m for help): print

    You can see the current partition type in the Type column and its corresponding type ID in the Id column.

  3. 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): 2
  4. Optional: Display the partition types:

    • For disks with an MBR partition table:

      Hex code or alias (type L to list all codes): L
    • For disks with a GPT partition table:

      Partition type or alias (type L to list all): L
  5. Set the partition type:

    • For disks with an MBR partition table:

      Hex code or alias (type L to list all codes): 8e
    • For disks with a GPT partition table:

      Partition type or alias (type L to list all): 44
  6. Write your changes and exit the fdisk shell:

    Command (m for help): write
    The partition table has been altered.
    Syncing disks.

Verification

  • Verify your changes:

    # fdisk --list block-device
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部