Subject: Re: filesystem hierarchy
To: None <port-macppc@netbsd.org>
From: Kirill Levchenko <kirill@lava.net>
List: port-macppc
Date: 04/02/2004 20:46:18
On Thursday, April 1, 2004, at 04:46  PM, Jeff Fry wrote:

 > I'm trying to make sense of the NetBSD filesystem hierarchy.
 > I've compared the filesystem (directories and files)
 > installed on my system (using 'ls -F' and 'ls -l') to that
 > described in the hier(7) man page. Listed below are some
 > differences that I have found, some of which I don't
 > understand, and some of which I have "theories" about. I
 > would greatly appreciate it if anyone could shed some light
 > on these for me.

I will give it a shot. You may also find the NetBSD guide useful. It 
can be found on the Documentation and FAQs page:

	http://www.netbsd.org/Documentation/

 > hier(7) describes /[a-z] "user filesystems".

I don't know about these, nor have a seen them before. These may simply 
be mount points for other file systems. I know that amd (see below) 
used /a, but it looks like it's using /amd in NetBSD.

 > I don't see
 > these, probably because I didn't create any "additional"
 > partitions on this disk? (This is my boot drive, I have not
 > yet "added" my (larger) data drive(s) to the NetBSD system.)

I don't know how well you are familiar with Unix in general, so this 
may be something you already know. In Unix, file systems (e.g., drive 
partitions, network file systems, special file systems like kern) are 
"mounted" at certain points in the root file system. You can think of 
it as replacing a particular directory with the root of the mounted 
file system. In your case, it looks like the root file system comes 
from the a partition, and then /usr comes from g. Put another way, the 
file system on partition a is your root file system, and the file 
system on g is mounted at /usr. If you have other partitions (e.g., 
from other disks), you can mount them at any point you want. Mounting a 
file system is done using the mount command, and at startup, /etc/fstab 
is read and all the file systems specified there are mounted. It looks 
like you also have /kern, which I will mention later. If this concept 
of mount points still doesn't make sense, it's okay; it will 
eventually. Just remember, unlike MacOS or Windows, another 
disk/partition/cdrom need not appear "on the desktop" or "My Computer", 
but can be anywhere in the file system you want.

 > disklabel output (for boot drive):
 >
 > # disklabel sd0

[snip]

 > disklabel improperly identifies the drive's rpm at
 > 3600--it's a 7200 rpm drive (Seagate Barracuda ST34371N). Is
 > this a "bug" in disklabel?

I don't know why this is. Perhaps someone else can answer your question.

 > -------------------
 >
 > hier(7) describes /dump/ "online dump(8) repository". I
 > don't have this directory. Would I need to create this
 > myself, if I desired to save a 'dump' or 'rdrump' to this
 > drive (which may not make sense)?

I think is for doing network backups from other machines. That is, the 
backups from other machines on your network are put in your dump 
directory. You don't need to worry about this unless you are at the 
point where you're setting up a network and want to make backups.

 > -------------------
 >
 > I have /kern/. hier(7) describes /sys/kern/ but no /kern/ at
 > the root of the disk. Does this just represent a change in
 > NetBSD 1.6.2, that has not been documented (updated) in the
 > hier(7) man page?

I have a feeling hier has not been updates in a long time :)

/kern is a special type of file system which gives you access to kernel 
information as regular files. (see mount_kernfs(8)) Have a look. Try, 
for example, "cat /kern/hz" This should tell you your processor speed. 
Recall that I said a file system can be mounted at any point. Well, you 
can have this kern file system (i.e., the directory containing these 
special files) anywhere you want, not necessarily /kern, though that is 
the convention. For example, you could create "/foo" and mount the kern 
file system there. You can have it mounted in two different places if 
you want.

The /usr/src/sys/kern directory contains the kernel sources. If you 
download the source (or get it from CD-ROM), this is where it will 
reside. It is related to the kern file system in name only.

 > I will eventually compile a customized kernel, add data
 > drives, etc., but I wanted to start out with a "simple"
 > install and configuration while I'm learning the "ins and
 > outs" of NetBSD.

Okay. Sounds like you're on your way.

 > Any information to address these discrepancies, and help me
 > to better understand the NetBSD filesystem hierarchy, is
 > greatly appreciated.

As I mentioned, hier(7) is probably a bit out of date. Recall that it 
also says "Not all files will be in every system."

 > hier(7) describes /amd/ "home directories mount point". I
 > don't have this directory.

You only need it (and would have to create it) if you intend to use 
amd. Amd is the automounter daemon, which is a special program which 
automatically mounts file systems for you. Recall that you have to 
mount file systems either at startup by including them in your 
/etc/fstab, or manually using the mount command. Since this was not 
always convenient, amd was created to mount and unmount systems 
automatically when needed. (Think of network file systems) You won't 
need to run amd on a basic system.

 > Does anyone have a clue? Does anyone care? Is there anyone
 > here who is willing to help clear up this mystery? I thought
 > that NetBSD users provided peer-to-peer support/help. Should
 > I be asking these questions on a different NetBSD list?

People care and want to help, but it takes time to write a useful 
reply. It may be better to post your questions to the netbsd-help 
mailing list, as (1) there are probably more people reading it, and (2) 
port-macppc is typically for issues specific to NetBSD on PowerMacs or 
PowerMac clones.

If you have further questions, I would be happy to answer them as best 
as I can, time permitting.

Kirill