You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How To Create a Swap File to Increase Swap Memory On OCI Linux Instances

edited Jun 30, 2022 1:56PM in Linux

How to increase the amount of swap space on a Linux system by creating a new swap file.

Use root user privileges when running any commands in the following steps.


Confirm there is enough space on the root file system (rootfs) for both the new swap file you intend to create and for any other applications, logs, or other files you intend to locate on the rootfs. You can do this by running the "df" command and reviewing the output.

1) Create a new directory on the current file system for the new swap file:

# mkdir /swap

2) Create the new swap file in the new directory (this example creates a 2Gb sized file):

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!