[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help! Corrupted filesystem



Mankuthimma wrote:
Hi,

Should I fsck from a Knopix CD or do it from my Knoppix hd install or do
it from the Debian command line? Does it matter at all?

Best option. Boot from knoppix and fsck the partition

# fsck /dev/hdXX


Am I correct in assuming that I need to mount the partition in
read-write mode in order for fsck to fix the problems?


Do *not* mount the partition. Esp. in rw mode. Doing so, guarantees a
really "fscked up" filesystem.


To repeat:  never use fsck to fix a mounted file system.

Why? When you mount a device, you work through the kernel and kernel buffers to access data on the hard disk. This means there is the potential for data to exist in kernel memory that has not yet been written to the hard disk.

'fsck' works through the 'file' access mechanism available by opening the device node directly. That is to say, it opens /dev/hd?? or /dev/sd??, or whatever the associated physical device is. It completely bypasses the kernel filesystem interface, in particular any buffered data.

If you use fsck on a r/w mounted disk, it will fix the disk as it sees it, without the data from kernel space. This will leave the disk in an indeterminate state, somewhere between possibly usable to totally broken.

When booting your system, if the root file system is corrupt, fsck may be run if the system (or you) has *expressly* re-mounted it in read only mode. But, as Mankuthimma says, booting from some type of rescue disk and doing the fsck from it is the most reliable and safest way to deal with a corrupt root partition.

Bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: