Debian – Adding a disk to an encrypted LVM under Debian 6

debianlukslvm

I installed a Debian 6 with the "use LVM and encrypt" option.
Now I would like to add a second disk and also encrypt it.

This is what I did so far:

  1. pvcreate /dev/sdb
  2. vgextend [vgname] /dev/sdb
  3. lvcreate -n [lvname] -l 100%FREE [vgname]
  4. luksformat -t ext3 /dev/[vgname]/[lvname]
  5. updated fstab

Unfortunately trying to mount /dev/mapper/[vgname]-[lvname] produces the following error under dmesg:

VFS: Can't find ext3 filesystem on dev dm-3

What am I doing wrong?

Update 1:

pvscan

PV /dev/dm-0   VG reactorblock01   lvm2 [49.76 GiB / 0    free]
PV /dev/dm-3   VG reactorblock01   lvm2 [100.00 GiB / 0    free]
Total: 2 [149.75 GiB] / in use: 2 [149.75 GiB] / in no VG: 0 [0   ]

lvs

LV     VG             Attr   LSize   Origin Snap%  Move Log Copy%  Convert
backup reactorblock01 -wi-a- 100.00g
root   reactorblock01 -wi-ao  48.80g
swap_1 reactorblock01 -wi-ao 984.00m

ls -l /dev/mapper/

total 0
crw------- 1 root root 10, 59 Jul  7 23:34 control
lrwxrwxrwx 1 root root      7 Jul  8 01:52 reactorblock01-backup -> ../dm-4
lrwxrwxrwx 1 root root      7 Jul  7 23:34 reactorblock01-root -> ../dm-1
lrwxrwxrwx 1 root root      7 Jul  7 23:34 reactorblock01-swap_1 -> ../dm-2
lrwxrwxrwx 1 root root      7 Jul  7 23:34 sda5_crypt -> ../dm-0
lrwxrwxrwx 1 root root      7 Jul  8 01:44 sdb1_crypt -> ../dm-3

cat /etc/crypttab

sda5_crypt UUID=d09c908f-0f3b-4f3e-b86b-87ef817732db none luks

Update 2:

Easy as pie with this guide: https://wiki.archlinux.org/index.php/System_Encryption_with_LUKS and some manpages

Best Answer

The Debian installer sets up the 'Encrypted LVM' by

  • creating a partition on the physical drive,
  • using LUKS/DM-Crypt to encrypt the physical partition,
  • unlock the DM-crypt volume, and
  • building a LVM volume group ontop of the DM-Crypt volume.

In the procedure you followed you basically attempted to follow the steps backwards. You put LVM ontop of the physical disk, and tried to create a DM-Crypt volume on a logical volume.

If you had wanted to do it the Debian way, you should have setup DM-Crypt on the new disk, then added the encrypted device's unlocked version to the volume group. Once that was done you could create logical volumes as described in the standard LVM docs.

Are you still able to mount your other filesystems? What I think you probably need to do is revert everything you have tried so far, and then set it up with LVM on top of DM-Crypt. So remove any new logcal volumes you created, shrink the volume group, and remove the PV you added.

Related Topic