I recently increased space and swap space for ubuntu on my laptop. Even though the space got increased, my swap is not being recognized. It is showing as 0 bytes of space. However, interestingly, when I boot from live cd and click try ubuntu, space for swap is being recognized.

What can be causing this weird problem?

Normal Boot: enter image description here

bhaarat@bhaarat-laptop ~ % free
             total       used       free     shared    buffers     cached
Mem:       1015780     954008      61772          0      49836     449444
-/+ buffers/cache:     454728     561052
Swap:            0          0          0

Live CD Boot enter image description here

ubuntu@ubuntu:~$ free
             total       used       free     shared    buffers     cached
Mem:       1015780     983500      32280          0      87408     558984
-/+ buffers/cache:     337108     678672
Swap:     13590952        384   13590568

Outputs in Live CD Boot

Output of grep swap /etc/fstab

/dev/sda6 swap swap defaults 0 0

Output of sudo fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
240 heads, 63 sectors/track, 10337 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2bd2c32a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda2               1       10338    78149632    5  Extended
/dev/sda5   *           1        8539    64551936   83  Linux
/dev/sda6            8540       10338    13590958+  82  Linux swap / Solaris

Output of sudo swapon -a No output

Gparted Screenshot: enter image description here

Update contents of cat /proc/swaps after the fix are:

 Filename Type Size Used Priority 
 /dev/sda6 partition 13590952 0 -1
  • 1
    Please post the output of grep swap /etc/fstab, sudo fdisk -l and sudo swapon -a. Commented Apr 28, 2012 at 22:16
  • I've provided outputs of those as well as some more information. Thanks Commented Apr 28, 2012 at 23:03
  • 1
    You may want to add the swap to your fstab. See askubuntu.com/a/33703/3940
    – Takkat
    Commented May 1, 2012 at 13:03
  • Please also add the output of blkid | grep swap.
    – htorque
    Commented May 1, 2012 at 17:04

3 Answers 3


Is the swap enabled? swapon <device>

See cat /proc/swaps

If it's listed, then it's enabled. If not, then the system isn't using it as swap.

blkid | grep swap

It appears your fstab entry looks incorrect.

Try using the line:

/dev/sda6 none swap sw 0 0

Then sudo swapon -a

You can try using UUID you get from blkid command above and using that in place of /dev/sda6

  • can you post the specific commands for this, e.g. cat /proc/swaps? Commented May 1, 2012 at 18:40
  • That fixed the issue and I have my swap back. I've updated the answer with the contents of /proc/swaps after the fix. Commented May 2, 2012 at 19:04

Try adding /dev/sda6 none swap sw 0 0 to /etc/fstab, which you can do with the following commands (enter them in a terminal):

  1. sudo su
    (Now it should ask for your password. Enter it and press enter to continue)
  2. echo "/dev/sda6 none swap sw 0 0" >> /etc/fstab

After that, reboot your system and check again.

For people who are wondering why I'm using sudo su, in stead of just su; su doesn't appear to work for me anymore in Ubuntu 12.04.

  • sudo echo "..." should work. And you need to replace the line that may or may not exist for /dev/sda6
    – papashou
    Commented May 3, 2012 at 1:27
  • @papashou I thought it should work, only, when I tried it, it didn't.
    – RobinJ
    Commented May 3, 2012 at 5:29

When you resize your swap it changes the UUID name in /etc/fstab. If you don't have a label (/dev/sda5 for example) in your /etc/fstab file it will not recognize the new swap. As it explains in the fstab file, using UUID is more robust in some cases (obviously not in this one).

Unmount the swap drive and copy it's UUID:

>sudo swapoff -av
swapoff on /dev/sda5

>sudo mkswap /dev/sda5
Setting up swapspace version 1, size = 16604156 KiB
no label, UUID=f0ac7203-dac5-479b-a33a-be7a3dca6aae

Update the UUID of your swap in /etc/fstab to the new value from the step above:

>sudo vim /etc/fstab

Now remount, note the identical swapsize and devsize:

>sudo swapon -a --verbose
swapon on /dev/sda5
swapon: /dev/sda5: found swap signature: version 1, page-size 4, same byte order
swapon: /dev/sda5: pagesize=4096, swapsize=17002659840, devsize=17002659840

Although looking at the accepted answer above I see now what I needed to know, I wanted to make it more explicit here after finding the answer in Pollox's post

Most responses to my problem suggested changing the `/etc/fstab' line to use the label rather than the UUID. I was hesitant to do so and therefore was unable to resolve the issue until I came across the fact that the UUID changes as well.

You must log in to answer this question.

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