Re: NFS: what happens to local space when remote space is imported?

From: Logan Shaw (lshaw-usenet_at_austin.rr.com)
Date: 12/31/04


Date: Fri, 31 Dec 2004 03:10:03 GMT

Tlhingan wrote:
> What happens to the space occupied by the local /usr/ports when a
> directory of the same name is imported? does the local drive get
> "bigger "? Does one recover local disk real-estate by importing
> directories that are common?
>
> O.K., once again, for me more than you;
> If the directories were already on there, and then I import on top of
> them, I'm actually using the nfs server directory - but what happens
> to the space that was on my disk which had (have?) those directories?

What happens to wallpaper when you put new wallpaper on top of it?
Nothing. It's still there. It still weighs something and could burn
if the building caught fire. And it still has the same picture or
design on it that it did before; you just can't see it because
the new layer of wallpaper covers it up.

And so it is with Unix filesystems. The "mount" command places a
new directory on top of the old directory. The new directory is
the root of another filesystem. The old directory is still there;
it simply can't be seen because it is obscured by the new one.

Now, you may ask what happens to the files that were "in" the
directory that you covered up. But in Unix, there is no such
thing as files really being "in" a directory. A unix filesystem
simply gives a number (the i-node number) to every file, and a
directory is a list of filenames and the numbers they go with.
The directory doesn't contain any files; it's just a list that
contains numbers which the system can use to find files.

So, some files "in" that directory may still be accessible if
they are listed by some other directory (that is not obscured)
as well. This is commonly called a "hard link", although I
think that's a misnomer since every file is "hard linked"
in a sense. If a file is named only by some directory that's
obscured, then file will not be accessible, but it is still not
gone. When you unmount, it will still be there. And, in fact,
if you open the file before you obscure it, you can continue
working with it, just as you can continue working with an open
file after it has been deleted.

If the idea of obscuring one filesystem with another doesn't
make sense, it might help to understand that Unix uses a virtual
filesystem in addition to the individual on-disk filesystems.
The virtual filesystem keeps track of which directories in the
filesystem namespace ("/", "/usr/ports", "/etc/passwd") correspond
to what on the actual filesystems. You can think of it as a
data structure which includes a mapping between mount points
and real (disk-based) filesystem root directories. It knows
that the "/" directory refers to some object that allows
access to the root of one filesystem, and it knows that "/usr"
refers to some other object that allows access to the root of
a different filesystem on a different partition. The virtual
filesystem data structures exist only in memory, so changing
them (with the "mount" and "umount" commands) doesn't affect
the disk.

  - Logan



Relevant Pages

  • Re: NFS: what happens to local space when remote space is imported?
    ... On Fri, 31 Dec 2004 03:10:03 GMT, Logan Shaw ... >What happens to wallpaper when you put new wallpaper on top of it? ... >the root of another filesystem. ... >if you open the file before you obscure it, ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Read-only root (/) except /et
    ... in other words, again root is compromised. ... That means that in a standard config the root filesystem cannot be made ... backup, and fewer writes means less likelihood of corruption eg if power ... Note that all my live partitions are rsync'd with identical ...
    (Debian-User)
  • Re: Read-only root (/) except /et
    ... in other words, again root is compromised. ... That means that in a standard config the root filesystem cannot be made ... backup, and fewer writes means less likelihood of corruption eg if power ... Note that all my live partitions are rsync'd with identical ...
    (Debian-User)
  • Re: UFS Bug: FreeBSD 6.1/6.2/7.0: MOKB-08-11-2006, CVE-2006-5824, MOKB-03
    ... They can simply mount a filesystem with any number of SUID ... root binaries on it and have their way with the box. ... I don't think anyone is arguing whether or not this is a bug. ...
    (FreeBSD-Security)
  • Re: Disk Druid - Fedora flame #1
    ... >Gene Heskett wrote: ... > be part of a minimal boot environment. ... >And the root filesystem should be as small as reasonably possible, ... as long as root is trusted. ...
    (Fedora)