This guide shows how to migrate data drives from an old server to a new machine. This works when the old server is still accessible. My setup is 2 HDD → RAID 1 → LVM2 → LUKS → ext4 so it is very important to do all the steps in the correct sequence as outlined below. In my setup all data is mounted as /home
, the volume group is vg_data
, the logical volume lv_home
.
In my configuration the crypt container and mounting of the filesystem are handled in a batch file. This is not reflected here, and I have also not included instructions how to mount the encrypted container to a mount point.
/etc/mdadm/mdadm.conf
to external storage/root
to external storage/etc
to external storagesudo umount /home
You might need to force unmount
sudo cryptsetup luksClose vg_data-lv_home_crypt
vgdisplay
and lvdisplay
to understand your LVM configurationlvchange -an /dev/vg_data/lv_home
vgchange -an vg_data
vgexport vg_data
/home
mount pointmdadm.conf
) from the old server to the new serverlsblk
pvscan
to list the exported volume group(s)vgimport vg_data
vgchange -ay vg_data
lvchange -ay /dev/vg_data/lv_home
sudo cryptsetup luksOpen /dev/mapper/vg_data-lv_home vg_data-lv_home_crypt
mount /dev/mapper/vg_data-lv_home_crypt /home
fstab
and give the temporary /home
directory a new mount pointupdate-initramfs -u