Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 7231  / 3 Years ago, fri, september 3, 2021, 3:44:55

I installed Natty on my laptop with default options. I guess it created a swap partition equal to the size of my RAM. Every time I try to hibernate I get the "not enough swap" message, which is annoying. I want to hibernate! Why can't you just use some of my 20GB free HD space to hibernate? I only have 1GB RAM on this old geezer.



I've seen the swap faq @ http://help.ubuntu.com/community/SwapFaq but it's painfully dense. It shows me how to create a swap file and turn that on, but doesn't explain the following:




  1. Will the system hibernate to that swap file, or will it still be confused because the swap partition is there and too small?

  2. Do I need to get rid of the swap partition? I don't desperately need the space, but I would like to reclaim it because this computer has a pretty small HD.

  3. Why is this all so difficult?



Thanks!


More From » 11.04

 Answers
4

I finally solved this. Of course, to answer the "Why is this all so difficult?" part of my question, I would just have to respond "This is Linux, you fool, of course everything is difficult!"



Here are the steps:




  1. Boot to Ubuntu install CD (I'm on Natty) and choose the option to run Ubuntu now

  2. Go to system -> GParted Partition Editor

  3. Delete the swap partition and the extended partition that holds it (if by some miracle you're able to resize your swap partition from here, I imagine your life will be a lot easier than mine)

  4. Decrease the size of your primary partition by the amount you want your new swap to be (I made mine 2x RAM + 500MB just to be safe). The easiest way to do this is to fill in the amount of space you want swap to be in the "free space following" field

  5. In the free space that has now been created, choose new, type linux-swap and you can name the partition "swap" if you like

  6. Hit the Apply button (should be a check mark) to write the changes to disk

  7. When done, reboot back into Ubuntu



Now you need to find what partition your swap is on and what its UUID is. UUID?! you say? Well that's the Universally Unique IDentifier for the partition so you can reference it even if it's on a different mount point from boot-to-boot due to adding disks, etc. If this is your primary disk, it's probably not a big deal.




  1. Pull up a terminal and run gksu gparted & and enter your root password. The & lets this process run while still giving you access to the command line.

  2. Right-click on your swap partition and choose Information. You should see the Path and UUID listed there. Keep this open for further reference.

  3. Run gksu gedit /etc/fstab & and look for the line that has swap in it. It should be the third column, separated by spaces or tabs. You can either use the path or the UUID to tell Linux where to find your swap partition. I recommend UUID because it'll stay constant even if you move the partition around or the disk somehow becomes sdb instead of sda or something like that. Make the appropriate edits and save the file. Your line should look something like this if you used UUID (with your UUID instead, of course):

    • UUID=41e86209-3802-424b-9a9d-d7683142dab7 none swap sw 0 0

    • or this if you used path: /dev/sda2 none swap sw 0 0


  4. Save and reboot to make sure the new swap gets activated properly at startup



Grab a glass of milk and wait for Ubuntu to come back up... The fun part comes next




  1. Pull up a Terminal again and run cat /proc/swaps and hopefully you see the path to your swap partition listed there. If not chances are something went wrong in the steps above. Here's my output:



    Filename                Type        Size    Used    Priority
    /dev/sda2 partition 2676732 6360 -1

  2. gksu gedit /etc/default/grub & to pull up the boot loader configuration


  3. Look for the line GRUB_CMDLINE_LINUX="" and make sure it looks like this (using your UUID of course) GRUB_CMDLINE_LINUX="resume=UUID=41e86209-3802-424b-9a9d-d7683142dab7" and save the file

  4. sudo update-grub and wait for it to finish

  5. gksu gedit /etc/initramfs-tools/conf.d/resume & and make sure its contents are resume=UUID=41e86209-3802-424b-9a9d-d7683142dab7 (with your UUID of course in place of mine). Save the file!

  6. sudo update-initramfs -u

  7. Reboot!



Now you should be able to hibernate and resume! I really hope this helps someone else. I can't believe Ubuntu is on version 11 and it still SUCKS THIS HARD to get it to hibernate your laptop. Don't lose faith though, it can be done!


[#44596] Saturday, September 4, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
admin

Total Points: 459
Total Questions: 112
Total Answers: 109

Location: Equatorial Guinea
Member since Sun, Feb 14, 2021
3 Years ago
;