Re-install Linux Mint 21 to an existing LVM Logical Volume on LUKS

Last updated on 2022-10-29 Tagged under  #mint   #linux   #luks   #lvm 

When installing Linux Mint, I like to create storage space to hold the contents of my home directory that is separate from the space that contains the root filesystem. If for any reason I wish to re-install Mint in the future, this setup will preserve user data when installing a fresh copy of the operating system.

My setup

My previous install used a combination of Linux Unified Key Setup (LUKS) and Logical Volume Manager (LVM) to encrypt the storage space and create "virtual partitions" (Logical Volumes or LVs) for separate root and home file systems.

Current layout for (example) disk vda:

Goal: Re-install Linux Mint to root LV while leaving home LV untouched.

This is how I do it ...

1. Before running the installer: Unlock LUKS

Open the terminal and switch to root with sudo -i.

Identify the encrypted LUKS partition ...

lsblk -f | grep LUKS

For the purposes of this HOWTO, the example used will be the drive vda and LUKS partition vda4.

Unlock the partition ...

cryptsetup open /dev/vda4 vda4_crypt

2. Installation type

Start the installer.

At Installation type choose Something else.


Partitions and the LVM LV's will appear in the installer.

2.1 Home

Configure /dev/mapper/vgmint-home and do NOT format (keep our user data intact).



2.2 Root

Configure /dev/mapper/vgmint-root for installation and format the LV.



2.3 Boot

Configure and format /dev/vda3 as the unencrypted boot partition.



3. Write changes

Confirm that home is skipped and left unmentioned, then save changes to disk.


Proceed with the rest of the install as per normal.

When the Mint installer finishes, select Continue Testing.


4. Mount

Switch back to the terminal and mount file systems ...

mount /dev/mapper/vgmint-root /mnt/
mount /dev/vda3 /mnt/boot/
mount --rbind /dev/ /mnt/dev/
mount --rbind /sys/ /mnt/sys/
mount --rbind /run/ /mnt/run/
mount --rbind /proc/ /mnt/proc/

5. Chroot

chroot /mnt /bin/bash -l

6. Crypttab

User will be prompted at boot to enter the existing passphrase that unlocks the encrypted LUKS partition.

Create /etc/crypttab (for our example LUKS partition vda4) ...

UUID=$(blkid -s UUID -o value /dev/${LUKSPART})
echo "${LUKSPART}_crypt UUID=${UUID} none luks,discard" > /etc/crypttab  

7. Initramfs

update-initramfs -u -k all

8. Finish

Exit the chroot ...


Unmount ...

umount -l /mnt

Deactivate swap and volume group ...

swapoff -a
lvchange -an vgmint

Remove the encrypted device mapping (example: vda4_crypt) ...

cryptsetup close vda4_crypt

Close terminal and reboot!

Helpful: ubiquity does not support existing LUKS encrypted partitions

Thanks for reading! Read other posts?

» Later: MintyFresh

« Earlier: Install Linux Mint 21 with custom LVM on LUKS