When checking ‘top’ after I was told that I have no memory anymore I found out that I had no swap drive anymore. Must have gone lost when I switched to Ubuntu Feisty. Anyway, I found a description to re-initiate the swap drive:
- First find out which partition your swap drive is, e.g. with ‘sudo fdisk -l /dev/sda’ (the important line is ‘/dev/sda6 8391 8645 2048256 82 Linux swap / Solaris’)
- sudo mkswap /dev/sda6 – a new UUID will be created and printed on the screen (e.g. ‘no label, UUID=16ef6e6c-dd7e-4efd-bacd-8718ebeac568’)
- create a link in /dev/disks/by-uuid: ‘cd /dev/disks/by-uuid’ and ‘sudo ln -s ../../mapper/sda6 /dev/disk/by-uuid/Your-UUID’
- sudo swapon -va
- sudo gedit /etc/fstab and set the correct UUID in the line ‘UUID=Your-UUID none swap sw 0 0’
To keep swap intact after hibernation additionally you need
- sudo gedit /etc/initramfs-tools/conf.d/resume and add the line ‘RESUME=UUID=Your-UUID’
- sudo update-initramfs -u
4 thoughts on “Suddenly my swap drive was missing”
I just lost mine today (didn’t wake from hibernation) on Gusty Gibbon. Reinitializing the swap partition and then updating fstab with the new UUID worked for the current session but didn’t stick so the system still didn’t wake up from hibernation.
Didn’t know about that resume file. Going to try updating the UUID in there and hopefully, that does the trick.
Well, that still didn’t fix it. The UUID still changed. What finally fixed it was running the following after updating fstab and resume with the correct UUID:
sudo update-initramfs -u