You are not logged in.

#1 2023-02-26 07:10:38

shoelesshunter
Member
From: USA
Registered: 2014-05-18
Posts: 289

unlocking and mounting a luks backup drive

I have a luks encrypted external drive for backups. I have added a keyfile to one of the slots. The file is:

/crypto_keyfile.bin

The name of the luks container will be ext1

I don't want the device automatically unlocked or mounted at boot since it isn't always connected. I want my scripted backups to unlock/mount/run_script/unmount/lock.

I have this in my crypttab (I use UUIDs in the actual file)

ext1   /dev/sdX    /crypto_keyfile.bin     noauto

fstab has an entry for /dev/mapper/ext1 with a mountpoint of /ext1 and "noauto" set in options.

I've tried doing

mount /ext1

thinking crypttab would be read and the drive unlocked and mounted, but this isn't the case.

What is my setup missing?

Offline

#2 2023-02-26 08:57:47

jonno2002
Member
Registered: 2016-11-21
Posts: 868

Re: unlocking and mounting a luks backup drive

make sure the UUID your using in crypttab is for the luks container and not the partition inside, here is an example:

NAME                    FSTYPE   FSVER    LABEL    UUID                       FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                                      
└─sda1                crypto_LUKS 2                <UUID for luks containerr>                  
  └─storage           ext4        1.0      storage <UUID for ext4 partition>    69G    69% /path/to/mount

just a stab in the dark

Offline

#3 2023-02-26 10:50:53

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,491

Re: unlocking and mounting a luks backup drive

Try

noauto,x-systemd.automount,x-systemd.mount-timeout=30

in fstab.

Offline

Board footer

Powered by FluxBB