I have LUKS on LVM (LVM Partitions created first, then each partition is encrypted separately, following this guide on Arch Wiki).
I am using two volume groups, and each is isolated to a drive. This is because I have one SSD and one platter, and I knew I would want to replace the platter down the road.
I'm now down the road, and want to replace the platter.
Here is what I have:
======================== /dev/sda - small SSD ------------------------ /dev/sda1 /boot unencrypted, GRUB /dev/sda2 PV, vgssd ------------------------ houses: LV VG Decrypted to => Mounted to root vgssd /dev/mapper/vgssdd-root_crypt => / swap vgssd swap usrlocal vgssd /dev/mapper/vgssdd-usrlocal_crypt => /usr/local ======================== /dev/sdb - large platter HDD ------------------------ /dev/sdb1 PV, vghdd ------------------------ houses: LV VG Decrypted to => Mounted to home vghdd /dev/mapper/vghdd-home_crypt => /home tmp vghdd /dev/mapper/vghdd-tmp_crypt => /tmp varlog vghdd /dev/mapper/vghdd-varlog_crypt => /var/log ========================
What I tried
Given that the crypts are set up inside of (and isolated to) the partitions, I thought that I should be able to simply do:
- Add the new drive via external case (lists as /dev/sdd)
Mark it as a Physical Volume for LVM
Add it to the vghdd Volume Group
vgextend vghdd /dev/sdd
Move the extents from the old drive to the new drive
vgmove /dev/sdb1 /dev/sdd
Remove the old drive from the Volume Group
vgreduce vghdd /dev/sdb1
All of that went well. I then assumed, probably incorrectly, that nothing would need to be adjusted in crypttab, GRUB, or initramfs.
So, I shut down, swapped out the old and new drive, and turned on the system to find a nice little white cursor flashing at me, rather than GRUB.
Recovery note:I then put the old drive back in and was able to boot, but the partitions that had been on it were obviously not there; I reversed the above, moving the PEs from the new drive to the old, and then was able to boot normally.
Crypt & fstab notes
Anyway, now I'm left with wondering what else I would need to do to migrate. I've found a lot of help about spanning disks with LUKS on LVM, but that's not really what I'm after.
- My crypttab had UUIDs; I didn't catch that ahead of time, but this shouldn't prevent GRUB from loading, as it loaded and booted OK when the HDD disk was present but empty.
- My fstab points to /var/mapper/blahs; these shouln't need to be modified, unless I missed something.
- Does GRUB and/or initramfs care about the PV GUID or the LV guids?
- Do I need to rebuild GRUB?
- Do I need to rerun initramfs?
- Is there something else I'm missing?
- What is the proper order of steps AFTER the vgmove?