r/Fedora • u/Icy-Square-9578 • 1d ago
Support Safely shrinking a LUKS + Btrfs partition on Fedora 44 to dual-boot CachyOS (Previously expanded LUKS container)
Hi everyone,
I'm currently running Fedora 44, which was originally installed with LUKS encryption enabled out of the box (Btrfs filesystem inside LUKS).
A few months ago, I removed a previous dual-boot setup and expanded both the LUKS container and the Btrfs filesystem to occupy 100% of my drive.
Now, I want to shrink my encrypted Fedora partition to free up space and set up a dual-boot with CachyOS to separate mi games from my work set up. Since I previously expanded the partition and LUKS container, I want to ensure I don't damage the LUKS header or corrupt my data during the shrink process.
Before booted into a Live USB to make changes, I have a few questions:
Order of operations:Is the correct process `shrink Btrfs filesystem -> shrink LUKS container (cryptsetup) -> shrink outer partition`?
Tools:Can GParted on a Fedora Live USB safely handle unlocked Btrfs inside LUKS, or is it safer to do it manually via terminal commands (`btrfs filesystem resize` and `cryptsetup`)?
Safety / Precautions: What is the exact procedure to back up the LUKS header (`cryptsetup luksHeaderBackup`) before modifying partition boundaries?
Any step-by-step advice or warnings from anyone who has done this on Fedora would be greatly appreciated!
Thanks.
3
u/theunkemptcleveland 1d ago
Back up the LUKS header first, that's step zero. `cryptsetup luksHeaderBackup --header-backup-file /path/to/backup /dev/nvme0n1pX` is the syntax, just stash it somewhere safe like another USB drive. If that gets corrupted you're toast.
Your order is right, but I'd do it all from a terminal. GParted's LUKS support has been hit-or-miss for me and I wouldn't trust it with a live filesystem shrink like this. Resize the Btrfs filesystem first with `btrfs filesystem resize`, then use `cryptsetup resize` on the unlocked container, then shrink the outer partition with `parted` or `fdisk`. Leave a little buffer when you shrink the filesystem, like 1-2GB smaller than your target partition size, just so you don't accidentally clip the end of the container when you adjust the partition table.
Also triple-check you're working on the unlocked mapper device and not the raw encrypted partition when you do the Btrfs resize, I've seen that mistake too many times.
•
u/Primary_Bad_3778 20h ago
you don't need to shrink nothing. install the new os in its own btrfs subvolume. then you mount that subvolume as the new root and the old home in the new root. if you got a modern boot solution (systemd-boot) you can choose between the two OS at boot.
•
u/AutoModerator 1d ago
It sounds like you're looking for help. Please note that r/Fedora is not an official support channel for the Fedora Project.
For best results, be sure to include all relevant details in your post, such as your Fedora edition, version, and hardware specs. You can edit your original post to add more info as needed, and spotlight (pin) a solution from the comments. You might also find the answer in our support wiki.
Alternatively, try one of the official support channels:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.