0

I am trying to add the swap memory and I've succeeded in doing it temporarily, but it fails when I try to do it permanently by using /etc/fstab. Could you explain, what I am doing wrong? Here are the steps, that I do on the clean Ubuntu 20.4 server installed:

fallocate -l 1G /swapfile2
chmod 600 /swapfile2
mkswap /swapfile2
swapon /swapfile2

And this works. When I go with

free -m 

I see, that the swap memory is allocated. But when add it to /etc/fstab by adding the string:

/swapfile2 none swap sw 0 0

And then disabling the swap and trying to mount it from fstab

swapoff -a
mount -a

I get no swap memory in the free -m output.

Any ideas, why can it work like that?

dice2011
  • 111

0 Answers0