How To Add Swap on Ubuntu 14.04

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:

  1. Check if you have any swap space by running the following command:
  2. sudo swapon -s
  3. Create a swap file of the desired size using the following command:
  4. 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".

  5. Secure the swap file by setting appropriate permissions:
  6. sudo chmod 600 /swapfile
  7. Mark the file as swap space:
  8. sudo mkswap /swapfile
  9. Activate the swap file:
  10. sudo swapon /swapfile
  11. Verify that the swap space has been added:
  12. sudo swapon -s
  13. Make the swap file permanent by adding it to the fstab file:
  14. 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.

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS