Add a file to the swap

April 15, 2014
Sometimes you can need to add more swap and you can’t change the partitioning of your disk. You can add a file to you swap that we be handle like a disk partition. I recommand to create that file on a ssd disk, because when you server start to swap, it’s not a good side. But for some specific case you may have to to it: We create a 1G file and add it to the swap
dd if=/dev/zero of=/swap bs=1024 count=1048576
mkswap /swap
swapon /swap
echo "/swap swap swap defaults 0 0" >> /etc/fstab

posted in System Administrator by nico

Follow comments via the RSS Feed| Trackback URL