Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Mounting my W95 partition



>>>>> "Ken" == Ken Harada <kenhrd@example.com> writes:

    Ken> Jonathan Byrne--3Web ~~~~~~~~:
    >>> mkdir /w95

    >> You have to make a *directory* to mount a partition?!  Does
    >> this mean that UNIX/Linux don't really understand partitions as
    >> different physical units, but rather see them as being a single
    >> directory in one big file system?

Hey, this boy learns fast!  :-)  And you know what else?  If it makes
sense to think of doing I/O (or even just one of the two) to it, on
Unix it's a file.  You want to listen to some raw audio data?  Don't
need no assembly level OUTPB b/s, you just `cat file.au >/dev/audio'.
Hell, you wanna look at the current state of a running kernel, you can 
do `cat /proc/kmem' (or something like that).

How's this work?  Well, you ask for something on your W95 partition,
say /w95/windose/win.outie.  The kernel says "hmm...  Jonathan wants
an object, now where did I put it?  Well, there ain't nothing that
doesn't live under root.  `ls -ld /' ->

drwxr-xr-x  24 root     root         1024 Mar 21 13:58 /

Hey, look, that's a directory.  Lessee, is something mounted on it?
`mount' ->

/dev/hdb1 on / type ext2 (rw)

Yup.  OK, what is an /dev/hdb1?  `grep hdb1 /etc/fstab' ->

/dev/hdb1    /     ext2    defaults    0       1

Yow!  Now we're getting somewhere; that's an ext2 file system.  OK,
lessee, what did Jonathan say to do now ... right, turn left at w95.
Well, let's check out the directory of the root of /dev/hdb1 by
calling `EXT2_get_root_directory' ... yikes, there it is:
`ls -l /w95' ->

drwxr-xr-x   2 root     root         1024 Feb 16 15:49 /w95

Well, hot damn, Happy Birthday to me!  It's a directory, I wonder if
something's mounted on it ... yup, it's Very Fat ... lessee if there's 
anything in it, call VFAT_get_root_directory ...."

And so on.  Now, working with an ext2 file system _at the hardware
level_ is identical to working with a vfat system in the sense of
reading sectors, you gotta do those direct instructions to the IDE
hardware by talking to a CPU port (even though the logical
organization is different).  (In the notation above,
{EXT2,VFAT}_get_root_directory both work in the end by calling
IDE_read_disk_sector---but different ones and the data inside is quite
different.)  On the other hand, you could access a remote ext2 fs by
NFS, and even though the logical organization is the same, your local
CPU doesn't talk to the IDE subsystem or a SCSI host, it talks to an
ethernet card.  (NFS_get_root_directory works by calling
TCP_send_packet (containing an NFS protocol request) and then
TCP_read_packet (containing the protocol reply).)

Don't take ANY of the details above seriously, they're all wrong, but
that's all right.  The point is, that there is data encoded in the
file system to allow the OS to use wildly varying hardware and drivers 
to access resources which obey the file discipline (ie, a possibly
seekable stream) and whose family relationship is hierarchical (OK, a
DAG, but who's counting?).

An analogy:  if your boss tells you to go meet a client at

	/NaritaExpress/UA852/Hertz/SanFranciscoHilton/Room1123

each of those slashes represents a rather different operation, but I
bet you could tell me how to do it.  Kernel works the same way in
navigating the file system.

    Ken> You need a directory *entry* to mount a partition.  If you
    Ken> make /w95 directory and mount your vfat partion to it, you
    Ken> will find all the directories of your vfat partion under it.

One thing to watch out for---you _can_ (or you used to be able to) do
something like

$ mkdir /w95
$ echo "There's nothing mounted here!" > /w95/this_file_isnt_on_dev_hda1
$ mount -t vfat /dev/hda1 /w95

and doing a `ls /w95/this_file_isnt_on_dev_hda1' will give you null
output, but if you do `umount /w95' first, then that file will
"reappear."  A few years back there was a driver for an Inherited File 
System; the idea was that even though a CD-ROM is read-only, you could 
mount a R/W IFS on the same mount point, and the kernel would look
first in the IFS, and if it didn't find it there, it would look in the 
CD-ROM.  I think that disappeared (it was pretty conducive to data
loss, as I recall)---but even that can be done on Unix.  (Of course,
you can simulate it at much higher expense in disk space by using
symlinks from a hard drive to the CD-ROM, and overwriting the symlinks.)

HTH

---------------------------------------------------------------
Next TLUG Meeting: 11 April Sat, Tokyo Station Yaesu gate 12:30
Featuring Tague Griffith of Netscape i18n talking on source code
---------------------------------------------------------------
a word from the sponsor:
TWICS - Japan's First Public-Access Internet System
www.twics.com  info@example.com  Tel:03-3351-5977  Fax:03-3353-6096

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links