Squoggle

Mac's tech blog

Tag Archives: windows

Linux Mint 22 – Custom UEFI LVM Installation

Linux Mint’s Cinnamon desktop is one of the most productive and visually clean environments. However, its installation process has limitations, such as minimal support for Logical Volumes (LVM) on multiple devices. This guide provides a detailed walkthrough for configuring Linux Mint 22 with UEFI and LVM across multiple storage devices, allowing for advanced customization.

This guide documents the steps I followed to install Linux Mint 22 using Logical Volumes across multiple physical storage devices. By sharing this process, I aim to help others replicate this setup, whether on virtual machines or physical hardware

My Setup

For this installation I am doing the installation and configuration on a VirtualBox Virtual machine to test the process and in theory duplicate the process on a physical host. The salient details of the hardware are follows:

HardwareVirtual MachinePhysical Machine
Memory32 GB64 GB
Processors48
Disk via SATA Controller100 GB1 TB
Disk via NVME Controller10 GB2 TB

Partitioning

One of the reasons I’m doing this custom installation is that the automated installation does not allow me to customize the partitioning. One of the things I want to accomplish is customizing the amount of swap space so that I can configure Hibernation on this host. In order to do so I need more swap space defined than I have configured in memory. The below table is an outline of the physical devices and partitions I want to create:

Partition Setup Overview

/dev/sda:

  1. /dev/sda1: EFI partition (1 GB, FAT32).
    • The EFI partition only needs to hold the bootloader and essential EFI files. A 1 GB size provides ample space for future updates or additional boot entries, without wasting disk space.
  2. /dev/sda2: 4GB ext4 filesystem mounted at /boot
    • The /boot partition houses the Linux kernel, initramfs, and other boot-related files. A 4 GB allocation ensures sufficient space for kernel updates, multiple kernels, and recovery options, especially useful if the system uses custom kernels.
  3. /dev/sda3: Physical Volume (PV) for LVM for swap space (48 GB) and for root file system (remaining space).
    • Allocating the remaining space to an LVM PV provides flexibility. It allows dynamic resizing of logical volumes for swap and the root filesystem as needs evolve. By defining a large swap space (48 GB), the system supports hibernation, which requires swap space to be at least equal to the amount of installed memory. The rest is allocated to the root filesystem to hold the operating system and application files.

/dev/nvme0n1:

  1. Physical Volume (PV) for LVM for /home (entire device).
    • Using the entire NVMe device for the /home logical volume ensures fast access to user data and provides a clear separation from the root filesystem. This approach enhances performance and simplifies backups or future migrations of user data.

Steps to Configure /dev/sda

1. Open GParted

  1. Boot into the Linux Mint live session.
  2. Launch GParted from the menu.
  3. Select /dev/sda from the dropdown at the top-right.

2. Create GPT Partition Table on /dev/sda

  1. Go to Device > Create Partition Table.
  2. Select GPT as the new partition table type and click Apply.

3. Create EFI Partition

  1. Right-click on the unallocated space and select New.
  2. Configure:
    • Size: 1 GB.
    • File System: fat32.
    • Label: EFI.
  3. Click Add.
  4. Apply all changes:
    • Click the checkmark (green tick). Click Apply.
  5. Set flags:
    • Right-click the partition > Manage Flags.
    • Enable boot and esp flags.

4. Create Boot Partition

  1. Right-click on the unallocated space and select New.
  2. Configure:
    • Size: 4 GB.
    • File System: ext4.
    • Label: Boot.
  3. Click Add.

5. Create LVM Physical Volume

This LVM Physical Volume will contain both the SWAP space and the Root (“/”) file system.

  1. LVM/PV Partition:
    • Right-click the remaining unallocated space and select New.
    • Configure:
      • Size: Remaining Space.
      • File System: lvm2 pv
      • Label: SDA PV.
    • Click Add.
  2. Apply all changes:
    • Click the checkmark (green tick). Click Apply.

6. Check your work

You can check your work with the following terminal commands:

sudo pvdisplay
sudo fdisk -l /dev/sda

You should see indications of what you have created with Gparted.

Steps to Configure /dev/nvme0n1

Since the entire nvme device is going to be configured as LVM, nothing needs to be done other than what is done below in the terminal.

Setup LVM Using the Terminal

1. Prepare Physical Volumes

Run these commands in the terminal:

sudo pvcreate /dev/nvme0n1 # Physical Volume for /home

Verify the Physical Volumes have been created:

sudo pvdisplay

2. Create Volume Groups

sudo vgcreate vg_sda /dev/sda3
sudo vgcreate vg_nvme0 /dev/nvme0n1

Verify the Volume Groups:

sudo vgdisplay

3. Create Logical Volumes

  1. Swap:
    sudo lvcreate -L 96G -n lv_swap vg_sda
  2. Root:
    sudo lvcreate -l 100%FREE -n lv_root vg_sda
  3. Home:
    sudo lvcreate -l 100%FREE -n lv_home vg_nvme0

Verify the Logical Volumes:

sudo lvdisplay

4. Format Logical Volumes

I will be formatting the lv_root and lv_home Logical Volumes during the next section. It is not required to do it here.

Enable the swap Logical Volume:
sudo mkswap /dev/vg_sda/lv_swap

Verify everything with this:

lsblk -f

You should see a representation of how you have partitioned your devices

5. Mount Points in Installer

I’m using ext4 for compatibility and performance.

  1. During installation, choose Something Else.
  2. Assign:
    • /dev/mapper/vg_nvme0-lv_home: /home and format to ext4
    • /dev/mapper/vg_sda-lv_root: / and format to ext4
    • /dev/mapper/vg_sda-lv_swap: swap space
    • /dev/sda1: EFI System Partition automatically formatted to (FAT32)
    • /dev/sda2: /boot and format to ext4
  3. Set Device for boot loader installation to /dev/sda. /dev/sda is used for boot loader installation because it houses the EFI System Partition, ensuring compatibility, reliability, and ease of management in a UEFI-based system.

6. Install Linux Mint

  1. You should now be ready to install. Click the Install Now button.
  2. You will see a summary of what the installer is going to do. If you are satisfied, click the Continue button.