You are not logged in.

#1 2007-06-30 16:15:17

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

What's the skinny on DVD/CD drives?

I use Arch as my main OS, and am very happy with it.
I am somewhat confused, however at the general handling of optical drives in Linux. For instance, there is a /dev/cdrom and a /dev/dvd, there is /media/ and /mnt/ and when I play DVD's in VLC, it searches for DVD///DVD (three slashes?! )
What I am asking, I guess, is
1. What happens when I insert a DVD or CDROM, if I have no fstab entries for either?
2. Does udev and hal or something else create symlinks  to these disks?
3. Why /dev/sr0 AND /dev/cdrom? Why dev/dvd AND /media/dvd AND media/cdrom AND /mnt/dvd...............?
or
4. Is there a guide that explains Linux' handling of these? (Couldn't find anything in the wiki)

The whole thing just seems mysterious to me, even though I have gotten my system to work, I can't figure out WHY it works.
Currently, I am using KDE, hal, dbus, and udev, and have no fstab entries other than / and swap.
Thank you for listening to my weird rant. tongue

Last edited by Misfit138 (2007-06-30 16:17:16)

Offline

#2 2007-06-30 16:57:17

Obi-Lan
Member
From: Finland
Registered: 2007-05-23
Posts: 179

Re: What's the skinny on DVD/CD drives?

sr0 is the original device and rest are symlinks to it. Im not sure my self either but I think its because legacy reasons etc.

1. It gets mounted to /media with folder name of cd name. IE if you have cd wich name is games, it will be mounted as /media/games
4. Short hal guide on wiki http://wiki.archlinux.org/index.php/HAL

Offline

#3 2007-06-30 18:04:39

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: What's the skinny on DVD/CD drives?

The easiest might be, if you just 'ls -l' the devices. You will see that /dev/cdrom, /dev/dvd, ... are symlinks to the devices (usually /dev/hdX for IDE drives, /dev/sdX for SATA-drives). What are these symlinks good for? For convenience, eg. your favourite media player just needs to look under /dev/dvd for your dvd-drive and doesn't have to guess the correct device or have the user tell it so. These symlinks are created by udev. Feel free to edit your udev-rules if you want to, there's plenty of possiblities and howtos. :]
Well let me try to answer your questions (even though I'm certainly not a guru or anything, so please correct me if/where I'm wrong):
1. Nothing. Even if you have fstab entries, if you insert a CD/DVD nothing happens. Well that is as long as you are not using an automounter that mounts drives for you. But even in that case, when you insert a CD/DVD nothing should happen, the automounter kicks in when you try to access a drive.
2. udev creates symlinks on startup (or on plugin for hotpluggable devices, if there is rules for that). For more information just have a look at your udev-rules.
3. As to the symlinks in /dev, we already know why those are there. To the /mnt and /media thing: Technically it doesn't matter, where you mount your drives. One standard though is to mount drives under /mnt (old) and another standard that seems to arise these days is to use /media for pluggable media. In Arch standard configuration is to use /mnt. /media is used by hal automounting.
Well I am not 100% sure about /dev/srX. i just remember that from old scsi cd-drives that were put under /dev/sr* but then that was deprecated in favor of some other name.. my sata-dvd burner (with lightscribe) now causes the creation of the device-node /dev/sr0 now too. Hmmm, as I said, I dunno about /dev/sr big_smile

In your case hal is probably handling all that for you and let me guess: your drives appear under /media, right? Anyhow, again, it doesn't matter where you mount things to though.
I hope that helped to clarify a little bit.

Offline

#4 2007-06-30 19:08:51

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: What's the skinny on DVD/CD drives?

Thank you both !

SO far I am getting this:

A. /dev/sr0 is my actual optical drive
B. /media/DVD and media/CDROM are symlinks, created by udev on bootup (are they dynamically created and destoyed?) If a DVD or CD is inserted, hal mounts to the appropriate /media/ directory.
C. Inserting a DVD into my machine does SOMETHING, because I am prompted that "a new medium has been detected, what do you want to do?" I suspect this is hal working in conjunction with KDE.
(If I select "nothing" I still get a DVD icon on the desktop. Right-clicking this icon gives me the option of unmounting it! So it must be mounted by hal ? )

It's getting clearer now that you guys have explained the roll of udev and hal a bit.
There are still a couple of weird things that bug me, though, like:
When I right click on my DVD icon on the desktop and select "open with" and browse applications, I come to VLC and select it.....then I get an error message stating something like /dev////DVD is a folder but a file was expected".

Offline

#5 2007-06-30 21:35:41

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: What's the skinny on DVD/CD drives?

Well, yeah, you can consider /dev/srX|sdX|hdX your actual drive. They (these block devices) and the symlinks under /dev are created "on demand" by udev. That is the general infrastructure but without mount pretty useless for the user. To "access" them (read and/or write access on a filesystem behind that blockdevice) you need to mount them. So mount kind of translates raw blocks to our filesystem structure (alright, of course technically completely incorrect but maybe it helps to illustrate the need of mount to grant the user access).
Anyhow, the stuff under /media should be regular directories in which your automounter (for example autofs or hal can do that iirc too, I don't use either one) mounts the corresponding /dev/... block device.
Apparently your automounter checks for a filesystem when your optical drive closes. So your automounter watches your drive closely, when it detecs that the drive has been closed it tries to detect a filesystem and then prompts you with a message box.

So udev creates (and destroyes) all the device nodes and symlinks under /dev. It is possible to write udev rules and have udev automatically e.g. mount a usb-stick when plugged in. But udev's main purpose is to dynamically give you the general infrastructure to be able to use devices.
Mount attaches a filesystem from a source (eg /dev/sda) to a directory (eg. /media/cdrom). That can be done manually by issueing the right commands in a console or it can happen automagically done by an automounter (afaik hal does that among other things too). So hal (=Hardware Abstraction Layer) helps you to easily use your drives (among many other things).

Regarding that vlc-error: I don't use vlc nor do I use hal or a desktop environment like KDE or gnome, so I dunno what sort of naming convention it might offer to offer quick access to devices (somewhat similar to `mplayer dvd://.....` maybe) but /dev////DVDlooks pretty wrong to me. So I would check vlc's configuration or the configuration to that piece of software that's you mean with "open with->browse application->vlc".

Offline

#6 2007-06-30 22:39:20

Obi-Lan
Member
From: Finland
Registered: 2007-05-23
Posts: 179

Re: What's the skinny on DVD/CD drives?

Oh dummy me I forgot that I have gnome-volume-manager. /etc/udev/rules.d/udev.rules is the one to look? But when I upgrade my system does pacman overwrite all files and delete modifications made?

Offline

#7 2007-07-01 10:20:35

RabidWolf
Member
From: WI,USA
Registered: 2007-01-20
Posts: 31
Website

Re: What's the skinny on DVD/CD drives?

regarding the vlc problem, I have had that before, I simply make it look like this:
this is in the File/Open Disc dialog:
Open...
[Device name] : /dev/sr1 (or /dev/sr0)
depending on the drive I want to have it use, sr0 being the first and sr1 being the second,then in:
[Customize] : dvd:///dev/sr1
this happened on my fluxbox install also and is usable the same way by manually specifying the srX. I think I had this trouble with gmplayer also and got it to work in a similar way.

I fixed it on my kde partition although cant remember what I did, maybe uninstalled it and then reinstalled and it picked it up or maybe I specified it upon first use in one of the config wizards or preferences dialogs, sorry, dont remember exactly, in any case I always know manually specifying it will work.

Hope that helps

Last edited by RabidWolf (2007-07-01 10:38:48)

Offline

#8 2007-07-01 13:22:11

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: What's the skinny on DVD/CD drives?

RabidWolf wrote:

regarding the vlc problem, I have had that before, I simply make it look like this:
this is in the File/Open Disc dialog:
Open...
[Device name] : /dev/sr1 (or /dev/sr0)
depending on the drive I want to have it use, sr0 being the first and sr1 being the second,then in:
[Customize] : dvd:///dev/sr1
this happened on my fluxbox install also and is usable the same way by manually specifying the srX. I think I had this trouble with gmplayer also and got it to work in a similar way.

I fixed it on my kde partition although cant remember what I did, maybe uninstalled it and then reinstalled and it picked it up or maybe I specified it upon first use in one of the config wizards or preferences dialogs, sorry, dont remember exactly, in any case I always know manually specifying it will work.

Hope that helps

Yes, I had a similar experience as you with VLC, so I learned to tweak it as you suggested smile (Also, you can fix this by going to ~/.vlc and removing or renaming the config file. wink )
But what I am actually referring to is simply right clicking on a DVD icon on the desktop and choosing open with and then browsing for VLC as the application to open it with. It gives an error like "DVD:///dev/sr0 is a folder but a file was expected."

Offline

#9 2007-07-01 15:40:42

Archangel-13
Member
From: The sunshine city.
Registered: 2006-07-23
Posts: 7
Website

Re: What's the skinny on DVD/CD drives?

I just installed KDE to check this and had the same experience/message.  After removing vlc and reinstalling after KDE it was fixed, so I'm guessing it wasn't properly registered with KDE.

So, remove it with 'pacman -Rns vlc' and reinstall 'pacman -S vlc' and it should hopefully work.

Offline

Board footer

Powered by FluxBB