HOWTO: Fix Hibernate after Resizing Swap Partition on Ubuntu
Post date: 18-Oct-2010 02:39:37
There are reasons for which to resize our swap partition after the OS was installed. Now we are at the point where we have successfully resized our swap partition making it larger or smaller. We have also put the new UUID of the resized partition in /etc/fstab
and the system boots and functions fine with the new swap. However if we hibernate the machine and then we try to thaw (resume from hibernation) something goes wrong. Instead of thawing from the swap partition the OS begins a fresh boot. Always. This is because the kernel looks for a swap to resume from based on a hard-coded UUID value that was not updated when we placed the new UUID in /etc/fstab
. At this point we simply need to update that UUID to the new one and everything will be back to normal. In order to do that we follow these steps:
- We edit
/etc/initramfs-tools/conf.d/resume
which stores the UUID for thaw:gksudo gedit /etc/initramfs-tools/conf.d/resume
- Then we change the value of the UUID with the new one (the one from
/etc/fstab
). We save and close Gedit. - Just in case we reinstall
initramfs-tools
:sudo apt-get install --reinstall initramfs-tools
- Then we update the resume UUID in the kernel images:
sudo update-initramfs -u -k all
After a reboot our system should be able to successfully thaw from hibernate.