One tips to make your Ubuntu or other linux faster is by adding a swap space or swap file. Swap space is the area on a hard disk which is part of the Virtual Memory of your machine, which is a combination of accessible physical memory (RAM) and the swap space.
Swap space temporarily holds memory pages that are inactive. Swap space is used when your system decides that it needs physical memory for active processes and there is insufficient unused physical memory available. If the system happens to need more memory resources or space, inactive pages in physical memory are then moved to the swap space therefore freeing up that physical memory for other uses.
You need swap space or swap file if you have low memory but have enough space in your harddrive. Usually you need swap space is double of your RAM. So if you have 512MB RAM, make your swap file 1GB, and so on.
Her is how to make swap file in Ubuntu:
- Open your terminal and login as root
- Create a large empty file:
dd if=/dev/zero of=/mnt/512Mb.swap bs=1024M count=512
- Format the swap file:
mkswap /swapfile
- Turn the swap file on:
swapon /swapfile
- The additional swap is now available and can be seen by :
cat /proc/meminfo
- Add it to fstab to make it permanent:
vim /etc/fstab
- add this to the file:
/swap_file none swap sw 0 0
bs=1024M is wrong you should use either bs=1024 or bs=1M
You are a very great master linux admin, you use three different files:
1. /mnt/512Mb.swap
2. /swapfile
3. /swap_file
I do not understand, how this work.
What a load of crap. First you make a 512Gb swapfile, the making of which may well kill your machine, then as another person noted you refer to it 3 different ways.
Take this harmful crap down, my mate hosed his server trying to follow this