What is the difference between the linux disk error-checking tools fsck and e2fsck?
fsck is just the original name. When they came out with new file systems they would need a specific tool for each one, efsck for ext, e2fsck for ext2, dosfsck, fsckvfat. So they made fsck the front end that just calls whichever is the appropriate tool.
fsck is a wrapper for the filesystem-specific fsck.* family of tools. They can be used interchangeably with one caveat (from the fsck manpage):
Options which are not understood
by fsck are passed to the
filesystem-specific checker. These
arguments must not take arguments,
as there is no way for fsck to be able
to properly guess which arguments
take options and which don’t.
Options and arguments which follow
the — are treated as file
system-specific options to be passed
to the file system-specific
Please note that fsck is not
designed to pass arbitrarily
complicated options to
filesystem-specific checkers. If you’re doing something complicated,
please just execute the
filesystem-specific checker directly.
If you pass fsck some horribly
complicated option and arguments, and
it doesn’t do what you expect, don’t
bother reporting it as a bug.
You’re almost certainly doing
something that you shouldn’t be doing
However, fsck will handle most of the normal operations on a file system.
On my system I have:
- … (more
fsck.*tools for other, non-ext filesystems)
Now none of these are symbolic links but
e2fsck and the
fsck.ext2/3/4 tools all share the same inode so are actually the same file. (It is possible that this binary will interrogate its own name when it is run and behave differently for the name it is invoked with, but I doubt this is the case.)
So we’re now down to just two tools:
And, as others have said,
fsck is simply a front end that calls the appropriate tool for the filesystem in question, which in this case is
e2fsck for an ext family filesystem.
I presume the reason for having the various
fsck.ext2/3/4 files is so that 1. it’s easy to write scripts that can handle all filesystem types generically (they can deduced the fsck tool name trivially from the filesystem type) and 2. for flexibility, so that it’s trivial to split the e2fsck into two or more independent tools if necessary in the future.