Adding an additional swap file on Linux

Adjust your call to dd to get the size you want.


[root@host ~]# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
[root@host ~]# sync
[root@host ~]# mkswap /swapfile
Setting up swapspace version 1, size = 1073737 kB
[root@host ~]# swapon /swapfile
[root@host ~]# echo "/swapfile swap swap defaults 0 0" >> /etc/fstab

This entry was posted on Wednesday, May 16th, 2007 at 8:18 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Adding an additional swap file on Linux”

  1. vmann says:

    Don’t try this under OpenVZ/VZ though, seems to actually use _more_ memory.

Leave a Reply