Dear Ted, I upgraded e2fsprogs and util-linux to the latest versions, as per the instructions on the "ext3 for 2.4" page, to make the switching between ext2-only and ext3-enabled kernels seamless. Now that if the filesystems have not been unmounted cleanly, due to a power failure for example, "fsck -A -a" cannot continue after checking the root filesystem on reboot, issuing the error msg "/dev/???? is mounted, e2fsck: Cannot continue, aborting." The problem is that e2fsck in e2fsck-1.24 no longer takes into account whether /etc/mtab is writable or not; whenever it finds an mounted entry in /etc/mtab (/proc not mounted yet at this time), it assumes it's already mounted, even though the system has just experienced a crash. I think the mtab checking code in older version of e2fsck is still needed: --- e2fsprogs-1.24/e2fsck/unix.c-1.24 Wed Aug 29 08:40:27 2001 +++ e2fsprogs-1.24/e2fsck/unix.c Wed Sep 5 10:41:27 2001 @@ -223,6 +223,20 @@ (mount_flags & EXT2_MF_READONLY))) return; +#if (defined(__linux__) && defined(HAVE_MNTENT_H)) + /* + * If the root is mounted read-only, then /etc/mtab is + * probably not correct; so we won't issue a warning based on + * it. + */ + fd = open(MOUNTED, O_RDWR); + if (fd < 0) { + if (errno == EROFS) + return; + } else + close(fd); +#endif + if (ctx->options & E2F_OPT_READONLY) { printf(_("Warning! %s is mounted.\n"), ctx->filesystem_name); return; -- Wenzhuo
Dear Ted, I upgraded e2fsprogs and util-linux to the latest versions, as per the instructions on the "ext3 for 2.4" page, to make the switching between ext2-only and ext3-enabled kernels seamless. Now that if the filesystems have not been unmounted cleanly, due to a power failure for example, "fsck -A -a" cannot continue after checking the root filesystem on reboot, issuing the error msg "/dev/???? is mounted, e2fsck: Cannot continue, aborting." The problem is that e2fsck in e2fsck-1.24 no longer takes into account whether /etc/mtab is writable or not; whenever it finds an mounted entry in /etc/mtab (/proc not mounted yet at this time), it assumes it's already mounted, even though the system has just experienced a crash. I think the mtab checking code in older version of e2fsck is still needed: --- e2fsprogs-1.24/e2fsck/unix.c-1.24 Wed Aug 29 08:40:27 2001 +++ e2fsprogs-1.24/e2fsck/unix.c Wed Sep 5 10:41:27 2001 @@ -223,6 +223,20 @@ (mount_flags & EXT2_MF_READONLY))) return; +#if (defined(__linux__) && defined(HAVE_MNTENT_H)) + /* + * If the root is mounted read-only, then /etc/mtab is + * probably not correct; so we won't issue a warning based on + * it. + */ + fd = open(MOUNTED, O_RDWR); + if (fd < 0) { + if (errno == EROFS) + return; + } else + close(fd); +#endif + if (ctx->options & E2F_OPT_READONLY) { printf(_("Warning! %s is mounted.\n"), ctx->filesystem_name); return; -- Wenzhuo
On Sep 05, 2001 11:57 +0800, Wenzhuo Zhang wrote:> The problem is that e2fsck in e2fsck-1.24 no longer takes into account > whether /etc/mtab is writable or not; whenever it finds an mounted entry > in /etc/mtab (/proc not mounted yet at this time), it assumes it's > already mounted, even though the system has just experienced a crash. I > think the mtab checking code in older version of e2fsck is still needed:Mount /proc before checking your non-root filesystems, and it will work. I suppose for the sake of kernels that don't have /proc (is it even possible?) that this could be fixed, but then you are still at risk of damaging your filesystems if one of them IS mounted. Cheers, Andreas -- Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto, \ would they cancel out, leaving him still hungry?" http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
Frédéric L. W. Meunier
2001-Sep-07 08:24 UTC
Re: [e2fsprogs-1.24] "fsck -A -a" fails on reboot
Andreas Dilger wrote:> There is no reason why they can't mount /proc before fsck > either. In fact, you _need_ /proc mounted to do > mount-by-label and mount-by-uuid.Then, why the Kernel can't mount the proc file system when asked ? Like devfs =mount and =nomount options. Or you can't mount it before init ? I think a Kernel option is better than any additional lines in your init scripts. -- 0@pervalidus.{net, {dyndns.}org} Tel: 55-21-2717-2399 (Niterói-RJ BR)