Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to keep disk caches when hibernating Linux? I understand and agree that dropping them is the best option all-around. But my system is unresponsive after resume and I would like to give a try to keeping that data.

Of course, both hibernating and resuming will be slower, since disk cache data will have to be written to swap and restored. And, of course, I will need more swap space than I do now. But still, I've been looking all over the web and I haven't found any way to set things up like that.

I use pm-utils with uswsusp as backend, but I'm open to suggestions.

share|improve this question
    
What do you mean by "unresponsive"? If I understand correctly, loading files from a contiguous cache on disk is only going to improve performance (and probably only slightly at that) if most of the files cached are going to be used immediately after you resume. How much RAM and disk swap space do you have, and what's unique about you usage patterns (i.e. why don't standard memory and I/O optimization algorithms apply to the way you use your computer?) –  depquid Mar 27 '13 at 13:17
    
By unresponsive I mean that switching between already opened apps becomes slow and a lot of disk activity happens. After a while, system responsiveness becomes normal. My (I think not so crazy) guess is that, since all disk caches were dropped for hibernation, the system needs to hit the disk again when it needs the data. I may be wrong. I have 8Gb of RAM and 4Gb of swap. In my last hibernation, s2both image size was a bit over 1.2Gb. –  ateijelo Mar 27 '13 at 14:18
    
hibernate-ram keeps the caches around, but it requires power to keep alive. –  frostschutz Mar 27 '13 at 16:09
    
@ateijelo Your guess is correct. Another approach could be to force-read some processes's mapped memory into RAM with a tool like tct's pcat or my Python script (but it doesn't just load what was in RAM before, it loads everything, which can be inconveniently large). –  Gilles Mar 27 '13 at 23:03

1 Answer 1

I know your pain, after hibernation my computer is much slower.

But there is another way. It's called TuxOnIce.

It is much faster than the in-kernel hibernation and it is able to save ALL the memory in use, including the disk caches. It makes a massive difference and actually makes hibernation in Linux usable on a day to day basis.

Beware - it does involve building your own kernel. If you're a Debian or Ubuntu user, this is fairly easy using kernel-package (make-kpkg). Good luck!

share|improve this answer
    
Thanks, I'll give it a try. I do use Debian, so I think it won't be hard. I'll post whether it made a difference or not. –  ateijelo Mar 28 '13 at 12:39

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.