How Do I Create a Swap File in an Existing Linux Data Partition?
Contents

Where can I create a swap file?

Adding swap space in Linux

  1. Create a swap file using the dd command. …
  2. Change the permission of the swap file using the chmod command so that only root can access it. …
  3. Make this file a swap file using the mkswap command. …
  4. Enable the newly created swapfile using the swapon command.

What is a Linux swap file?

A swap file allows an operating system to use hard disk space to simulate extra memory. … Other operating systems, like Linux and Unix, set aside a permanent swap space that reserves a certain portion of your hard disk.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest