View previous topic :: View next topic |
Author |
Message |
pactoo Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/58363755740fbb187cca5c.jpg)
Joined: 18 Jul 2004 Posts: 553
|
Posted: Wed Oct 10, 2007 3:06 pm Post subject: solved]Howto mount a luks partition if devicename is unknown |
|
|
Hello,
I have an external, luks encrypted harddrive, which I would like to mount upon calling a script, that asks for the password and does all the luksopen stuff.
Now the problem is, as this drive is usually plugged into a running system, so the device name is unknown to the script. Sometimes it will be /deb/sdb, other time /dev/sde a.s.o.
Currently I look up the new device manually and pass it as an argument to the script. Really Bothersome. Especially as I intend to automount those partitions sooner or later using a keyfile on a smartcard.
The harddrive has three different partitions, each to be mounted in its own, predefined mountpoint.
Now with cryptsetup luksUUID /dev/sdx1 I can identify the partition, with smartctl -i /dev/sdx I can even read the serialnumer of the drive and identify it this way. But both need the devicename, which I do not have.
With normal partitions this is no problem, as I can mount using the filesystem UUID or LABEL. With usb drives it is usually no problem, too, as I can assign a unique device name, based on the serial numer of that usb device, which is recognised by udev.
As udev is however unable to read the serialnumber of a (s)ata drive, I cannot go this way. So I wonder wether there is a possibility, that hal does some of this stuff. Wether it would be possible to have hal call a script which it passes the device name to.
Other alternatives would be welcome, too. Like, is there a way to make this happen in kde, that upon insertion of an luks drive a dialog opens, that simply asks for a password and mounts the partition in correct mount point. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pactoo Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/58363755740fbb187cca5c.jpg)
Joined: 18 Jul 2004 Posts: 553
|
Posted: Sun Oct 14, 2007 10:49 pm Post subject: |
|
|
There is a possibility to name a harddrive according to its serial:
Code: |
KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_SERIAL_SHORT}=="123456", SYMLINK="foo%n"
|
You get the enviroment, which includes the (short) serial, if you use udevinfo -q all -p /sys/block/sdx instead of udevinfo -a -p /sys/block/sdx, as advised in the writing udev rules guide.
It is just important to place this rule after 60-persistent-storage.rules, rather even after 64-device-mapper.rules, otherwise it won't work. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|