Skip to main content

add more SWAP files in CentOS 7






to enable swapfiles in CentOS 7

#fallocate -l (size_of_swap) (destination file)

example to add 8GB of Swap:
#fallocate -l 8gb /swapfile

this will create 8GB in directory / filename swapfile

change its mod with
#chmod 600 /swapfile

then run
#mkswap /swapfile

then run
#swapon /swapfile

you can edit /etc/fstab and add this line:
/swapfile none defaults 0 0

to check if it active:
#free

or
#swapon -s

or
#systemctl -a | grep swap



Comments