-1

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.

netmano
  • 259
  • 2
  • 12

2 Answers2

1

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
Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
1

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.

Jeff Ferland
  • 20,239
  • 2
  • 61
  • 85