Invalidating stale software suspend images

6854933580_2c8b688306_z

sudo dd if=/dev/zero of=/swapfile bs=1024 count=XX The swapfile size is equal to [count*bs] (in Bytes), So XX = desired swap size in Bytes / 1024 (bs parameter implies Bytes). count=2M or count=2048K will both result in 1024*2M=2G (note that count parameter has special decoding of multipliers - adding letter B changes from computer 1024 to metric 1000, i.e 1M = 1024*1024, while 1MB=1000*1000).

You can dry-run dd with of=/dev/null to see if your numbers will get the desired swapfile size. You can go ahead and check stock quotes while dd creates the new file for a few minutes.

There is some controversy going on in regards to using the same file or partition for both swap and hibernation.

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

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.

Having swap larger than 2*N Bytes is usually unnecessary and just wastes space, unless you are planning to upgrade RAM in the near future.

sudo update-initramfs -u Verify that all your kernel stanzas (menu entries) got updated in /boot/grub/(or in /boot/grub/for grub2) with resume=...

Partition may be impossible to change/resize later.

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

sudo chmod 600 /swapfile && sudo mkswap /swapfile Important Note: The UUID that mkswap returns is absolutely useless.

sudo swapoff -a sudo swapon /swapfile sudo -b gedit /etc/fstab Edit /etc/fstab and : Remove or comment out ALL old swap partitions Add new line: /swapfile none swap sw 0 0 Verify that everything is done OK: free -m You will see your swap reported.

Now you can get rid of the old swap partition and use it for other stuff.

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