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?
tietohackerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mgrennanCommented:
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.

http://www.linux-consulting.com/Amd_AutoFS/autofs-5.html

rindiCommented:
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.

joolsSenior Systems AdministratorCommented:
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.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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 ??

 
mgrennanCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tietohackerAuthor Commented:
I give up. The cd or dvd device doesnt get mounted at all. Thanks anyway.
SirTuxCommented:
it will be mounted when you access it!
tietohackerAuthor Commented:
I'm sorry, but it doesn't
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.