You are on page 1of 1

Adding Swap Space

Code:

$ top

top - 11:20:22 up 8:58, 2 users, load average: 0.36, 0.39, 0.37


Tasks: 93 total, 2 running, 91 sleeping, 0 stopped, 0 zombie
Cpu(s): 50.0% us, 50.0% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 451660k total, 445580k used, 6080k free, 8880k buffers
Swap: 1052216k total, 165704k used, 886512k free, 171052k cached

In short, no. You will have to assign more space on the HD.
Actually, yes. You can supplement your swap partition with a swap file. It goes something l
ike this:

1. First, create a large empty file:


Code:

sudo dd if=/dev/zero of=/swap_file bs=1M count=1000

Replace 1000 with the size of the swap file desired, in MB. You can also put the swap_file in
a different location if desired. (i.e. !GB of swap space created).

2. Next, we'll secure the swapspace, so ordinary users cannot read the contents (potential
security breach):
Code:

sudo chown root:root /swap_file


sudo chmod 600 /swap_file

3. Then, turn it into swap space:

Code:

sudo mkswap /swap_file

4. Next, turn it on:


Code:

sudo swapon /swap_file

5. To make it turn on at every bootup, open up /etc/fstab:


Code:

sudo gedit /etc/fstab

6. Add this line to the end of the file:


Code:

/swap_file none swap sw 0 0

You might also like