I just learned that Arch Linux comes with zswap enabled by default. I've been using zram without a swap partition but want to try hibernating my laptop, which apparently requires swap. I've come across suggestions that zswap and zram can't work together, although I've been using zram while zswap was enabled without any issues. I found a thread discussing a swapfile on Btrfs, which seems appealing since I currently don't have a swap partition. Before diving in, I'd love to hear some expert opinions on whether I should go with the Btrfs swapfile option or just create a traditional swap partition. What are the pros and cons of each approach in 2025?
3 Answers
It's true that zswap and zram can actually coexist! If you're not planning on using hibernation, you might just want to stick with zram since adding a swap partition might not be necessary for you. But if you decide to go with hibernation, the Arch wiki has some good resources on maintaining a swap file while using zram. Just be sure to check that out if you get curious!
Modern swap implementations like zswap are pretty advanced, and you can even tweak how aggressively your system uses swap with swappiness settings. Honestly, just having swap doesn't mean it's always used. If you're running low on RAM while multitasking, that's when it kicks in.
Thanks for the tip! I wasn't too concerned about performance when using zram, but I guess it might depend on how I set up things moving forward.
Using a Btrfs swapfile can be a good option, especially if you want the flexibility of managing swap without dedicating a full partition. It’s worth considering if you're comfortable with Btrfs. Otherwise, creating a swap partition is straightforward and can provide stability and compatibility with various tools and usages in the long run.
I get that, but if you're looking for future-proofing or plan to run multiple applications, consider implementing zswap alongside zram. Just make sure to manage your settings wisely.