b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

New Linux User

How To: Use FSCK to Fix Disk Problems

by Jon on June 2nd, 2006

I knew that fsck was kind of the Linux version of DOS’s chkdsk, but that’s about all I knew. I’ve learned a little more about it now.

Each device has a superblock which contains the necessary information for Linux to access the rest of the data on the device. I’m thinking that this is akin to the File Allocation Table (FAT) which contains essentially a table of contents for the disk on DOS. It might not operate the same in form, but in function it helps me to think about it like that.

These superblocks are obviously very important. If the superblock gets corrupted, then the disk will be inaccessible. Therefore, Linux stores many copies of the superblock at different points on the disk. Fskc, then, can use these (presumably not-corrupted) superblock copies to ensure that the main superblock is OK. Or to replace it if it isn’t.

I’m sure there’s more to it than that, but the basic use of fsck on the first IDE disk of a system looks something like this:

fsck /dev/hda: scan the first IDE disk on the system

Do a man fsck for more complex information.

POSTED IN: How To

2 opinions for How To: Use FSCK to Fix Disk Problems

  • brad fuller
    Jun 14, 2006 at 10:07 pm

    Hi - I’d like to run fsck over an older server on my network, but it’s in use 24 hours a day and my only access to it is via SSH

    So .. is it safe to ruin fsck on an “active” machine? At least for the purpose of discovering if it needs personal attention!!

    This particular machine probably has a huge amount of fragmented files on it but I don’t have a clue how linux (Debian) manages this sort of issue, or indeed if it is even a problem for a linux file system.. So if you’d like to comment on that I’d love to hear from you!!!

    thanks for your time..

    brad

  • Jon
    Jun 15, 2006 at 5:18 am

    Hi Brad,

    I think that most people will agree that running fsck on a mounted disk is generally a bad idea. Well, to be more correct, allowing fsck to write to a mounted disk is generally considered a bad idea.

    As much as you don’t want to, I’d recommend at least mounting the disk in read only mode, and preferably unmounting it altogether before fsking it.

    You can, of course, disregard this advice and see what happens. You may luck out.

Have an opinion? Leave a comment:




Check Spelling
Activate Spell Check while Typing