LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-19-2014, 04:14 PM   #1
andrew44
Member
 
Registered: Apr 2011
Posts: 31

Rep: Reputation: 0
LVM and encrypted lvm - vgchange -ay needed everytime


I wanted to setup an encrypted lvm to mount at boot.

I had some empty space to play with at the end of a disk so I created a partition and marked it as 83 linux native. Not LVM, 8e. I had originally planned just to use a standard partition.. I'm not sure if this is the problem?

I have /etc/cryptab working and I also think fstab because if I do a mount -a after I've run the pvchange -ay the lvm mounts but until I do that I only have the lvm setup when I did my basic install.

Why can I only get the LV to mount after I have manually activated it.. or maybe the question should be how can I mark it as permanently activated? ..so I dont have to do the pvchange -ay ?

Thanks

Below are the steps I did


cryptsetup luksFormat /dev/sda3
cryptsetup luksOpen /dev/sda3 secure_luks

pvcreate /dev/mapper/secure_luks
vgcreate testing_vg /dev/mapper/secure_luks
lvcreate -n secure -L +999G testing_vg
mkfs.ext4 /dev/mapper/testing_vg-secure
mount /dev/mapper/testing_vg-secure /mnt/secure/

[root@gx ~]# cat /etc/crypttab
secure_luks /dev/sda3 /home/someguy/20140419s135223658.jpg

snip from /etc/fstab
/dev/mapper/testing_vg-secure /mnt/secure ext4 defaults 0 0


[root@gx ~]# mount -a
mount: special device /dev/mapper/testing_vg-secure does not exist
[root@gx ~]# lvscan
inactive '/dev/testing_vg/secure' [999.00 GiB] inherit
ACTIVE '/dev/vg_gx/lv_root' [195.31 GiB] inherit
ACTIVE '/dev/vg_gx/lv_home' [285.15 GiB] inherit
ACTIVE '/dev/vg_gx/lv_swap' [7.81 GiB] inherit
[root@gx ~]# vgchange -ay
1 logical volume(s) in volume group "testing_vg" now active
3 logical volume(s) in volume group "vg_gx" now active
[root@gx ~]# mount -a
[root@gx ~]# ls /mnt/secure/
lost+found
 
Old 04-19-2014, 06:43 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Seems pretty straight-forward. Why does anyone use a luks container ? - to hide stuff.
So all your LVM (metadata plus user data) remains hidden (as you wanted) until luksOpen.

Check the order/dependencies of your init{rd,ramfs} and init process.
 
Old 04-19-2014, 08:47 PM   #3
andrew44
Member
 
Registered: Apr 2011
Posts: 31

Original Poster
Rep: Reputation: 0
Thanks for the reply but doesn't the /etc/cryptab do the luksopen etc?

Isn't thats why when I do a vgchange -ay followed by the mount -a it works ? i.e. no need to do anything with cryptsetup.
 
  


Reply

Tags
lvm2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shrink partition (LVM encrypted PVs + encrypted LVs) gedaj Linux - Newbie 2 05-22-2013 03:44 AM
Resizable encrypted LVM requiring just one password on boot (encrypted volume group)? Nyyr Linux - Software 9 01-24-2013 05:52 AM
[SOLVED] Encrypted LVM Phorize Slackware 20 05-18-2011 04:30 PM
Kubuntu 9.04 and Encrypted LVM tmerriam Ubuntu 3 05-02-2009 04:33 PM
Encrypted LVM mashcaster Linux - Security 1 12-19-2008 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration