fsck cannot find fsck_ext2

I just try to mount an external USB drive with ext2 on it. After installing e2fsprogs mount complains that the filesystem is not clean (it is correct).
So I tried to run fsck -t ext2 /dev/da0s1 and got the error
fsck: exec fsck_ext2 for /dev/da0s1 in /sbin:/usr/sbin: No such file or directory

The binary or script is called fsck.ext2, I thought you guys want to know and correct it or something?

//edit: let me rephrase that, if I would have used fsck -t extfs /dev/da0s1 it would have found fsck_ext2fs
fsck fsck.ext2 fsck.ext3 fsck.ext4 fsck.ext4dev fsck_4.2bsd fsck_ext2fs fsck_ffs fsck_msdosfs fsck_ufs
 
For a filesystem type of "foo", fsck will try to execute an external check utility called fsck_foo. That comes from this line in /usr/src/sbin/fsck/fsck.c:
Code:
(void) snprintf(execbase, sizeof(execbase), "fsck_%s", vfstype);
There isn't an ext2 fsck in the base system. It seems that it is part of the sysutils/e2fsprogs port. Do you have a fsck_ext2fs installed by the port in /usr/local/sbin or perhaps somewhere else? There's also a Linux fsck.ext2 which is installed by (at least some of) the Linux compatibility port(s).
 
fsck -t ext2fs /dev/da0s1 still could not be located, even if was there in /sbin, and was giving this error message:
Code:
fsck: exec fsck_ext2fs for /dev/da0s1 in /sbin:/usr/sbin: No file or directory.
/sbin/e2fsck -y /dev/da0s1 instead did the job for me.
 
The problem is that for some reasons, possibly security ones, fsck(8) will not search the external utilities outside the /sbin:/usr/sbin PATH.
 
Back
Top