4 ms·
Assuming you're using Linux, if you're using LVM on LUKS: Back everything up first. - Boot to a live disk. - DD the disk from the first sector to the end of
by Tsiklon 8y ago
Assuming you're using Linux, if you're using LVM on LUKS:
Back everything up first.
- Boot to a live disk.
- DD the disk from the first sector to the end of /boot over to the new disk.
- open your preferred partitioning tool to fix the GPT (as no backup GPT will be present on the second disk)
- remove the partition denoting crypto-vol1 from the second disk - note the first sector
- add a new partition starting from the original start of crypto-vol1 to the end of the disk
- FSCK the partition /boot sits on
- create a second crypto volume on the new partition on the second disk
- create a single Physical volume on Crypto-Vol2.
- add the PV to the same Volume Group as the PV containing Crypto-Vol1
- PV Move everything from Crypto-Vol1 -> Crypto-Vol2
- extend your logical volumes to the desired length with lvextend, and complete the work with your filesystem's resize tool
At this point all your data is present on the new disk
From here you'll want to mount the filesystems and chroot into the system - you'll need to edit /etc/crypttab replacing the entry for Crypto-Vol1 with the UUID for Crypto-Vol2.
Then you'll need to regenerate your initramfs to load the new crypttab.
This will allow you to boot from the system on the new disk.
I've likely forgotten something here - It's quite an involved process - but not impossible.