Will Dyson on Tue, 11 Jun 2002 03:24:37 -0400


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

Re: [PLUG] cdrom mounting


Arthur S. Alexion wrote:

Wait, Will. I'm new at this. What do you mean do a modprobe?

Modprobe is a command-line program that finds linux kernel modules (device drivers) by name and loads them into your kernel.


In the most basic usage, it takes one argment (the name of the module to load). So in order to load the ide-cd module, you would run this command as root:

	modprobe ide-cd

And if the ide-cd module is available (under /lib/modules/<kernel-name>/kernel/drivers/), it will be loaded and its functionality made available to the rest of the system. To check what modules are currently loaded into your kernel, use the command 'lsmod' (which does not need root privalge).

In order to make sure that the ide-cd module is automaticly loaded for you on every boot, you should add a line consisting soley of:

ide-cd

to your /etc/modules file.



what is devfs? If it solves my problem, how do I use it?
>

Bit of an advanced topic, really. I wouldn't actually recommend setting it up until you feel really comfortable with linux (and feel confident that you could repair your system by booting from a rescue disk if you screwed it up). But thats ok. I'll tell you about it anyway.

In the "traditional" way of doing things, device files (the special files that represent your various peices of hardware, eg: /dev/hda and /dev/dsp) are actuall files that reside on your disk in /dev, with no data and with a flag set on them so that the system knows they are not regular files.

In addition to this "I'm a device file" flag, the device files have information telling the system what device they represent (which device driver should be use used to handle reads and writes performed on the file). This information takes the form of the Major and Minor device numbers. The Major number actually tells the kernel what device driver to use, while the Minor number distingishes between multiple devices that use the same driver (such as 2 hard drives, or /dev/dsp and /dev/mixer).

This has worked well for a long time. However, as linux has grown, the traditional /dev has started to show its age. One problem is that distributions must put device files in /dev for every possible device that linux can support (unless they want their users to wrestle with creating their own device files when they install hardware, ugh). As linux has grown as an OS, this has lead directly to /dev having 400+ files in it, most of them representing devices the user does not actually have.

Devfs is a different way of handling device files. Rather than having actuall files on disk, devfs is a virtual filesystem (mounted on /dev) that only exists in ram. Rather than having device files for every possible device, devfs creates device files dynamicly, when the device driver that needs them is loaded into the kernel and finds its hardware.

To go along with the devfs filesystem in the kernel, there is a daemon program called devfsd that helps manage /dev. Devfs gives the device files different, more verbose names (such as /dev/ide/host0/bus0/target0/lun0/part1 rather than /dev/hda1) than they had under the old system. Devfsd moniters /dev and when new device files are created by the loading of a driver, creates symlinks from the old names to the new names, so as old programs don't break.

Now I can finally answer your question about how this can help in your situation.

As long as we have this devfsd program cooperating with the devfs filesystem, we might as well use it for more than just creating symlinks. One cool thing we can do is to have the filesystem automaticly load the device driver that coresponds to a given device file when you try to access that device file.

For instance, say your cd-rom driver is not loaded and therefor /dev/cdroms/cdrom0 does not exist. When you try to access that noexistant file, rather than just give up and return an error, the filesystem tells the daemon what file you tried to access. The daemon then looks up that filename in a list, which (hopfully) tells the daemon what driver provides that device file. The daemon then loads the driver (which creates the device file) and then the filesystem lets you access it, just as if it had been there all along.

Thus, no more confusion about what devices are available or what driver you must load to make a device file go "live". Many other operating systems (freebsd, for example) have done it this way for a long time. The most recent release of Mandrake linux uses devfs by default. There is a lot of inertia behind using regular device files (and a history of bugs in devfs), but I expect that more and more distributions will start to use devfs as time goes by.

Thanks for the help and patience.

You're welcome. And welcome to linux.

--
Will Dyson
"Back off man, I'm a scientist!" -Dr. Peter Venkman


______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug