$ sudo swapon --show
Nothing comes out because it is not set If it is set, it will be displayed like this
$ sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -2
I will make 1GB for the time being. Well, I'm not so pressed for it, and the physical memory is 1GB, so it's about the same.
$ sudo fallocate -l 1G /swapfile
$ sudo chmod 600 /swapfile
mkswap
$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=44dd3594-5812-473e-839d-d9c7a1af3d6a
$ sudo swapon /swapfile
$ sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -2
fstab
to automount at boot time$ echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
/swapfile swap swap defaults 0 0
$ sudo reboot
$ sudo swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 1024M 0B -2
https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/ https://kazmax.zpp.jp/linux_beginner/mkswap.html
Recommended Posts