Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I perform a filesystem check on ext3 partition on linux?
I am looking for a solution that check every file on the filesystem that is it accessible.

UPDATE: I would run it on a server without unmounting the drive.

share|improve this question
add comment

2 Answers

You cannot run fsck from within a desktop session. A desktop session requires run-level 2.

sudo init 1

Then unmount everything:

sudo umount -a

Then you can run fsck. Run fsck with the -c option, and it will scan for bad block on the drive. Then, afterwards, you can run:

sudo init 2
share|improve this answer
add comment

Regarding your update, see Why can't you fsck a mounted partition?

As for checking everything, fsck -n will safely look at any filesystem, online or offline, and report results. The -n flag keeps it from changing anything. If you run fsck against a mounted partition without that flag, game over dude.. Those results will be slightly nutters and may tell you all sorts of bad things are happening to your online file systems when they're just fine.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.