June 8th, 2005

  • evan

laptop mode and vim

Laptop mode is great: some kernel hacks to keep your disk from spinning up until absolutely necessary.
And it was set up transparently by Ubuntu. By my disk keeps spinning up! Why?

The article has the debugging secret: a flag in proc that'll log which process is causing disk reads/writes. No more watching vmstat 1 and guessing.

The culprit turned out to be a few things, and then it was mostly fixed. vim has as -n flag which is "No swap file, use memory only". But strace indicates that it fsync()s on writes anyway. :(
It appears that people are well aware of this problem, but that doesn't do me any good.

And then Debian comes to my rescue!
apt-get source vim; apt-get build-dep vim and I have all the source and the exact setup used to build my vim binary.
I can rip the code out, stick the patch in debian/patches, dpkg-buildpackage -i -rfakeroot and it's all fixed.
Watching this recompile it makes me feel a bit like a Gentoo user...

(PS: Dear mac users, this is the sort of thing that keeps me using Linux. If I were using the Other OS, I'd potentially not be able to fix this sort of thing. It makes me feel so powerless.)