Invalidating stale software suspend images

Partition may be impossible to change/resize later.

This HOWTO was tested only on Intrepid, but may work on other versions.

It should look like this (with your UUID and offset): # kopt=root=UUID=...

ro resume=UUID=cd71de6f-907a-40d7-bf26-c17f201e5718 resume_offset=66050 Make sure you have no carriage returns in this line.

Do this instead: sudo filefrag -v /swapfile ..note the number in the first line under "physical" (3rd column) Here is an example of the output, the number for resume_offset is 154484: Filesystem type is: 58465342 File size of /swapfile is 8261935104 (2017074 blocks, blocksize 4096) ext logical physical expected length flags 0 0 154484 1241648 1 1241648 6233816 1396131 775426 eof /swapfile: 2 extents found Replace UUID and resume_offset: echo "resume=UUID=" | sudo tee /etc/initramfs-tools/conf.d/resume Now edit GRUB configuration: (for old grub, before grub2) sudo -b gedit /boot/grub/Find the line "# kopt=root=UUID=..." and add to it "resume=UUID=" (without quotes).

Note that your UUID will match root=UUID, unless you have placed swapfile on different partition than "/".

If swapfile is not big enough, hibernation may fail, depending on how many applications and documents are open.

This HOWTO explains how to use swapfile and still have hibernation working.

(For advanced console users / cmdline junkies - you may find compressed list of commands at the end of this HOWTO) Why would you want a swapfile? Swap partition does work fine, but there are 3 cases when you may want a swapfile instead: You forgot to make a swap partition You need to have no swap partition, for instance to have Mac trippleboot Ubuntu/Mac OSX/Win* and comply with all of the OS's limitations (which in my case allowed only 4 primary MBR partitions, one taken by GUID/GPT/EFI which makes Mac OSX comfortable) Have flexibility of resizing swap at any time.

ro resume=UUID=cd XX--X18 resume_offset=66050 # for grub2: sudo -b gedit /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="...

resume=UUID=cd XX--X18 resume_offset=66050" sudo update-grub -y # Answer "use maintainer version" if it asks sudo update-initramfs -u APPENDIX - SAME OR SEPARATE FILES FOR SWAP AND HIBERNATION?

swapon -s - will show you that you are indeed using swapfile PART 2 - HIBERNATION Now we will make the hibernation work again.

You must have an account to comment. Please register or login here!