Automatically mount cd/dvd and usb rhel5?

I've maually installed RHEL5 from a dvd. After I ejected the dvd and rebooted I cant se the dvd anymore. I tried to attach some USB sticks and other cd/dvd's but none of them mounts automatically.
I found that I can mount the cd/dvd with the command: # mount /dev/cdrom /mnt/cdrom (if I created /mnt/cdrom dir first)

What do I have to do to get the usb sticks and dvd's mounted automatically?
Who is Participating?
You do not need the backup line.

Q, If you drop a data CD in to the cd/dvd drive it should be mounted for you at /media/cd.
The command 'df' should show you.

The DVD mounting is not to hard.  Check if yo have a file /dev/dvd.  Then try:

dvd -ftype-=iso9660,ro,nosuid,nodev :/dev/dvd

USB devices are a bit harder.  They show up as /dev/sd?#   and don't always maintain the same device letter (the ?).   The number (#) is the partition on the device starting with 0.  Some thumb disk have a 0 and 1 partition.  

If you only have one disk in your system it is /dev/sda# and may have more partitions.  The next device would be sdb then sdc and so forth.  If you plug in two devices they will be "lettered" in order.

Excuse me if I'm talking down to you.

I guessing you want you want the same device, like your pocket thumb drive, to always mount in the same place.  To do this you need to work with /etc/udev/rules.d   This directory contains rules that describe what scripts to run when a given device is plugged in.  If you have a bunch of the same thumb drives with the same company ID and partitions, write a script to look for a file you create on each one to tell Linux where to mount that one drive.
You can auto mount with linux.  The issue is all the file types linux supports.  CD and DVD are a known type but USB device could be many file system types.

Start my checking that autofs is running.  Type
chkconfig --list autofs

You should get:
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off

Then check the file /etc/auto.misc.  It should have the lines.
cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
backup          -fstype=ext3            :/dev/sde1

Here is a link to automounting example configurations.

Is there a specific reason for using rhel5 and not another distro? The redhat versions are mainly meant for secure infrastructures and therefore much that can compromise this security like external media isn't supported by default. Distro's like Ubuntu, LinuxMint, Fedora-Core (from which redhat is eventually based on) are all more user friendly than rhel and have USB support and I believe also automount already there by default, or at least it is very easy to get that added. For rhel that might not be as easy, and also not recommended.

Also, are you using a GUI? if not, I don't think you can get automount to run.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I think rindi may have got it with the GUI, strange but it seems to be true.

I've no idea why the GUI seems to make a difference but on my RHEL systems it does seem to.
tietohackerAuthor Commented:

Yes mgrennan, I have the below line in my /etc/auto.misc:
cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
(but do I really need the backup line?) I comment that out.
My chkconfig --list autofs also reports correct output.

But how can I get the cd/dvd and usb device automatically automounted under /media ??

tietohackerAuthor Commented:
I give up. The cd or dvd device doesnt get mounted at all. Thanks anyway.
it will be mounted when you access it!
tietohackerAuthor Commented:
I'm sorry, but it doesn't
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.