18

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?

  • Really nice introductions exist in the link. Thanks! – MAChitgarha Sep 3 '18 at 16:01
17

Check UUID

 sudo blkid

Then

 sudo gedit /etc/default/grub 

to pull up the boot loader configuration. Look for the line GRUB_CMDLINE_LINUX="" 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

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

  • In GRUB_CMDLINE_LINUX_DEFAULT, does 'resume' need to be upcase: 'RESUME'? I find in /etc/initramfs-tools/conf.d/resume it is upcase. – waterloo2005 May 9 '13 at 7:36
  • check the link which i have pasted in last ..... its in lowercase ... – Qasim May 9 '13 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? – waterloo2005 May 9 '13 at 13:42
  • i think you need to choose the raid0 uuid – Qasim May 9 '13 at 14:22
  • The two swaps work like raid0, but they are not real raid0. So no raid0 UUID. You can see it on the top of post. I want to know if I must choose only one of /dev/sda8 and /dev/sdb8 in those config file . – waterloo2005 May 10 '13 at 3:57
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.