0

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 '19 at 18:44
  • @CharlesGreen I appended the blkid output. –  Jan 11 '19 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 '19 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 '19 at 22:08
  • @SergiyKolodyazhnyy Thanks for the suggestion. Neither of those worked, unfortunately. –  Jan 11 '19 at 22:40
  • @ubfan1 sudo fdisk -l /dev/sda6 | grep sda6 outputs Disk /dev/sda6: 27.8 GiB, 29877683712 bytes, 58354851 sectors –  Jan 11 '19 at 22:41
  • @Inquisitor This seems very odd. For the time being, create a swap file. I've a script to perform such task in easy manner, https://askubuntu.com/a/931170/295286 There's manual instructions on linked duplicate as well. As for your partition, give it some time. If you don't find a solution here, consider deleting that partition and sticking with swap file only, or reformatting that partition. Also, it may be worth checking hard drive health. If there is large number of bad blocks, it's time to abandon the drive. – Sergiy Kolodyazhnyy Jan 11 '19 at 22:46
  • Oops, sorry, that should have been sudo fdisk -l /dev/sda |grep sda6 to get the id and type. – ubfan1 Jan 11 '19 at 23:42
  • @uban1 sudo fdisk -l /dev/sda | grep sda6 outputs /dev/sda6 429926400 488281250 58354851 27.8G Linux swap –  Jan 12 '19 at 00:02

2 Answers2

0

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.

-1

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 written 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

add:

/swap/swapfile  swap      swap    defaults   0       0

reboot, and see if it is all right:

cat /proc/swaps
Pang
  • 373
  • /swap/swapfile has to exist first in order to be added. Also reboot is unnecessary, swapon command is sufficient – Sergiy Kolodyazhnyy Jan 12 '19 at 03: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 '19 at 04:11