LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Automount dvd ROM when dvd is inserted (https://www.linuxquestions.org/questions/linux-newbie-8/automount-dvd-rom-when-dvd-is-inserted-455000/)

baddah 06-15-2006 06:50 AM

Automount dvd ROM when dvd is inserted
 
Hi,

I am trying to configure my system so that when i insert a dvd it will automatically mount it,and i will be able to browse the files wherever i mounted it.I tried this entry in /etc/fstab(I'm using Fedora Core)

Code:

/dev/cdrom  /mnt/cdrom  auto  ro,auto,user,exec  0 0
but i still have to manaully mount the dvd with

Code:

mount /dev/cdrom /mnt/cdrom
the files are there after the above command,but i need it to mount automatically.any idea what to do?

Thanks

Lordandmaker 06-15-2006 06:53 AM

Rather than /dev/cdrom, i'd have expected to see /dev/hdx, with the x denoting the IDE device (so /dev/hda is primary master, /dev/hdb is primary slave etc.).

Though if it works in the mount command, i'd have expected it to work in fstab.

baddah 06-15-2006 07:26 AM

i changed the /dev/cdrom to /dev/hdb (the drive is primary slave),but still no luck!any other ideas?i'm setting this up for a client and he won't be able to mount the dvdrom every time,but he really needs to access the dvd drive....thanks

baddah 06-15-2006 08:19 AM

ok,i've even tried adding the mount command in /etc/rc.local,but still no luck.is there anything i must change somewehere else maybe,like some place in autofs's configuration files maybe?I know that my old Mandrake system used to mount cdroms automatically perfectly,without me changing anything,so i'm sure there's a way to do this,any help would really be appreciated.cheers

jschiwal 06-15-2006 08:48 AM

Check if Fedora 4 uses udev.

/dev/cdrom /mnt/cdrom auto ro,auto,user,exec 0 0

The first auto in your fstab line means to automatically select the filesystem type.
The second means to mount it when you boot up. Using "noauto" is normal for a dvd, because there may not be a dvd in the drive when booting up.

Code:

/dev/cdrom          /media/cdrom        subfs noauto,fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
This is how mine is listed in the fstab file.

Your mileage may vary. For reference, here are my /etc/udev.d/65-cdrom.rules.
Code:

# cdrom links generated by YaST2
#
SUBSYSTEM=="block", ENV{ID_PATH}=="pci-0000:00:02.2-usb-0:1:1.0-scsi-0:0:0:0", SYSFS{removable}=="1", SYMLINK+="dvdram cdrom dvd"
SUBSYSTEM=="block", ENV{ID_PATH}=="pci-0000:00:08.0-ide-1:0", SYSFS{removable}=="1", SYMLINK+="cdrecorder"


baddah 06-19-2006 01:49 AM

Thanks for the reply,but I'm not to sure what udev does?i'll do some reading and try to figure out.I know that it's normal to specify noauto for dvdroms,but i want it to automount when dvd is inserted,and i thought that's a requirement for that to happen?i guess i'm just missing something somewhere,but it is possible to have the dvdrom function this way in fedora core am i right?

AdaHacker 06-19-2006 05:19 PM

Quote:

Originally Posted by baddah
I'm not to sure what udev does?i'll do some reading and try to figure out.

Udev dynamically creates and deletes device nodes based on the current system configuration. So, for example, when you plug a USB thumb drive into your system, udev will create /dev/sda1 (or whatever) and delete it when you remove the drive. For purposes of this question, the relevant feature of udev is the ability to run an arbitrary script when a device node is created. I played around with this in Slackware a while back, but no longer need it with Kubuntu. I wouldn't recommend this method, but it works in a pinch.

Quote:

I know that it's normal to specify noauto for dvdroms,but i want it to automount when dvd is inserted,and i thought that's a requirement for that to happen?
Let me make this crystal clear: /etc/fstab has absolutely nothing to do with setting up the kind of auto-run functionality you're talking about. The auto/noauto options only apply at boot or when 'mount -a' command is issued. For your purposes, it makes no difference whether the drive is set for to auto or noauto.

On modern Linux distributions, the standard way to implement auto-run functionality is using HAL and D-BUS in conjunction with a volume manager like ivman or gnome-volume-manager. Basically, HAL maintains a dynamic list of devices that are attached to the system and their properties. When this list changes, it uses D-BUS to send a message to the volume manager, which then takes appropriate action. So, when you insert a DVD, HAL changes the hardware list and notifies and notifies D-BUS, which notifies the volume manager, which can mount the DVD and open the file browser to the appropriate directory.

I'm not a Fedora user, but I'm pretty sure HAL/D-BUS should work out or the box on recent versions of Fedora. (You can check by seeing if the lshal command gives you any output.) Given that, I'd guess that either something is broken on your system or you're not running a volume manager. You might try checking that gnome-volume-manager is running. KDE 3.5 and greater also has an integrated volume manager configurable under the peripherals->storage media section of KControl. If you're not using GNOME or KDE, then odds are you're not running a volume manager at all, which would certainly explain your problem.

jschiwal 06-20-2006 06:17 AM

There was an LXer post on this site about a week ago that had a link to a UDEV tutorial.

I just did a search and found it.
http://www.linuxquestions.org/questi...highlight=udev

I hope this helps!

I won't pretend that it is easy to understand. I've only made small tweeks to my setup to change the group that a device is created with. The udev rules on your system may be set up using abstractions and general rules that make it even harder to get a handle on. I've seen where inserting a key drive creates a device where the current user is the owner, which gives the owner full access. On a usb drive that I have plugged in right now, it is mounted to /dev/sda1 with these permissions:
brw-r----- 1 root disk 8, 0 2006-06-18 23:56 sda
brw-rw----+ 1 root disk 8, 1 2006-06-18 23:56 sda1
Since the group owner is "disk", I made myself a member of the "disk" group, giving me read-write access to the drive. This may not be the proper use of this group however, because it gives me the ability to do things like writing to /dev/sda as well. Being the only user, it is OK in my case.

For externel usb or firewire dvd drives, you might want to check if all the kernel modules you need are loaded. If not, I have in the past run my systems hardware display utility so that the system would be rescanned. Then I ran "depmod -a" and "mkinitrd". I don't know if this would help you or not. If your distro already has rules for cdrom or dvd drives, it could be that the udev rules are not being triggered because a needed kernel module doesn't detect it.

baddah 06-20-2006 08:12 AM

Thanks,I'll have a look.did n't think its gonna be this much effort to get it working...

tskears 06-20-2006 01:05 PM

This is the line from fstab for my DVD, which automounts/autoruns DVDs:

# cdrom: SONY DVD+-RW DW-Q58A
/dev/sr0 /mnt/cdrom auto user,exec,ro,noauto,codepage=850,umask=0 0 0

Any help?


All times are GMT -5. The time now is 02:32 AM.