Automount encrypted secondary drive?


#1

I’ve managed to add the secondary drive in /etc/crypttab and it decrypts automatically but I don’t get the automount to work. Does anybody have an advice?


#2

Have you tried including it in /etc/fstab?


#3

I’ve tried, but I think I can’t get the syntax right.
I did it a few weeks ago - like this:
/dev/mapper/luks-ID /media//secondary ext4 defaults,noatime 0 1

But it didn’t boot afterwards and had to restore the /etc/fstab file via a recovery disk (which was a hassle)


#4

Did you mean to have two ‘//’ between media and secondary? Or was that an error you made when you wrote the message here?


#5

this is just an error here :slight_smile:
But is the syntax here generally right?
/dev/mapper/luks-ID TAB /media/secondary TAB ext4 TAB defaults,noatime TAB 0 TAB 1


#6

I don’t know if this will make a difference, but I put a space instead of a tab between the final two digits / fields; also, the final ‘1’ should only be on the line for the root partition, everything else should have a 2 in that field. (The website I linked says the last two fields can be separated by spaces or tabs, so ignore that.)

Here are the first two lines from my fstab file, for comparison:

/dev/mapper/luks-root      /        ext4    defaults,noatime,discard 0 1
/dev/mapper/luks-swap      swap     swap    defaults,noatime,discard 0 2

#7

Thank you for your help, it works now.
Maybe I had a typo somewhere :slight_smile: