LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   luks and logical volumes (http://www.linuxquestions.org/questions/linux-software-2/luks-and-logical-volumes-863586/)

manyrootsofallevil 02-18-2011 01:15 PM

luks and logical volumes
 
Not sure whether I should post this on the newbie forum, at any rate.

I'm bit confused as to what is going on with LUKS and Logical Volumes (LV(s) henceforth)

I created a Luks encrypted partition on my VM test machine and that is straight forward enough.

using:
Code:

cryptsetup luksFormat /dev/sdb
 cryptsetup luksOpen /dev/sdb crypto

and then adding to /etc/crypttab the following:
Code:

crypto /dev/sdb none
So far so good

I get prompted on start up for the passphrase and I can mount the partition without any problem , e.g. mount /dev/sdb /mydirectory, works a treat.

Now, I created a volume group (vol1, I like original names) out of two partitions, and then used it to create a logical volume (lv1)

So armed with a logical volume, I proceed with the same steps as above, namely:

Code:

cryptsetup luksFormat /dev/vol1/lv1
 cryptsetup luksOpen /dev/vol1/lv1 cryptlv

and then adding to /etc/crypttab the following:

Code:

cryptlv /dev/vol1/lv1 none
I can mount this with:
Quote:

mount /dev/mapper/cryptlv
The thing is that I did blkid and there is an extra device

/dev/mapper/crypto: UUID="2204caa6-08a1-4c9b-bb1e-d35f6acaa03a" TYPE="ext4"
/dev/mapper/vol1-lv1: UUID="7f54aaf2-8fd6-428c-be12-a059d5df4650" TYPE="crypto_LUKS"
/dev/mapper/cryptlv: UUID="5f7fa55f-09fc-4b29-88e7-b4ddcd5a21b8" TYPE="ext4" LABEL="cryptlv"

I cannot mount this extra device, I tried:
Code:

mount  /dev/mapper/vol1-lv1 /mydir
and
Code:

mount  -t crypto_LUKS /dev/mapper/vol1-lv1 /mydir
but both return
Code:

mount: unknown filesystem type 'crypto_LUKS'
My questions are as follows:

Why is there a new device?
How was it created (I certainly did not do it manually)?
How do I get rid of it?

TIA

rayfordj 02-19-2011 07:38 AM

Quote:

Originally Posted by manyrootsofallevil (Post 4263035)
Why is there a new device?

Because LVM leverages device-mapper to map the underlying [physical volume] block device(s)'s physical-extents to the logical-extents that comprise the logical volume.


Quote:

Originally Posted by manyrootsofallevil (Post 4263035)
How was it created (I certainly did not do it manually)?

Ah, but you did when you created the logical-volume named lv1. ;)



Quote:

Originally Posted by manyrootsofallevil (Post 4263035)
How do I get rid of it?

remove the logical volume...
Code:

# umount /dev/mapper/cryptlv
# cryptsetup luksClose /dev/vol1/lv1
# # Be sure you no longer want to utilize the encrypted LV before proceeding.
# # This will delete the LV; remove or comment its line in /etc/crypttab.
# lvchange -an /dev/vol1/lv1
# lvremove /dev/vol1/lv1


:study:

manyrootsofallevil 02-21-2011 01:58 AM

Quote:

Originally Posted by rayfordj (Post 4263765)
Because LVM leverages device-mapper to map the underlying [physical volume] block device(s)'s physical-extents to the logical-extents that comprise the logical volume.



Ah, but you did when you created the logical-volume named lv1. ;)




remove the logical volume...
Code:

# umount /dev/mapper/cryptlv
# cryptsetup luksClose /dev/vol1/lv1
# # Be sure you no longer want to utilize the encrypted LV before proceeding.
# # This will delete the LV; remove or comment its line in /etc/crypttab.
# lvchange -an /dev/vol1/lv1
# lvremove /dev/vol1/lv1


:study:

Thanks for the reply :hattip:

I had actually worked it all out, after I posted, just too lazy to answer my own post.

It's amazing what happens when one stops and reads documentation :doh:


All times are GMT -5. The time now is 09:51 PM.