On Sat, Apr 16, 2022 at 6:39 PM Dale <rdalek1...@gmail.com> wrote:
>
> Neil Bothwick wrote:
> > Use /dev/disks/by/partlabel/foo or /dev/disks/by-partuuid/bar.
> >
>
> That's even more typing than /dev/sdk.  Some things I do easily by using
> tab completion and all.  When mounting, I let fstab remember the UUID
> for it.

That's what copy/paste is for.  How often are you editing your
crypttab anyway?  This way when you move drives around they still
work.

> It's not like UUIDs are made to remember either.

blkid is your friend.

This is for config files, not random mounting/unmounting.  I use the
dynamic device nodes all the time if I'm just plugging a drive in and
looking at it.  However, if I'm going to put it in a config file I use
a persistent ID so that I'm not running into breakage anytime things
change.

When I'm setting it up it is just a few extra seconds to look up the
UUID and copy/paste it.  When the system randomly breaks I have to go
digging through logs and config files to figure out what went wrong.
It pays for me to spend a little more time on getting my config right
when everything is fresh in my head, because when I'm troubleshooting
it will take a little while just to figure out what I did when I set
it up.

Here is an example of one of my cryptsetup files:
cd1 UUID="1cbd5860-3469-41f7-8658-acd83d1957a0" /cd1.key

(This is using a random key stored in a file, which works for this
particular situation.  Obviously the drive is only as secure as that
file.)

The corresponding drive blkid output is:
/dev/sdb1: UUID="1cbd5860-3469-41f7-8658-acd83d1957a0"
TYPE="crypto_LUKS" PARTUUID="a4a383a8-24c2-f74b-94d8-ca4ffc366327"

Oh, and look at that - the first drive I set up on this system is
actually the second drive that got assigned a device name.  It was
probably /dev/sda1 when I first set it up, and I added another drive
since then.

The contained drive shows up as:
/dev/mapper/cd1: UUID="a2721813-4d10-4f69-ab2a-4beb0d6e95d7" TYPE="ext4"

(No LVM here - this is storage for a distributed filesystem so the
volume management is effectively above the filesystem level.  I can
add other drives to the cluster and they're in the pool, and if I want
to move data off this drive I can just edit a config file and the data
will be moved while online.  The encryption is mainly so that if a
drive fails I don't have to worry about anybody recovering data from
it.)

-- 
Rich

Reply via email to