I hadn't set up a swap partition on my PC, because a) I have plenty of RAM (8 GB) and b) I have large harddrives that I didn't want to chop into tiny pieces, so my smallest partitions are 50 GiB, and I'm already using those for the OS's.
Now, to hibernate, my Linux (Ubuntu Jaunty) required swap. I had a spare 100 GB partition so I set that up as swap, but I'm not satisfied with that. It's only ever used for hibernation (there's always plenty of RAM free and the system never goes to swap) and it's also a little large for swap. Also, I'm eventually going to need it for something else.
How can I hibernate (suspend to disk) without a swap partition in Ubuntu Jaunty?
Best Answer
Untested idea: why don't you create a wrapper for
s2disk
or whichever utility handles suspend to disk which manages a swap file ( as opposed to a swap partition ) and deletes it on resume?dd if=/dev/zero of=/swapfile bs=1024 count=8388608
( 8GB )mkswap /swapfile
swapon /swapfile
swapoff /swapfile
Resuming from swap files is possible, and is documented on kernel.org