Re: OT: What is a dev? What is a mountpoint? -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In alt.os.linux.slackware, Al. C dared to utter,
> What is a device? By that I mean what are the entries in /dev (like /dev/cdrom
> or /dev/fd0 etc.) I don't mean what they stand for, but WHAT are they?
> Then, what is a mountpoint? What is /mnt/cdrom mean?
Excellent question.
Device files are a little difficult to explain, and I don't fully
understand them, but I'll give it my best shot (though I think kurt's
pretty much answered the question). Device files are special files that
read and write to the kernel, rather than to themselves.
So, you might $(cat some_file) and the kernel makes a system call to
the filesystem, finds the file, then sends its contents to the shell.
Now if you were to say $(cat /dev/urandom) the kernel makes a system
call to its random number generator. How it does this is of course the
million dollar question. Some one correct me if I'm wrong, but the
kernel portions up its internals into major sections, then subsections
represented by major and minor numbers respectively.
So /dev/urandom has a different major and minor number combination than
/dev/hda. This simply tells the kernel where to read/write information
from.
Now mount points are easy. A mount point is just an empty[0] directory
where you mount (think graft) a filesystem. So there's really nothing
special about where the mount point is[1]. You can just as easily mount
/dev/cdrom at /mnt/hd as you can at /mnt/cdrom.
[0] Actually it need not be empty, but out of convention it is. If you
mount a filesystem over a non-empty directory the contents of that
directory are hidden until you umount.
[1] For that matter there's nothing special about where device files go
either. You can have /home/hda1 if you wanted, but convention puts them
all in /dev.
- --
It is better to hear the rebuke of the wise,
Than for a man to hear the song of fools.
Ecclesiastes 7:5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFB2/7llKR45I6cfKARAsDGAJ9L6pqG3kURq0LqTHIHobg0y4CKSgCg iP4b
P3Asumy1H+J5JrZk7DM/jhk=
=OAIw
-----END PGP SIGNATURE----- |