sudo fallocate -l 1g /mnt/1GiB.swap OR sudo dd if=/dev/zero of=/mnt/1GiB.swap bs=1024 count=1048576
sudo chmod 600 /mnt/1GiB.swap
sudo mkswap /mnt/1GiB.swap
sudo swapon /mnt/1GiB.swap
echo '/mnt/1GiB.swap none swap sw 0 0' | sudo tee -a /etc/fstab
File system: The path and name of the swap file.
Mount point: The file isn’t mounted like a file system, so the entry is “none.”
Type: This is “swap.”
Options: At boot time swapon -a (start all devices marked as swap) will be called from one of the boot scripts. This option tells Linux to treat this entry as a swap resource that should come under the control of that swapon -a command. It is common to see “defaults” used here because there is a mistaken belief amongst some Linux users that this field is ignored. As we shall see, that is not the case. So it makes sense to use the correct option.
Dump: This can be set to zero. It is irrelevant in this case.
Pass: This can be set to zero. It is irrelevant in this case.
RAM No hibernation With Hibernation Maximum
256MB 256MB 512MB 512MB
512MB 512MB 1024MB 1024MB
1024MB 1024MB 2048MB 2048MB
RAM No hibernation With Hibernation Maximum
1GB 1GB 2GB 2GB
2GB 1GB 3GB 4GB
3GB 2GB 5GB 6GB
4GB 2GB 6GB 8GB
5GB 2GB 7GB 10GB
6GB 2GB 8GB 12GB
8GB 3GB 11GB 16GB
12GB 3GB 15GB 24GB
16GB 4GB 20GB 32GB
24GB 5GB 29GB 48GB
32GB 6GB 38GB 64GB
64GB 8GB 72GB 128GB
128GB 11GB 139GB 256GB
256GB 16GB 272GB 512GB
512GB 23GB 535GB 1TB
1TB 32GB 1056GB 2TB
2TB 46GB 2094GB 4TB
4TB 64GB 4160GB 8TB
8TB 91GB 8283GB 16TB