[ale] Mission accomplished - LUKS & LVM
Scott Castaline
skotchman at gmail.com
Wed Feb 10 23:31:04 EST 2010
Original setup at time of Fedora 12 install:
sda WD 500GB
2 partitions sda1 /boot 300MB
sda2 VG01 LUKS
sdb Seagate 500GB
1 partition sdb1 VG02 LUKS
sdc Seagate 500GB
1 partition sdc1 VG03 LUKS
sdd Seagate 500GB
1 partition sdd1 formatted as ext4 backup
VG01 8 LVs formatted as ext4
1 LV formatted as swap labelled swap01 LUKS
VG02 2 LVs formatted as ext4
1 LV formatted as swap labelled swap02 LUKS
VG03 1 LV formatted as ext4
I wanted to replace VG03 with a 1TB and later combine the replaced 500GB
with VG02. I had to first remove the drive from LVM with lvremove,
vgremove, and pvremove. Then I did the following:
1. Used fdisk to create 1 partition using the full hdd on /dev/sdd
2. cryptsetup -c aes-xts-plain -s 512 luksFormat /dev/sdd1
3. cryptsetup luksUUID /dev/sdd1 to retrieve the UUID assigned by LUKS
4. cryptsetup luksOpen /dev/sdd1 luks-<the UUID retrieved in 3>
Enter LUKS passphrase for /dev/sdd1:
key slot 0 unlocked
Command succesfull
5. Edited /etc/crypttab adding: luks-<the UUID retrieved in 3>
UUID=<the UUID retrieved in 3> none
6. By either using dmsetup ls or ls -l /dev/mapper to find the minor
number assigned to the new luks volume
7. pvcreate /dev/dm-? (use the minor number assigned) (pvscan to
verify)
8. vgcreate Name-Of-VG /dev/sdd1 (vgscan to verify)
9. lvcreate -n Name-Of-LV -L 931G Name-Of-VG I used all free space
which you can get from the output of pvscan.
10. mkfs.ext4 /dev/mapper/VGname-LVname
11. tune2fs -o user_xattr,acl -i 0 -c -1 /dev/mapper/VGname-LVname
This is to use the same options as used in rest of Fedora12
12. cryptsetup luksClose luks-UUID this is where I started having
trouble as it came back as device was busy and I could not find
out why.
13. Add LV to fstab and reboot
It came up fine and I was able to access the new drive fine, but there
are some minor issues.
1. On boot it used to repeat "key slot 0 unlocked" 5 times, once for
each LUKS-Volume (each of the 3 VGs and the 2 swap LVs). It now repeats
7 times. I understand the 6 times because I do have the original VG03
hooked up as sdc and though it is removed from LVM it's still a LUKS
volume, but now where does the 7th one come from? Anyone know if I
missed something on the removal of the drive?
2. I also noticed 5 entries in crypttab. I can verify 4 of them with
cryptsetup luksUUID /dev/sd? but not the extra 1. Anyone know of a way
to go the other way by entering the UUID would output the physical device?
3. I have noticed that this wound up creating a total of 18 units,
devices or what ever as I now have dm-0 thru dm-17. dm-0 thru dm-3
relate to the sda, sdb, sdc, & sdd. Also dm-4 thru dm-12 relate to the
LVs on sda2, dm-13 relates to the LV on sdd1 and dm-14 thru dm-16 relate
to the LVs on sdb1, but dm-17 points to dm-16, which points to dm-0
which is sdb1???? I don't get it.
Stay tuned for further misadventures of the blown up seagate, in the
meantime can anyone enlighten me on the 3 problems?
More information about the Ale
mailing list