Saturday, June 6, 2009

Beware of fsck

One of the database administrators at work was about to migrate a large database onto a new Linux server when he noticed a huge difference between the amount of disk space allocated and the size of the files. Wanting to ensure his success, I decided to let the system reclaim any lost space by using the fsck command.

Before running the command I verified all of the command line options to make sure that I wasn't going to break anything. I ran fsck /y and let the fix run. I rebooted the system when prompted and the OS found more errors and ran fsck automatically like it's supposed to. I thought things were going pretty well. After another reboot, fsck wouldn't even run. Nothing else would either.

I did say I checked the command line options didn't I? Well there's one little thing I forgot. You shouldn't run fsck on an active Read/Write partition..... Yep! Toasted file system. We'll be reinstalling on Monday.