5

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?

4

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.

  • 2
    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. – derobert Aug 15 '14 at 13:27
  • @Gilles, can you quote a source for this? It seems like there is an exception, but you might still have stated the rule. – Tom Hale Oct 28 '16 at 8:01
  • @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). – Gilles Oct 28 '16 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.