Here is how I set the swap:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1MB count="1000"
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
Every time I reboot/restart the swap is gone.
The command free
gives me zeros for swap. But the file /var/swap.1
is still there.
swap.1
file details:
-rw-r--r-- 1 root root 989000000 Aug 9 20:55 swap.1
The number 989000000 seems a bit big...
How can I make it persistent?
lsb_release -a
LSB Version: core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty
In order for the system to automatically use the swap file as swap space on boot, it needs an entry in
/etc/fstab
similar to: