Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
solved]Howto mount a luks partition if devicename is unknown
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pactoo
Guru
Guru


Joined: 18 Jul 2004
Posts: 553

PostPosted: Wed Oct 10, 2007 3:06 pm    Post subject: solved]Howto mount a luks partition if devicename is unknown Reply with quote

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
View user's profile Send private message
pactoo
Guru
Guru


Joined: 18 Jul 2004
Posts: 553

PostPosted: Sun Oct 14, 2007 10:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
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