Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

  • Exits

  • Categories

  • Archives

  • Visitors’ track

    Locations of visitors to this page
  • Tags list

Check rw-mounted linux filesystem without reboot

25th June 2007

If you happen to need to check your linux filesystem, which is mounted read-write, and for some reason you do not want to reboot, then the simple sequence of commands listed below should help you. Note, that the commands provided put you into single-user mode, which kills web-server and mysql daemon.

So, running e2fsck on a live (mounted) filesystem isn’t recommended – and f2sck asks if you really want to check the rw-mounted FS (be sure to answer ‘n’o). If the FS you want to check is root (/), you cannot also re-mount it read-only – unless first you go to single-user mode:

init 1

Now you can re-mount your FS read-only:

mount -o ro,remount /dev/cobd0

(/dev/cobd0 is my device, replace it for your device when repeating step-by-step).
Filesystem is now read-only, and it’s safe to run e2fsck:

e2fsck -D -C 0 -f -t -v /dev/cobd0

e2fsck options are optional:
-D: optimize directory structure
-C 0: show progress
-f: force check (use if you get “volume is clean” with no check)
-t: e2fsck timing statistics
-v: verbose mode

Finally, return to your previous user mode:

init 3

  • Share/Bookmark

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>