I have encrypted luks partition. Key file is located on USB flash drive. I also created copy of that flash drive to another flash. How I can add two mount points in /etc/fstab
that points to same target directory. Booth flash drives to server not connected at same time. I just want to setup system that I can replace USB flash if it fails and system boots up correctly.
/etc/crypttab
contains
cryptolvm /dev/disk/by-uuid/a172345c-c0bd-1234-abcd-3febeeef9730 /media/sdb1/keyfile luks
/etc/fstab
(USB part of)
#kingston 16GB
UUID=622548b9-2223-4444-1234-5f61228bfa1c /media/sdb1 ext3 ro,nosuid,nodev,nofail,x-gvfs-show 0 0
# Adata 16GB
UUID=7342c8a5-4321-1111-1234-34742b566af1 /media/sdb1 ext3 ro,nosuid,nodev,nofail,x-gvfs-show 0 0
At this moment when server boots it show errors:
1) systemd-fstab-generator: failed to create mount unit file /run/systemd/generator/media-sdb1.mount, as it already exists. Duplicate entry in /etc/fstab?
2) dependency failed for /media/sdb1
Using
UUID
as mount source is not applicable when trying to mount different devices on the same folder. This normally also should not happen as it could lead to unwanted system behaviour and thereforesystemd
fails.In your case that would be OK, since you are only inserting one USB drive at a given time. To work around this, you can use e.g. the
LABEL=usbkey
option in/etc/fstab
to mount any filesystem that has the labelusbkey
in a particular folder.In your case remove the
UUID
entries and replace them with one entry as follows.Second, you need to be sure that your filesystems have the correct label set. On each USB stick you would have to run the command as follows, provided that
/dev/sdb
is your USB drive and/dev/sdb1
is the partition with the filesystem you want to mount.