How To Add Swap on Ubuntu 14.04

Опубликовано: 02 Октябрь 2014
на канале: NixInPix
10,852
57

How To Add Swap on Ubuntu? Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.

Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.

Commands:

sudo swapon -s
free -m
df -h
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
free -m
sudo nano /etc/fstab

Add text : "/swapfile none swap sw 0 0"

cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=10
sudo nano /etc/sysctl.conf

Add: vm.swappiness=10

cat /proc/sys/vm/vfs_cache_pressure
sudo sysctl vm.vfs_cache_pressure=50
sudo nano /etc/sysctl.conf

Add: vm.vfs_cache_pressure = 50

You can restart server and check is there is swap.

You can always Deploy an SSD cloud server in 55 seconds
with Digitalocean.
Anyone how use this link will receive $10 in hosting credit immediately after unlocking their account by adding a valid payment method.
Sign Up with this link
https://www.digitalocean.com/?refcode...
(affiliate, referral)


Смотрите видео How To Add Swap on Ubuntu 14.04 онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал NixInPix 02 Октябрь 2014. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 10,852 раз и оно понравилось 57 посетителям.