I made I swap partition with GParted and it works great, since my computer only has 2 GB of memory. But, every time I boot up, I have to execute sudo swapon /dev/sda1 until it enables. How can I set it up so it enables automatically. I am have only been using Ubuntu for three months, so you might have to spell things out for me.
Asked
Active
Viewed 1.6k times
1 Answers
18
Swap partitions are enabled either:
- on boot if they're listed in
/etc/fstab - when you run
swapon /dev/<device> - or when you run
swapon -a, given that you have some swap devices configured in fstab.
Run:
grep swap /etc/fstab
If there's no output, you don't have a swap partition added to /etc/fstab.
If your swap partition is i.e. /dev/sda1 add
/dev/sda1 none swap sw 0 0
to the end of your /etc/fstab file and run swapon -a.
Verify that your partition is in use as a swap via
cat /proc/swaps
Marcin Kaminski
- 4,901
sudo nano /etc/fstaband added the UUID as my swap is a partitionUUID=<the uuid> none swap sw 0 0– ckhatton Oct 10 '23 at 18:00