How can I shrink an encrypted Linux installation to make room for Windows?
Asked by
Bongo
I'm running Pop!_OS 24.04 LTS on a laptop with a 1 TB SSD, and I want to reserve roughly half of the drive for a Windows installation so I can use SolidWorks. My Linux installation contains important school files, so I need to shrink it without wiping or reinstalling the existing system. I've tried unlocking the drive and using GParted, but I haven't been able to create the unallocated space. Pop!_OS enabled encryption during installation, and I'm not sure whether the setup uses LUKS alone or LUKS combined with LVM. What is the safest procedure, and what should I check before resizing it?
Answers
First identify exactly what is encrypted. Pop!_OS commonly uses a LUKS-encrypted partition, sometimes with LVM inside it. Youโll need a complete backup of your important files before changing any partition sizes. Also make sure you have the encryption passphrase and a bootable live USB available. Never try to resize a mounted or locked filesystem.
Reply to this answer
If the layout is LUKS containing LVM, the resize has to happen from the inside outward: unlock the LUKS container, reduce the filesystem and logical volume, shrink the LVM physical volume, reduce the encrypted container, and only then shrink the actual disk partition. After that, the newly freed space can be used for Windows. Tools such as cryptsetup, vgchange, lvreduce or lvresize, e2fsck, pvmove, pvresize, and parted may be involved. The exact commands depend on your actual layout, so donโt copy a command sequence without checking device names, filesystem types, UUIDs, and sizes first.
Reply to this answer
This is a high-risk operation, especially when the system contains valuable files. Boot a live environment, inspect the layout with tools such as lsblk, blkid, cryptsetup status, pvs, vgs, and lvs, and record the output before making changes. Make a verified backup first; ideally have a recovery method for both the Linux installation and the encryption key. If youโre not comfortable calculating sector and extent boundaries, reinstalling onto a planned partition layout or getting hands-on help is safer than guessing.
socket_set: The resizing process must be done in the correct order. Reducing the outer partition first can cut off data that still exists near the end of the filesystem or encrypted container, making the installation unbootable.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Bongo: The encryption was enabled during installation, but Iโm not sure how to tell whether LVM is being used inside the encrypted partition.