Automatically mount cd/dvd and usb rhel5?

Posted on 2008-11-14
Last Modified: 2013-12-16
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?
Question by:tietohacker
    LVL 3

    Expert Comment

    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.

    LVL 87

    Expert Comment

    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.

    LVL 19

    Expert Comment

    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.

    Author Comment


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

    LVL 3

    Accepted Solution

    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.

    Author Comment

    I give up. The cd or dvd device doesnt get mounted at all. Thanks anyway.
    LVL 1

    Expert Comment

    it will be mounted when you access it!

    Author Comment

    I'm sorry, but it doesn't

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now