12

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.

1 Answer 1

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
1
  • I, instead, ran sudo nano /etc/fstab and added the UUID as my swap is a partition UUID=<the uuid> none swap sw 0 0
    – ckhatton
    Commented Oct 10, 2023 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .