WHY DO I HAVE TO CONSIDER SWAP in 2026?
Stop making swap partitions—use swap files instead
181–190 of 256 posts
Re: Stop making swap partitions—use swap files instead
#182Re: Stop making swap partitions—use swap files instead
#183[flagged]
Also, this seems to be based on a email from 2005, about kernel version 2.4 and 2.6, and their differences. Things might have changed since then, and also depends on a lot of factors, not the least what filesystem you use. I'm not sure people should seriously follow advice that basically boils down to "do this always it's best". Better instead to make yourself informed about the tradeoffs, then make your own choice,…
See:
https://github.com/torvalds/linux/blob/827751b699b79a6e56998...
https://github.com/torvalds/linux/blob/827751b699b79a6e56998...
The thread is quoted to show that they have been functionally equivalent for several decades and yet distros continue to push outdated recommendations.
Re: Stop making swap partitions—use swap files instead
#184Couple of things this didn't consider. * If you have a small root partition, the default config puts the swap file on there, wasting precious space. * With a partition, it's easier to put swap on a separate physical device, which is good for performance. * If you dual boot 2+ Linux distributions or installations on a single machine, as I do routinely, you can share a single swap partition between distros no problem.…
Of what distro? If you mean that the example code shows the swapfile directly under / , well of course you don't have to do it that way.
> With a partition, it's easier to put swap on a separate physical device, which is good for performance.
I think this is untrue on both counts. First, nobody is going to dedicate an entire physical device to swap, because the smallest storage devices you can get are enormous compared to the RAM they're trying to support. If the device is "separate" (from what, / ?) but still has other things on it, it's even less clear why this would matter for performance. But also it's trivial to put a swapfile on whatever device you want. It can be anywhere reasonably sane in the filesystem, you just give it a path.
> you can share a single swap partition between distros no problem
The file could go on whatever partition the distros can share. Maybe put it under /home or something. It's your system, the FHS is up to your own interpretation.
> And of course there's hibernation, as others have mentioned.
Why would that matter? You're expecting a file not to survive the low-power state?
Re: Stop making swap partitions—use swap files instead
#185> fallocate / chmod / mkswap Why not "mkswap --size ... --file ...", which does these three things and more? For instance, according to the mkswap man page, "[...] sets the nocow attribute for newly created files [...]" which is a detail that seems to be missing from this gist.
Re: Stop making swap partitions—use swap files instead
#186Earlier quoted context omitted.
On x64 CPU for laptops the memory bandwidth is rather limited and a fast compressor like lz4 can saturate it. As the result latest SSD are faster then z-ram when using hardware encryption on SSD.
If you care about performance you shouldn't be running from swap period. Swap is just a safety net.
Re: Stop making swap partitions—use swap files instead
#187Couple of things this didn't consider. * If you have a small root partition, the default config puts the swap file on there, wasting precious space. * With a partition, it's easier to put swap on a separate physical device, which is good for performance. * If you dual boot 2+ Linux distributions or installations on a single machine, as I do routinely, you can share a single swap partition between distros no problem.…
> If you have a small root partition, the default config Of what distro? If you mean that the example code shows the swapfile directly under / , well of course you don't have to do it that way. > With a partition, it's easier to put swap on a separate physical device, which is good for performance. I think this is untrue on both counts. First, nobody is going to dedicate an entire physical device to swap, because the…
Re: Stop making swap partitions—use swap files instead
#188Re: Stop making swap partitions—use swap files instead
#189There used to be a time when not only the OS required using partitions for optimum performace (swapfiles) but also applications. In the late 90s databases were regularly set up in a way to store their data on raw partitions. There were other types of applications too that required partitions but for databases it was really common. The practice really only died with OSes allowing apps to bypass the normal filesystem c…