Sunday, August 13, 2006

"Yes" Hack

So I tried rebooting a Linux box that hadn't been restarted in 300+ days. And of course, the fs check failed and the server wants me to manually step in and fix it.

Fine.

So I run /sbin/fsck - and it starts asking me questions about ref counts and nodes. Each question requires me to simply hit enter, saying yes to the question.

This is essentially the same exercise Homer Simpson went through when he worked at home.

Anyway, to help allow me to blog about this task, instead of actually doing it, I needed to find a way to hold down the enter keys so I could answer yes to the thousands of questions it asks me.

My solution? Take the plastic tube out of my ballpoint pen and cram it into the keyboard.

A good old fashion pen saves the day again.

--Ben

Update: Before doing the above hack I tried using -p and -a to get fsck to simply say yes to every repair request. After poking around further, I learned that -y was what I was actually looking for. So:

  fsck -y /dev/hda4 ; reboot

will run the file system check, say yes to everything, and then reboot the server (which, theoretically, will come up correctly next time). This is useful if you have lots of repairs to do.

No comments:

Post a Comment