How can I safely shrink an encrypted Linux drive for a Windows installation?
Asked by
MellowCedar47
I'm running Pop!_OS 24.04 LTS on a 1 TB SSD and want to free roughly half of the drive for a Windows installation, mainly to use SolidWorks. The Linux installation contains important school files, so I cannot wipe it. I tried unlocking the drive and using GParted, but I haven't been able to shrink it. Pop!_OS enabled encryption during installation, and I'm not sure whether the setup uses LUKS, LVM, or both. What is the safest way to create unallocated space without losing my Linux system or files?
Answers
If you cannot make and test a full backup, the safer choices are installing Windows on another SSD or using a separate external drive. Windows setup can also overwrite or alter boot entries, so keep a Linux live USB available for boot repair afterward. With a single drive and no reliable backup, repartitioning an encrypted system is a high-risk operation even when the commands are technically correct.
Reply to this answer
First identify the layout from a live environment with commands such as `lsblk -f`, `cryptsetup luksDump`, `pvs`, `vgs`, and `lvs`. Pop!_OS commonly uses LUKS with LVM, but you should confirm rather than assume. After unlocking it, the general sequence is: check and shrink the filesystem, reduce the logical volume, move any allocated data toward the beginning of the physical volume, reduce the physical volume, close the encrypted volume, and only then shrink the outer partition. Do not resize the outer partition first, and do not rely on a guessed size.
Reply to this answer
Back up everything important before attempting this. Shrinking an encrypted installation is possible, but GParted usually cannot safely resize a locked LUKS container. You generally have to boot from a live USB, unlock the LUKS volume, shrink the filesystem first, then shrink the logical volume or physical volume, the LUKS container, and finally the partition. The order matters, and one incorrect size can make the installation unbootable. If the files are important, making a complete backup or disk image first is strongly recommended.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions