Install Linux Mint 21.1 with custom LVM on LUKS
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. This makes it easier if I decide to re-install Linux in the future while preserving user data.
Using a combination of Linux Unified Key Setup (LUKS) and Logical Volume Manager (LVM), I encrypt the storage space and create “virtual partitions” (Logical Volumes or LVs) for separate root and home file systems. Installing LVM on top of the encrypted partition allows the creation of multiple LVs protected by a single passphrase, and the ability to create and resize LVs as needed.
During an install of Linux Mint 21.1 "Vera" Cinnamon Edition - if you select the option to automatically erase and partition the disk using LUKS and LVM - the installer creates a single encrypted partition with two LVs: a
swap LV, and a
root LV that uses all remaining disk storage. There is no option to add a
home LV to the automatic schema.
Linux Mint is installed as the sole OS on the device. I use Mint's installer to erase, partition, and encrypt the storage space, and configure LVM.
After the installer finishes - but before rebooting - I shrink the
root LV to free up storage, then create a new
This is how I do it ...
1. During the install: Installation type
Erase disk and install Linux Mint, click on
Advanced features..., and opt to use LVM and encryption.
A password to secure the storage is entered and confirmed.
Proceed with the rest of the install as per usual.
2. After the install: Continue Testing
When the Mint installer finishes, select
3. Switch to root
Open a terminal. Switch to root using
mount | grep /dev/mapper/vgmint and ensure nothing is returned (LVs need to be unmounted).
4. View layout
lsblk -f and view the partition layout generated by the Mint installer.
Example: In my install, the partition used for encryption is
sda3 and the encrypted LUKS device is
List physical volumes (PV) with the command
vgs. There is a single PV labelled
List the LVs with
lvs. There are two:
root LV, and
Note: Only LVs with ext2, ext3, ext4, ReiserFS, and XFS file systems are supported for resizing.
5. Resize root
root LV to free up space for a new
Set the desired size of
40G) and resize its file system all at once ...
lvresize -L 40G --resizefs vgmint/root
6. Create home
Create the new
Use fixed amount of storage (example:
lvcreate -L 300G vgmint -n home
Or use percentage of free capacity (example:
lvcreate -l +80%FREE vgmint -n home
7. Format home
The new LV will appear as
Format the LV with an appropriate file system (example:
8. Move home
Mount the LVs ...
mount /dev/vgmint/root /mnt/root/
mount /dev/vgmint/home /mnt/home/
Move the contents of
/home from the
root LV to the new
home LV ...
mv /mnt/root/home/* /mnt/home/
Create an entry for
echo "/dev/mapper/vgmint-home /home ext4 defaults 0 2" >> /mnt/root/etc/fstab
Unmount LVs ...
Deactivate swap and volume group ...
lvchange -an vgmint
Remove the encrypted device mapping (example:
cryptsetup close sda3_crypt
Done. Reboot and enjoy!
» Next: Re-install Linux Mint 21.1 to an existing LVM Logical Volume on LUKS
« Previous: Nostromo boot noise