Moving a LUKS Partition
I had three operating systems installed on my laptop. I no longer wanted one of the operating systems. The respective partitions were in between the two operating system I wanted to retain.
I wanted to delete partitions
/dev/sda10 would be moved and renumbered respectively.
I booted to the primary operating system and deleted the unwanted partitions.
I renumbered the partition order:
x(select expert mode)
f(to fix partition numbering)
r(to return to the main menu)
w(to write changes)
I rebooted to verify the correct partition order.
gparted to move the outer partitions into the newly freed space.
I needed to modify the outer operating system system. Partition
/dev/sda10 is encrypted. There is a pecking order to perform the necessary steps. A chroot environment is needed. I performed the following:
- Boot with a Live ISO of the same operating system.
- Elevate privileges.
- Create a mount point:
- Unlock the LUKS partition:
cryptsetup luksOpen /dev/sda8 sda8_crypt.
mount /dev/mapper/sda8_crypt /mnt/chroot
mount --bind /dev /mnt/chroot/dev
mount --bind /proc /mnt/chroot/proc
mount --bind /sys /mnt/chroot/sys
mount --bind /tmp /mnt/chroot/tmp
I edited config files to match the partition movement and renumbering. This required only changing references of
sda8 in the following files:
I ran the following commands:
grub-install /dev/sda7 --force
I rebooted into the other operating system. The LUKS partition mounted to
/dev/mapper/sda8_crypt. There were no boot issues.