Support optionally creating swapfiles in the Ubuntu installer, in place of, or in addition to swap partitions.


The Debian/Ubuntu installer partitioning will, by default, create a swap partition on the disk. If a user customizes the installation partitioning and does not create a swap partition, the Debian/Ubuntu installer warns the user that no swap space has been specified.

Swap files offers superior administrative flexibility over swap partitions, while performing equivalently. Swap partitions are very difficult to resize. Swap files can be easily resized and activated without rebooting.

Use Cases

  • Gabe has a shiny new laptop/desktop/workstation with N GB of RAM, but slots for more. He certainly plans on adding more memory to his system before he plans on reinstalling/repartitioning his hard drive. Rather than overallocating (wasting) disk space on an excessively large swap partition in the near term, Gabe would like to create a swap file, such that he can dynamically resize the swap space at a later date.

  • Kyle administers a farm of KVM virtual machines. He is frequently adding/removing memory to/from these virtual machines. As such, he prefers swap files over swap partitions, in that his scripts can dynamically adjust the swap file sizes appropriately with the assigned memory. Kyle would like to install his virtual machines to be configured with swap files.


The intention is to modify the Debian/Ubuntu installer to allow a manual partitioning user to create a swapfile instead of, or in addition to a swap partition. The "no-swap-check" should also be enhanced to check for both swap files and partitions.

This specification is not suggesting that the installer should use swap files rather than swap partitions by default.


Create new helper shell utilities to be used by both the installer and administrators post-installation to:

  • create a swap file (dd + mkswap + swapon + mangle-/etc/fstab)
  • delete a swap file (swapoff + rm + mangle-/etc/fstab)
  • resize a swap file
  • relocate a swap file

Modify the Debian/Ubuntu installer:

  • advanced partitioning
    • add an interface for creating, naming, and sizing a swap file on an existing filesystem
    • suggest a default name for the swap file
    • suggest appropriate swap file size (similar logic as swap partition size)
  • enhance the "check-for-swap-space" to look for both swap files and partitions
  • write appropriate entries to /etc/fstab
  • support swap files configuration in non-interactive installs (kickstart, etc)


Not yet started.

Outstanding Issues

Ubuntu does not currently support hibernation/resume to swap files (see: 83325). This is of particular importance to WUBI-installed Ubuntu users, as WUBI uses swapfiles by default and Windows users are often disappointed by the lack of ability to hibernate/resume in their new Ubuntu installations.

Solving 83325 would significantly improve the user experience for Ubuntu swapfile users.

BoF agenda and discussion


SwapfileAtInstallation (last edited 2008-08-06 16:36:34 by localhost)