Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've read this question, but it doesn't definitively answer my question.

If I want my computer to be able to hibernate, do I need to have a swap partition as large as my RAM, or will Ubuntu wisely be able to hibernate if the swap partition can fit the currently-in-use RAM? I'm about to install Ubuntu on a computer with a lot of RAM, and a relatively small hard drive, so I don't want to use more hard drive space than necessary.

I wanted to avoid giving my actual specifications to keep this question more general, though I'll give them if necessary.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

It's hard to predict: your swap needs to accommodate

  • what's already in the swap when you hibernate
  • what's in RAM when you hibernate, but only the part that's not disk cache or buffers; the RAM image is compressed if you use uswsusp
  • a few kernel data structures

So you can fail to hibernate even if your swap is bigger than your RAM, because most of your swap is already in use. And convertly you can successfully hibernate with a swap that's smaller than RAM, if you're not using much of either at the time.

If you want to avoid a fixed-size swap partition because your disk is very small, you can go for a swap file instead. It's easier to resize, and hibernation to a swap file is supposed to be supported (not sure if it currrently works out of the box, that's come and gone between Ubuntu releases; IIRC it did in 9.10 but it had to be set up in 10.10).

share|improve this answer
    
Thanks! This leads me to another question... –  Closure Cowboy Jun 23 '11 at 14:18
    
Disk cache is not compressed –  psusi Jun 23 '11 at 15:08
    
the way you have it worded made it sound like you were saying that the cache is compressed, not the hibernation image. For the hibernation image to be compressed you need to install the uswsusp package. The default kernel implementation does not compress. –  psusi Jun 23 '11 at 15:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.