0

I am trying to mount swap partition in etc/fstab on Amazon Linux 2, but it doesn't work on the boot-up process.

here the steps I have followed:

  • create swap file: dd if=/dev/zero of=/swapfile bs=1024 count=1048576
  • change permission to 600: chmod 600 /swapfile
  • setup swapfile: mkswap /swapfile
  • add swap to fstab: UUID=90c0668b-6bca-4dd7-bdca-b62c19e2a911 none swap sw 0 0
  • reboot

After reboot, nothing happened...

I have also tried to mount it with:

/swapfile       none    swap    sw 0 0

but still not working.

Manually, using swapon command it's working perfectly...

fromthestone
  • 347
  • 3
  • 16
  • I did this on AL1, try the steps in my [blog post about adding swap to Amazon Linux](https://www.photographerstechsupport.com/tutorials/adding-swap-space-ec2-amazon-linux-instance/), which look pretty similar to yours but some differences there. – Tim Apr 20 '18 at 03:05
  • Thanks @tim, I would highlight a small detail about `dd` command: I have used `bs= 1024 count=1048576` because using `bs=1M count=1024` gave me memory allocation problems. – fromthestone Apr 20 '18 at 03:54
  • What does `swapon -a` say? – Ondřej Xicht Světlík Apr 21 '18 at 05:11

0 Answers0