If you decide to change the swap file size, then following the steps:
Turn the Swap Off
swapoff -a
Resize the current Swapfile
The following resizes the swapfile to 1GB (1M x 1024)
dd if=/dev/zero of=/swapfile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 4.22595 s, 254 MB/s
Make it a Swapfile
mkswap /swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=435cec7d-6c20-45c8-bd96-55e60ddf
Turn back on the Swapfile
swapon /swapfile
Confirm it is On
You can verify the size change by using command free -h or htop.
root@uploadbeta:/# free -h
total used free shared buffers cached
Mem: 2.9G 2.6G 316M 127M 148M 1.7G
-/+ buffers/cache: 842M 2.1G
Swap: 1.0G 0B 1.0G
Add it to Startup
Make sure this is added to /etc/fstab so when system reboots, the swapfile is turned on automatically.
LABEL=root / ext4 defaults,errors=remount-ro 1 1
/swapfile none swap sw 0 0
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: How to Return a Default Weight for Products in Woocommerce shop?
Next Post: How to Automatically Restart MySQL Server in the event of Crash?