I'm curious why most Linux installers still prefer to set up a swap partition rather than a swap file. I understand that swap files are more flexible and can be resized on the fly, while swap partitions are fixed in size when created during installation unless you want to take the risk of resizing them later. What's the reasoning behind this preference?
4 Answers
There are some issues with certain functionalities when using swap files instead of partitions. They don't exactly match up, in terms of behavior. Unless you've upgraded your RAM, you probably won't need to change the size of your swap often. Resizing file systems isn't something most users should do without understanding how partitions work, even if it is usually safe.
I actually use swap mainly as an indicator for system memory use. I had some strange out-of-memory experiences while experimenting, so I enabled systemd-oomd, which has worked well as it alerts me when swap starts filling up.
Using a swap partition can be better for btrfs users because swap files require you to disable copy-on-write and other features. With a swap partition, you don't have to worry about that. It's still viable to use swap files; it just adds a bit of complexity during setup.
In 2025, with memory being quite affordable, I've stopped configuring disk swaps altogether on my machines. Instead, I use zRAM, which Fedora prefers too. My main question is why installers still ask for disk swap settings instead of just using zRAM? For those with HDDs, zRAM is a better option and generally works without issues unless you're using a lot of swap.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures