I have a 27.8G swap partition; though I have no swap space, I'd like to change that.

Here is the pertinent output from top.

KiB Swap:  0 total,  0 free,  0 used

I believe I may have turned it off with the swapoff --all. That being said the swapon --all exits with swapon: /dev/sda6: swapon failed: Invalid argument.

Here is the swap entry in my /etc/fstab

# swap was on /dev/sdb6 during installation
UUID=aa0cdc90-ef01-446b-a6a2-fac368d16aca none swap defaults 0 0

I affirmed the UUID of my partition with the one in /etc/fstab. Below is the output from blkid.

sudo blkid /dev/sda6
/dev/sda6: UUID="aa0cdc90-ef01-446b-a6a2-fac368d16aca" TYPE="swap" PARTUUID="6ddd3267-3895-40e5-9acc-56bfbc58039b"

My swap partiton is on /dev/sda6 not /dev/sdb6. I presume /dev/sdb6 was the bootable USB I used to install the system. This is a dual-booted, single-drive system.

Thanks in advance for your help.

  • 3
    Could you append the output of sudo blkid to our question? – Charles Green Jan 11 at 18:44
  • @CharlesGreen I appended the blkid output. – just-in-time_learning Jan 11 at 21:48
  • Your entry in /etc/fstab appears to be wrong. Try changing it to /dev/sda6 none swap defaults 0 0 or UUID=aa0cdc90-ef01-446b-a6a2-fac368d16aca none swap defaults 0 0 – Sergiy Kolodyazhnyy Jan 11 at 21:52
  • Your PARTUUID looks odd for a partition of ID=82 type =Linux swap / Solaris. What does sudo fdisk -l /dev/sda6 |grep sda6 show? – ubfan1 Jan 11 at 22:08
  • @SergiyKolodyazhnyy Thanks for the suggestion. Neither of those worked, unfortunately. – just-in-time_learning Jan 11 at 22:40

Have you ever changed it? Maybe you didn't set your swap.Personally,I recommend you use Gparted to edit your swap again, you can install Gparted in your terminal or I have write an answer here How to install Gparted(iso).After that the swap won't show up because it is not active,type:

sudo gedit /etc/fstab


/swap/swapfile  swap      swap    defaults   0       0

reboot,and see if it is all right:

cat /proc/swaps
  • /swap/swapfile has to exist first in order to be added. Also reboot is unnecessary, swapon command is sufficient – Sergiy Kolodyazhnyy Jan 12 at 3:19
  • Yeah,you are right.Just change the UUID will be all right.:)...I'll try not reboot next time,I always reboot after I edit about the disk partition...&_& – wjrforcyber Jan 12 at 4:11

I think the swap space may have never been turned on since initialising the OS.

The problem was solved by running mkswap and then swapon on the partition.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.