Skip to content
Tech News
← Back to articles

Stop making swap partitions—use swap files instead

read original get Samsung 990 PRO NVMe SSD → more articles
Why This Matters

A practical argument that Linux installers' default push toward dedicated swap partitions is outdated, since swap files have matched partition performance for over two decades. For sysadmins and desktop users alike, swap files are far easier to resize, add, or remove after install, which matters for flexible storage planning.

Key Takeaways
Worth a Look

Samsung 990 PRO NVMe SSD — If you're juggling swap files and Linux partitions, a fast NVMe drive makes every read and write—including swap—feel snappier. The Samsung 990 PRO is a top-tier M.2 drive that gives you plenty of room to fallocate a generous swapfile without worrying about space.

See Samsung 990 PRO NVMe SSD on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

Stop making swap partitions—use swap files instead!

Swap files have had the same performance characteristics as swap partitions for more than 20 years and yet, linux distributions continue to encourage the use of swap partitions during install.

Swap files are easier to use/add/remove/modify/extend after installation. They're better in every way––use swap files!

Create a swap file.

💡 You can use dd for this too but if your filesystem supports it, fallocate is faster.

fallocate -l 4G /swapfile

Only root should be able to write to the swap file.

chmod 0600 /swapfile

Format the swap file.

mkswap /swapfile

... continue reading