It is generally a bad idea to e2fsck a file system while the file system is mounted (the man page mentions one specific situation where it is safe: -n given, and -c, -l or -L not given, and even then it is not recommended).

However, what would happen if a file system check is in progress when some other process tries to mount the file system read/write?

Obviously e2fsck would likely go haywire and complain about dirty blocks all over the place, particularly if the file system then sees active use, but absent administrator intervention to attempt to correct any such "errors", is there any risk of data loss or file system corruption?

  • I'm honestly not sure what would happen, and I don't have a filesystem I care little enough about to try it out on. – Shadur Aug 19 '13 at 10:52
  • @Shadur That's pretty much my situation as well, hence the question (and hoping there's somebody out there seeing it who does know or, failing that, is willing to try it). – a CVn Aug 19 '13 at 11:01
  • I guess you could create a file system as a disk file and fsck && mount that as a test. I'll try this at home later, interesting question you posed for us! – invert Aug 19 '13 at 11:31

(Sorry, I did not read this question carefully. This is an edit.)

e2fsck is a disk check and repair tool. You must unmount the filesystem before running e2fsck to repair the filesystem. E2fsck will check the log of the filesystem, and repair inconsistent state of filesystem. For example, it will remove failed files,redo log to finish file io,repair inode info of files etc.

If you mount the filesystem by writable,and you execute e2fsck on the filesystem simultaneously, the filesystem may be be damaged. E2fsck may move and edit inode or block info.

  • "E2fsck may move and edit inode or block info" "absent administrator intervention to attempt to correct any such 'errors'"? man e2fsck -p would seem to indicate that when run with the default options and unless the administrator explicitly approves any changes, the only thing e2fsck should touch on disk is the dirty bit, which shouldn't cause more than a bit of confusion. – a CVn Aug 19 '13 at 12:02
  • E2fsck actually calls other tools that are supplied by filesystem developer.So I think these tools that maybe edit meta info of inodes. – Edward Shen Aug 20 '13 at 2:53
  • Please read the questions before answering (and make sure you understand them). The imperative part is "absent administrator intervention to attempt to correct any such 'errors'". That is, we don't tell e2fsck to try to "fix" anything, it's (supposedly) simply checking the file system. – a CVn Aug 20 '13 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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