Re: About /etc/mtab and /proc/mounts

Miles Bader
2003-02-27T06:56:36Z

Kasper Dupont <kasperd@daimi.au.dk> writes:
> > /var is clearly the right place for this;
>
> Is it?

Yes. On some systems, /var and /tmp are the _only_ read-write filesystems.

> > if /var isn't mounted initially, I'd suggest that mount should
> > simply not update any file at that point, and the init-script that
> > mounts /var can be responsible from propagating information from
> > /proc/mounts to /var/whatever.
>
> Would you fsck /var while it is mounted?

No, of course not; that's why I suggest it's up to the init scripts to
make sure that /proc/mounts gets propagated to /var/whatever. They
usually will know enough about what's going on to take care of any
special cases and add any extra info that's relevant.

If a program such as `mount' wants to use mtab and finds that it's not
present (possibly because /var isn't mounted), it should either use
/proc/mounts instead, or just ignore it.

> I think part of the problem is that /var is used for both files
> we want to keep across reboot, and files we do not want to keep
> across reboot.

[/var/run is for `non-persistant' files]

> There are cases where it is undesirable to have mtab in /var,
> but if mount expect to find mtab somewhere under /var, we can't
> even use a symlink to get it out of there, because /var needs
> to be mounted before the symlink can be followed.

It will simply appear to mount as if the file isn't present, in which
case it should gracefully stop trying to use it [see above].

It seems like the attempt here is to somehow make everything just work
magically _without_ modifying any tools that use mtab -- and I think
that just isn't doable in every situation.

-Miles
--
Quidquid latine dictum sit, altum viditur.