The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

18.2.2 Creating and Using a Swap File

Note

Configuring a swap file on a btrfs file system is not supported.

To create and use a swap file:

  1. Use the dd command to create a file of the required size (for example, one million one-kilobyte blocks):

    # dd if=/dev/zero of=/swapfile bs=1024 count=1000000
  2. Initialize the file as a swap file:

    # mkswap /swapfile
  3. Enable swapping to the swap file:

    # swapon /swapfile
  4. Add an entry to /etc/fstab for the swap file so that the system uses it following the next reboot:

    /swapfile       swap       swap       defaults       0 0