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