2

I am sorry if my question is repost from another, but this is quite confusing to me. First, I will start with my situation.

I have a Laptop with 8GB RAM and 320gB HDD. I install Ubuntu 14.04 x64 to my laptop with this configuration from fdisk -l result:

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xd0080a4c

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *        2048   187011071    93504512   83  Linux
    /dev/sdb2       187011072   203788287     8388608   82  Linux swap / Solaris
    /dev/sdb3       203788288   625139711   210675712    7  HPFS/NTFS/exFAT

As you can see, I have 8gB partition size for swap, but when I check my swap used by system, it only detected as 2gB. Here is my free -m result:

             total       used       free     shared    buffers     cached
Mem:          7686       4756       2929        511        175       2085
-/+ buffers/cache:       2495       5190
Swap:         2047          0       2047

When I run gparted to see my partition layout, there is exclamation icon on my swap partition and gives me this warning:

6.00 GiB of unallocated space within the partition.

I did read SwapFaq, tried several advice from them but could not solve my problem. I don't want to use/create file that act as swap nor re-create my swap partition. I tried to swapoff swapon solve the problem.

The question is, how can I use unallocated 6gB of my swap partition so that system read my full swap partition size?

Thank you.

  • You could try deleting the partition then recreating it, choosing swap as the partition type. – TheWanderer Aug 22 '15 at 17:25
  • thank you @Zacharee1, but I don't want to take risk to delete and re-create swap partition. to frustating for me, sorry. – agungandika Aug 22 '15 at 18:33
  • The answer is literally what I said to do, with the disabling part added. – TheWanderer Aug 22 '15 at 18:34
  • you are right, Zacharee1. sorry for confusing, i will edit my question. – agungandika Aug 22 '15 at 18:49
2

You will need to use swapoff and swapon to fix the problem, because you need to reformat the swap to the full size of the partition, and you cannot do this while it is in use.

First type:

sudo swaplabel /dev/sdb2

You should see something like:

UUID:  ad49d796-e9d9-4bde-8d28-a920c3727d48

If so, now type the following VERY carefully, where <UUID> should be replaced with the value after the UUID: you personally got when you ran the previous command.

sudo swapoff /dev/sdb2
sudo mkswap -U <UUID> /dev/sdb2
sudo swapon  /dev/sdb2
  • wow man, thank you verymuch! indeed this solve the problem. One more question, is this setting permanent? I mean, after reboot my laptop, does my swap will be read as 8gB or back to 2gB? once again, thank you! – agungandika Aug 22 '15 at 18:32
  • Yes, it's permanent. – Martin Thornton Aug 22 '15 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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