SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I purchased an external 2-bay raid enclosure and set up LUKS on it. I connect it via usb and because I use it with a laptop, it's obviously not going to be connected at all times, so I was wondering what was the best way to go about automating the mounting process. I've looked into automount, but I'm ont 100% certain this is what I need.
I suspect I need to write a udev rule, to create a constant /dev node (symbolic link) for the external drive because they change depending on when I connect the hard drive (sdb, sdc, etc).
Then I need to activate the encryption with cryptsetup openLuks command (still not sure where the password goes)
Then I have to activate LVM using
vgscan --mknodes
vgchange -ay
Finally, mount the lvm partition to /mnt/exthd
This is how I think I need to go about this, but I'm not entirely certain. Any suggestions would be appreciated.
I don't know whether it manages LVM or not but there is a software called Krypt which sits in the system tray and opens/closes LUKS partitions. You may configure it to store the password so that it opens LUKS partitions automatically. I have an external HDD with a LUKS partition with ext3 inside. When Krypt unlocks the LUKS, HAL automatically detects and mounts the ext3 inside. But I don't know if it would also work with LVM.
1) udev rules to ensure unique /dev device (I don't know how to do it)
2) open the LUKS partition
3) activate Volume Group and Logical Volume(s) (LV)
4) mount LV
Regarding the password when you open the LUKS partition (step 2), you have 2 choices:
- Get a prompt and enter it manually
- Store the password in /etc/crypttab and then LUKS is opened automatically (refer to README_CRYPT.TXT)
I would suggest the first one as this is the purpose of having an encrypted file (you want to give access to it only to authorized people who know the password).
Last edited by gegechris99; 01-23-2009 at 04:11 PM.
Reason: typo correction
For the sake of automation, I'd rather save the password in /etc/crypttab, which would be located on my laptop that has LUKS on it as well and prompts for password at boot-up.
I can write a udev rule, no problem there. Where I'm a little bit perplexed is how to automate the encryption and LVM activation because I'm trying to use automount here, I don't see where I can specify that the partition requires LUKS and LVM to be enabled first.
For the sake of automation, I'd rather save the password in /etc/crypttab, which would be located on my laptop that has LUKS on it as well and prompts for password at boot-up.
Wouldn't storing the password in plaintext nullify the whole purpose of LUKS?
I was thinking that you would write a script that will be started by a udev rule (maybe the same as the one that will specify the /dev device).
Hmm... that's a great idea. I think the problem is solved. I write a udev rule that creates a device node, runs the program which activates luks and lvm, and then automount picks up from there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.