Filesystem types for encrypted partitions

5,418

The “filesystem type” in a PC partition is actually a volume type, or more precisely a usage type: it's really supposed to indicate which operating system the partition belongs to (e.g. Windows vs Solaris vs FreeBSD), and what it's supposed to do with it (e.g. nested partition of some kind vs filesystem vs swap). In practice, different OS vendors have made different choices and it's a bit of a mess.

For example, 83 is not “ext[234]” but “filesystem for Linux”. For anything using the dm layer, the convention is fd (“Linux raid”). This covers not only RAID but also dmcrypt, regardless of what filesystem or nested container (e.g. LVM) is on the encrypted volume.

But this is just a convention — Linux itself doesn't care about the type field except to mark unused partitions and extended partitions.

Share:
5,418

Related videos on Youtube

Gilles 'SO- stop being evil'
Author by

Gilles 'SO- stop being evil'

Updated on September 18, 2022

Comments

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 2 years

    I wish to encrypt two external hard drives using dm-crypt/LUKS for whole-disk encryption. I want one hard drive to have an ext4 filesystem for Linux use only, and the other to have an NTFS filesystem, for possible future access from Windows, as well as Linux.

    What I'm wondering is what filesystem type code should I allocate for each filesystem, given that they will be encrypted? Should the codes be as for normal filesystems, i.e. '83' for ext4 and '07' for NTFS, or are there special filesystem types used for encrypted volumes, or does it not make any difference which codes I choose?

  • derobert
    derobert almost 10 years
    From the mdadm manpage: "When creating a partition based array, using mdadm with version-1.x metadata, the partition type should be set to 0xDA (non fs-data)." So at least for mdraid, 0xFD is not the recommended convention. That's because Linux does care about the type field, 0xFD enables in-kernel auto assembly, which you don't want.
  • Tom Hale
    Tom Hale over 7 years
    @Gilles, can you quote a source for this? It seems like there is an exception, but you might still have stated the rule.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 7 years
    @TomHale Source for what? It's a matter of convention, I don't think there's a central authority for MBR partition types (there is one for GPT partition types, I think: the UEFI forum, and they follow the same general principle).