2

I recently installed Debian 10 on my laptop and for the first time I decided to give file encryption a go. But I've found something interesting in the /etc/fstab file, and it's that it doesn't use UUID and instead it uses absolute paths.

This is my /etc/fstab:

# <file system>  <mount point>  <type>  <options>  <dump>  <pass>
/dev/mapper/sda1_crypt    /        ext4    errors=remount-ro    0    1
# /boot was on /dev/sda3 during installation
UUID=fb4bd462-2ad8-4e56-b84e-602a94bf8b31   /boot  ext4  defaults 0   2
/dev/mapper/sda5_crypt    none     swap      sw    0     0

And this is the output from lsblk -o PATH,UUID,NAME,MOUNTPOINT

NAME     PATH                   UUID                  MOUNTPOINT

sda      /dev/sda                                                    
├─sda1   /dev/sda1              f0ece3a3-69c2-4ad8-b819-311a18c37b21 
│ └─sda1_crypt
│        /dev/mapper/sda1_crypt b73f7cef-ba4e-4587-9dba-da8385d93824 /
├─sda2   /dev/sda2                                                   
├─sda3   /dev/sda3              fb4bd462-2ad8-4e56-b84e-602a94bf8b31 /boot
└─sda5   /dev/sda5              ca96319f-82b3-4cbf-a1e1-7d30f7be4576 
  └─sda5_crypt
         /dev/mapper/sda5_crypt 40b9e71c-46b5-4d29-91a4-aaa12ca0e109 [SWAP]

I have an encrypted root partition on sda1 and an encrypted swap partition on sda5. I had to create an unencrypted /boot partition too (sda3). sda2 is free space I'll use for other purposes.

As you can see in the /etc/fstab, Debian identifies my /boot partition with its UUID, as it did on other occasions that I installed an unencrypted system, but it uses absolute paths for the encrypted partitions.

Can anyone help me identify why this happens and if it would be a good idea or even a good practice to change the /etc/fstab file so it uses UUID instead of paths?

Thanks.

  • You are correct that this is not the best practices. Does your /etc/cryptab reference the partition by UUID? ALso, is it possible for you to set up your partitioning scheme using LVM? LVM is not necessary but I find helpful for better managing my partitions in general, especially if I am encrypting them. – kemotep Nov 1 '19 at 15:30
  • Thanks for your answer. Yes, my /etc/crypttab uses UUIDs, so I think everything should be alright. I didn't know about /etc/crypttab file before this so I thought that /etc/fstab was everything there was. – 3435 Nov 4 '19 at 14:37
4

These absolute device paths are perfectly fine, since their names are stable and prescribed by the first fields in the lines of /etc/crypttab. Actually, they are symlinks to the numbered (thus unstable) device mapper device node names. If /etc/crypttab refers to their source devices (in the second fields) by stable names or UUIDs, your are safe from unpredictable device ordering.

| improve this answer | |

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.