Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2001 15:04:10 -0700
From:      Dave Hayes <dave@jetcafe.org>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   The real answer to Re: Why does fsck try to fsck a CDROM?  
Message-ID:  <200106122204.PAA04457@hokkshideh.jetcafe.org>

next in thread | raw e-mail | index | archive | help
Well I found the problem.

It's related to this routine I found in /usr/src/lib/libc/gen/fstab.c:

static void
fixfsfile()
{
        static char buf[sizeof(_PATH_DEV) + MNAMELEN];
        struct stat sb;
        struct statfs sf;

        if (strcmp(_fs_fstab.fs_file, "/") != 0)
                return;
        if (statfs("/", &sf) != 0)
                return;
        if (sf.f_mntfromname[0] == '/')
                buf[0] = '\0';
        else
                strcpy(buf, _PATH_DEV);
        strcat(buf, sf.f_mntfromname);
        if (stat(buf, &sb) != 0 ||
            (!S_ISBLK(sb.st_mode) && !S_ISCHR(sb.st_mode)))
                return;
        _fs_fstab.fs_spec = buf;
}

This apparently tries to make sure that whatever is mounted on "/"
loads the actual device it is mounted on in the fs_spec section
of the struct. 

The bottom line to all this is that if there is any line in an
/etc/fstab that mounts on "/", fsck will use the device actually
mounted as root, and not the one in the file. 

Back to the drawing board. 
------
Dave Hayes - Consultant - Altadena CA, USA - dave@jetcafe.org 
>>> The opinions expressed above are entirely my own <<<

Nasrudin was driving a friend in his car at a spanking pace. Suddenly,
glimpsing a signpost, the friend called out "Mulla, we're going in the
wrong direction!"
"Why don't you ever think of something good?" came the reply. "Just look,
for instance, at the speed we are going at."



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106122204.PAA04457>