20

I have two swap partitions in fstab :

    /dev/sda8    none            swap    sw,pri=1           0       0
    /dev/sdb8    none            swap    sw,pri=1           0       0

How to set swap in /etc/initramfs-tools/conf.d/resume file?

According to SwapFaq this will not work for 12.04:

INFO: This will not work for 12.04, resume from hibernate work differently in 12.04.

How to do it in Ubuntu 12.04?

1
  • 1
    Really nice introductions exist in the link. Thanks! Sep 3, 2018 at 16:01

2 Answers 2

20

Check UUID

 sudo blkid

Then

 sudo gedit /etc/default/grub 

to pull up the boot loader configuration. Look for the line GRUB_CMDLINE_LINUX_DEFAULT="" and using your UUID add:

resume=UUID=41e86209-3802-424b-9a9d-d7683142dab7

That means change this

   GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to this

  GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=41e86209-3802-424b-9a9d-d7683142dab7"

save then edit:

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!

 sudo update-grub
 sudo update-initramfs -u -k all

Reboot!

https://help.ubuntu.com/community/SwapFaq

Edit: Technically only one of the two methods needs to be used, the kernel parameter in the grub file will take precedence over the initramfs resume config file

8
  • In GRUB_CMDLINE_LINUX_DEFAULT, does 'resume' need to be upcase: 'RESUME'? I find in /etc/initramfs-tools/conf.d/resume it is upcase. May 9, 2013 at 7:36
  • 1
    check the link which i have pasted in last ..... its in lowercase ...
    – Qasim
    May 9, 2013 at 8:09
  • The two swaps form a raid0. If I can choose both of it in /etc/initramfs-tools/conf.d/resume ? If I must choose only one of the both? May 9, 2013 at 13:42
  • i think you need to choose the raid0 uuid
    – Qasim
    May 9, 2013 at 14:22
  • 1
    I don't understand why you update /etc/default/grub? At the message is from initramfs, changing /etc/initramfs-tools/conf.d/resume should be more than enough. You add another dependency in Grub, which will make the next change much more difficult. But thanks for pointing out the resume file + update-initramfs, that did the trick!
    – Yvan
    Feb 25, 2018 at 18:18
3

(18.04) You can also edit /etc/initramfs-tools/conf.d/resume and change RESUME=UUID=$uuid to the output of blkid /dev/raidN (whatever block device your 2 swap devices are RAID'd as)

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.