I got a problem with my swap space.
I got a small server with 1Gb ram.
It is getting to its limit.
It want to swap out memory but because there is no partition for swap,
so it is killing some processes.
How can i fix this, without adding a partition ?
swap partition not present
-
Chris
- Site Admin
- Posts: 132
- Joined: Mon Jul 21, 2008 9:45 am
- Location: Leuven, Belgium
Re: swap partition not present
You can choose to add a swap-file.
Similar to what windows does.
you create a swap-file, usually in root. But do it on the partition with the most space.
Usually you take 2 times the available ram, 1G ram x 2 = 2G swapfile.
Assign it read/write permissions for root only (not strictly needed, but more secure)
Format as swap:
And activate it for the current session (no reboot needed)
You can verify with:
Similar to what windows does.
you create a swap-file, usually in root. But do it on the partition with the most space.
Code: Select all
sudo fallocate -l 2G /swapfileAssign it read/write permissions for root only (not strictly needed, but more secure)
Code: Select all
sudo chmod 600 /swapfileCode: Select all
sudo mkswap /swapfileCode: Select all
sudo swapon /swapfileYou can verify with:
Code: Select all
swapon -s