How To Add Swap on Ubuntu 14.04
How To Add Swap on Ubuntu 14.04
Adding swap space to Ubuntu 14.04 can help improve system performance and prevent memory-related issues. Here's a step-by-step tutorial on how to do it:
- Check if you have any swap space by running the following command:
- Create a swap file of the desired size using the following command:
- Secure the swap file by setting appropriate permissions:
- Mark the file as swap space:
- Activate the swap file:
- Verify that the swap space has been added:
- Make the swap file permanent by adding it to the fstab file:
sudo swapon -s
sudo fallocate -l [size] /swapfile
Replace [size] with the desired size of the swap file in megabytes (MB). For example, to create a 4GB swap file, use "sudo fallocate -l 4G /swapfile".
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
That's it! You've successfully added swap space to your Ubuntu 14.04 system.
Keywords: Ubuntu 14.04, Swap, Tutorial, System performance, Memory-related issues, Swapon, Fallocate, Permissions, Mkswap, Fstab.
Комментарии
Отправить комментарий