I have an 18.04 ubuntu based system using their LVM on top of LUKS setup on one drive, and I want to add an additional drive /dev/sdb
to extend root (i.e. /).
VG name lubuntu-vg
, LV name root
, LV Path /dev/lubuntu-vg/root
I am able to do this as detailed below, but when I boot, the newly crypted drive isn't mounting and I get these errors:
Couldn't find device with uuid 88f32fa1-e533-4b7f-9a3b-f37275766f94.
(snip)
Refusing activation of partial LV lubuntu-vg/root (snip)
/dev/mapper/lubuntu--vg-root does not exist. Dropping to a shell!
The UUID above is for /dev/mapper/sdb1_crypt
(not /dev/sdb1
). I can boot to a live distrib and manually mount things and access the extended / lvm via cli.
Here's what I'm doing to get to this point:
# Create primary partition n, p, w
fdisk /dev/sdb
cryptsetup -y -v luksFormat /dev/sdb1
cryptsetup luksOpen /dev/sdb1 sdb1_crypt
pvcreate /dev/mapper/sdb1_crypt
vgextend lubuntu-vg /dev/mapper/sdb1_crypt
lvextend -l +100%FREE /dev/lubuntu-vg/root
resize2fs /dev/lubuntu-vg/root
So far so good now have a large encrypted / using new drive, now set it up to use a key (i've also tried without using a key same issue):
dd if=/dev/urandom of=/root/.keyfile bs=1024 count=4
chmod 0400 /root/.keyfile
cryptsetup luksAddKey /dev/sdb1 /root/.keyfile
Get UUID and add entry to /etc/crypttab
:
blkid /dev/sdb1
sdb1_crypt UUID=106b6483-443e-44ec-b134-176db8da927f /root/.keyfile luks,discard
Here's where I'm unsure and maybe going wrong? I'm not adding anything to /etc/fstab
because I already have an entry for:
/dev/mapper/lubuntu--vg-root / ext4 errors=remount-ro 0 1
And then upon reboot the result is the issue detailed at start.
Thanks in advance for help.