Categories
Linux

Creating a file based swap

First create a file "swapfile" with the input file of /dev/zero and the output file of "swapfile"
Byte Size is 1 gig and the loop count is 1, so it will create a file that is 1 GB.

Create the file:

dd if=/dev/zero of=swapfile bs=1G count=1

Then we permission it:

chmod 600 swapfile

Format it:

mkswap swapfile

And turn it on!:

swapon swapfile

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.