Appendix B. Setting the Partition Type to Linux

When you create a new disk partition using parted(8), the partition type is automatically set based on the type of filesystem chosen for the partition. For most filesystems, such as ext2 or XFS, the partition type will be hexadecimal 83 (0x83), or Linux.

You can also use parted to change the type of existing partitions. Use the set subcommand to change the type flag to 0x83.


Note: The parted command expects a decimal number for most inputs. When entering a hexadecimal number would be more convenient, such as when setting the partition type flag, you must precede the number with 0x to indicate hexadecimal input.

The following example shows the use of parted to change the type of partition 1 on disk /dev/sde from 0x82 (Linux swap) to 0x83 (Linux):

# parted /dev/sde
GNU Parted 1.6.21
Copyright (C) 1998 - 2004 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
...

Using /dev/sde
(parted) print                                                               
Disk geometry for /dev/sde: 0.000-69424.000 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031  69421.508  primary               type=82
(parted) set
Partition number? 1
Flag to change? type
New type?  [130]? 0x83
(parted) print                                                                
Disk geometry for /dev/sde: 0.000-69424.000 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031  69421.508  primary               type=83
(parted) quit                                  
Information: Don't forget to update /etc/fstab, if necessary.    
#


Note: The type flag in the parted display of a partition table is equivalent to the Id field in the fdisk(8) display of a partition table.