Creating swap on a file

Creating swap on a file (1Gb in the example, specified by “count”), instead on a partition:

swapoff -a
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile
swapon -a

Add this to /etc/fstab to mount at boot:

/swapfile       none    swap    sw      0       0

Credits: http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s