The Move to Swap Files in Ubuntu

The 17.04 release of Ubuntu has come even closer to a modern desktop solution. That’s right; swap files are here. While it isn’t cutting-edge technology, the reason behind the shift (and the concept itself) is worth explaining.

Why Swap?

If you bought a computer today, you would likely concern yourself with three things: storage, RAM, and processing power. These requirements are no different from the past. However, their relative prices have shifted.

Today, you will spend much more on high-capacity SSD storage than on RAM. Devices often overprovision so much that the concept of running out of memory is long gone. Past prices, however, meant that much thought went into what happens when an application needs RAM that isn’t there.

Swap space was the answer. A swap partition–while slower than RAM–allowed programs to continue storing data on a hard drive. General guidelines suggested a swap partition twice as large as available RAM. However, this practice can be hard to follow if you have just 128 GB of storage.

A Shift to Modern Workloads

If you come from the software development world, KISS (keep it simple, stupid) may come to mind. Just shrink the swap partition, right? This solution is problematic for two reasons: it’s tedious for seasoned users and disastrous for beginners.

Many developers offload RAM-intensive tasks to dedicated machines. Occasionally, though, development tools are built from scratch, creating the desire for swap. Likewise, the beginner may see their requirements fluctuate. A swap file–the new default in Ubuntu 17.04–allows you to be as flexible as you desire.

One File

If you install the new release from scratch (making sure to opt out of LVM), your root directory will now contain a swap file. The new format ignores old size guidelines; it is either 2 GB or 5% of disk space–whichever is smaller.

This release does not yet support dynamic resizing. That is, the size of the file will not change automatically to meet usage. You can, however, change it using a few simple commands, without the risk of data corruption.

One Step Closer

The addition of a default swap file has removed historical baggage and tightened up the user experience. Canonical may not have reached the masses just yet, but features such as this ensure it finds a place in new stories to come.


Viscount House,
River Lane,
Chester CH4 8RH

Contact information

Phone: 0333 335 0052