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?

1 Answer
1

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.

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.
–
derobertAug 15 '14 at 13:27