Create new swap file to Linux

to add new swap file to Linux just follow the below steps , in my case i will add 32GB and i am not using LVM :-

  • just create file by the below command :-
    • touch /new.swap
  • Write on the file :-
    •  dd if=/dev/zero of=/new.swap bs=1024 count=33554432
  • Format the file :-
    • mkswap /new.swap
  • Add the file to the system as a swap file.
    • swapon /new.swap
  • finally add it to fstab :-
    • /new.swap none swap sw 0 0
Thanks
Osama

3 responses to “Create new swap file to Linux”

  1. Why we need to add extra SWAP?

    Like

  2. Why we need to add extra SWAP?

    Like

  3. Sometimes SA configured SWAP with small size, this size will generate an error so you have to add extra swap size

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.