Difference between revisions of "Creating Swap File"

From PrgmrWiki
m
Line 3: Line 3:
 
To add a 500mb swap file change count=500 to another number for a smaller or bigger swap file
 
To add a 500mb swap file change count=500 to another number for a smaller or bigger swap file
 
<pre>
 
<pre>
# dd if=/dev/zero of=/var/swap2 bs=1024k count='''500'''
+
# dd if=/dev/zero of=/var/swap2 bs=1024k count=500
 
# chown root:root /var/swap2
 
# chown root:root /var/swap2
 
# chmod 700 /var/swap2
 
# chmod 700 /var/swap2

Revision as of 21:09, 18 July 2009

To add a swap file to your vps run the following as root

To add a 500mb swap file change count=500 to another number for a smaller or bigger swap file

# dd if=/dev/zero of=/var/swap2 bs=1024k count=500
# chown root:root /var/swap2
# chmod 700 /var/swap2
# mkswap /var/swap2
# swapon /var/swap2

To have the swap file recreated after a reboot, add the following to /etc/fstab

/var/swap2       none    swap    sw      0       0