How to resize Pure OS partitions to gain space for dual boot (Ubuntu)

To resize (shrink) the encrypted /dev/sda5 partition I have tried these steps:

  1. Open a terminal in the live boot system

  2. Open the encrypted partition using your LUKS password:

    sudo cryptsetup luksOpen /dev/sda5 cryptdisk

  3. Then you’ll be prompted to enter the decryption key

  4. After successful decryption you have root access to your now decrypted partition

  5. Run gparted as root from the terminal and use the GUI to resize the partition

Step 5 does fail because “resize” of /dev/sda5 did not offer smaller partition sized.

Any ideas?

PS: I guess shrinking from within PureOS is not possible because the partition must be unmounted.

Update 1:

I have found step-by-step instructions how to shrink your LUKS/LVM partition:

https://help.ubuntu.com/community/ResizeEncryptedPartitions

It is so complicated and risky that I do understand now why Ubuntu recommends to backup and re-install :slight_smile:

If you still try to do so, I have some helpful commands for the first part (still incomplete):

# Load decryption kernel module
sudo modprobe dm-crypt

# Recognize and activate your LVM
sudo vgscan --mknodes
sudo vgchange -ay
# 2 logical volume(s) in volume group "crypt" now active

sudo lvscan
# Shows the two active devices within LVM (swap + root)
# /dev/crypt/swap
# /dev/crypt/root   # this device is what we need!

# You could mount the encrypted partition now but DON'T DO this since it prevents resizing!
# mkdir /media/sda5
# sudo mount /dev/crypt/root /media/sda5

# Check the file system for errors before resizing
sudo e2fsck -f /dev/crypt/root

# Resize: Shrink to 70 GB (or whatever you want by changing the number)
sudo resize2fs -p /dev/crypt/root 70G

# Check that the file system is still OK
sudo e2fsck -f /dev/crypt/root

The next parts are still missing

  • Reduce the size of your root (LVM) Logical Volume.
  • Resize your (LVM) Physical Volume.
1 Like