Sunday, 2 June 2013

Detecting the device of a crypto mount

Detecting the device of a crypto mount

I have an external eSATA-hdd on an OpenSUSE 12.2 system. The external hdd has an LVM on a dm-crypt partition.
I mount it by powering it up and then doing
rescan-scsi-bus.sh
cryptsetup -v luksOpen
vgchange -ay
mount
Now when I want to power the hdd down, I do
 umount
 vgchange -an extern-1
 cryptsetup -v remove /dev/mapper/extern-1-crypt
 echo 1 >/sys/block/sdf/device/delete
Here the device (sdf) is currently hardcoded in the script. Can I somehow deduce it in the script from the VG or the crypto device?

No comments:

Post a Comment