Shrink encrypted LVM root partition (463,77GB) by 23GB and resize swap partition (1G) to 24GB
NOTE: Substitute partition names and similar with names that match your system or command output
The following commands are run from live USB
# Install tools
sudo apt update
sudo apt install lvm2 cryptsetup
# Load dm-crypt module
sudo modprobe dm-crypt
# List and identify partitions
lsblk
sudo fdisk --list /dev/sdb
# Unlock encrypted physical partition
sudo cryptsetup luksOpen /dev/sdb3 sdb3_crypt
# Rescan the available physical partitions
sudo vgscan --mknodes
# Make the logical volumes known to the kernel
sudo vgchange -ay
# Lists all available LVM partitions
sudo lvdisplay
# Run a file system check on root partition
sudo e2fsck -f /dev/mapper/vg-root
# Shrink file system to 439 GB down from 463 = -24GB (1GB more than needed)
sudo resize2fs /dev/mapper/vg-root 439G
# Shrink root partition by 23 GB down from 463 to 440 = -23GB
sudo lvreduce -L -23G /dev/mapper/vg-root
# Extend the file system to use all available space within the logical volume
sudo resize2fs /dev/mapper/vg-root
# Stop LVM and close the LUKS encrypted disk to ensure all the changes are saved properly
sudo vgchange -an
sudo cryptsetup luksClose sdb3_crypt
The following commands are run from system once booted up
# Lists all available LVM partitions
sudo lvdisplay
# Turn off swap
sudo swapoff -v /dev/mapper/vg-swap_1
# Extend 1GB swap with available free space
sudo lvextend -l +100%FREE /dev/mapper/vg-swap_1
# Format the new swap partition
sudo mkswap /dev/mapper/vg-swap_1
# Turn on swap
sudo swapon -v /dev/mapper/vg-swap_1
# Test if the swap logical volume was successfully extended and activated
cat /proc/swaps
free -h
lsblk
LVM Resize – How to Decrease an LVM Partition