fstab and LUKS partitions

Forum rules
Before you post please read this
Post Reply
iain_33
Level 3
Level 3
Posts: 147
Joined: Sat Dec 22, 2018 11:29 am
Location: UK

fstab and LUKS partitions

Post by iain_33 »

I've formatted an external HDD as ext4 LUKS, and I'd like it to mount at /wd_passport.

I created /etc/crypttab with the below line:

Code: Select all

wd_passport    UUID="6de7e341-7300-4049-8476-0b00f98c29ec"
...and added the below to /etc/fstab:

Code: Select all

/dev/mapper/wd_passport    /wd_passport    defaults,nofail    0    0
This works fine when I boot up with the HDD connected - I'm asked for the LUKS password during startup, and it's mounted once I'm booted up. But if I boot up without the HDD connected, it hangs for a minute, and sure enough the logs show it timed out waiting for the HDD. And then if I plug it in once it's booted, it asks for the LUKS password but then doesn't mount at /wd_passport.

The nofail option in fstab works fine for non-LUKS external HDD's. How can I get it to work for this one?
Linux Mint 19.3 Cinnamon on Lenovo Legion Y540 laptop (2020)
Linux Mint 19.3 Mate on HP G70 laptop (2009)
iain_33
Level 3
Level 3
Posts: 147
Joined: Sat Dec 22, 2018 11:29 am
Location: UK

Re: fstab and LUKS partitions

Post by iain_33 »

Bump

Anyone?

At the moment my laptop freezes during boot, until I connect the external HDD. Not what I want - I'd like the system to boot without it if it's not there, and automatically mount it when it's connected.
Linux Mint 19.3 Cinnamon on Lenovo Legion Y540 laptop (2020)
Linux Mint 19.3 Mate on HP G70 laptop (2009)
iain_33
Level 3
Level 3
Posts: 147
Joined: Sat Dec 22, 2018 11:29 am
Location: UK

Re: fstab and LUKS partitions

Post by iain_33 »

Partly solved with some duckduckgo'ing - turns out crypttab needs nofail too, as the fourth parameter:

Code: Select all

wd_passport    UUID="6de7e341-7300-4049-8476-0b00f98c29ec"    none    nofail
The none indicates there's no password file - instead it asks for the password during bootup if it's connected.

BUT - if I connect the drive after bootup, a window pops up asking for the password, but it doesn't mount where it should as per fstab - just the default /media/iain/... folder.

EDIT: no it's not partly solved ... with nofail I get asked for the password during bootup if the drive's connected, but it doesn't give me a chance to enter the password before it continues booting, without mounting the drive :evil:
Linux Mint 19.3 Cinnamon on Lenovo Legion Y540 laptop (2020)
Linux Mint 19.3 Mate on HP G70 laptop (2009)
Post Reply

Return to “Mounting Partitions”