[systemd-devel] What's the correct way to configure encrypted volume and mount point?

Lennart Poettering lennart at poettering.net
Mon Feb 2 12:49:15 PST 2015


On Thu, 29.01.15 17:31, John Lane (systemd at jelmail.com) wrote:

> I am looking for some advice about configuring encrypted volumes with
> systemd that I want to open on demand (noauto).
> 
> I can add entries into /etc/crypttab and /etc/fstab for the device, for
> example
> 
> # <name>       <device>                                    
> <password>              <options>
> data        UUID=deadbeef....                           
> none                    noauto
> 
> and
> 
> # <file system>    <dir>    <type>    <options>    <dump>    <pass>
> /dev/mapper/data /home/myuser/data ext4 noauto 0 0
> 
> But the device doesn't unlock when I do
> 
> $ mount /home/myuser/data
> mount: special device /dev/mapper/keyring does not exist
> 
> But it does if I use
> 
> $ systemctl start home-myuser-data.mount

BTW, just to mention this. You can also just write:

# systemctl start /home/myuser/data

This will automatically be translated to
"home-myuser-data.mount". systemctl has some logic built in to
translate strings that don't look like unit names into unit names.

Essentially this hence means that this:

   a) mount /home/myuser/data
   b) systemctl start /home/myuser/data

However, the latter respects the whole systemde depency logic, while
the former just tries to mount the specified dir immediately, ignoring
all deps.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list