Home   |   Guides and Tutorials   |   What's New?   |   Comments   |   About
 

Using Your CD-ROM Drive

by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:30 EDT

Introduction
    In Linux, the floppy and CDROM drives must be "mounted" before the data on them can be read. When a CDROM is mounted, its file heirarchy is added to the existing file heirarchy usually under /mnt/cdrom or /cdrom. It can be mounted anywhere the user wants it to be. Thus, after mounted the floppy, the command ls /mnt/cdrom displays the contents of the disk. Unlike a floppy disk, a CD has only one file system: iso9660. After using the CDROM drive, the disk must be "unmounted" before it is removed.
Mounting the CDROM Drive
    The syntax is mount -t iso9660 /dev/cdrom /mnt/cdrom

/dev/cdrom is usually autoconfigured during installation to point to a device off the EIDE or SCSI controller such as /dev/hdb or /dev/sdb depending on your controller and how many other devices you have in your machine.
Allowing Users to Mount the CDROM Drive
    Most Linux distributions do not allow users to mount the CDROM drive for security reasons. Root access is usually required to do so. However, someone with root access can allow users to mount the CDROM using the /etc/fstab configuration file.

Example /etc/fstab without user privileges to mount the CDROM:

/dev/hda1       /                ext2    defaults        1 1
/dev/hda5       swap             swap    defaults        0 0
/dev/fd0        /mnt/floppy      ext2    noauto          0 0
/dev/cdrom      /mnt/cdrom       iso9660 noauto,ro       0 0
none            /proc            proc    defaults        0 0
none            /dev/pts         devpts  gid=5,mode=620  0 0


Example /etc/fstab with user privileges to mount the CDROM:

/dev/hda1       /                ext2    defaults        1 1
/dev/hda5       swap             swap    defaults        0 0
/dev/fd0        /mnt/floppy      ext2    noauto          0 0
/dev/cdrom      /mnt/cdrom       iso9660 noauto,ro,users 0 0
none            /proc            proc    defaults        0 0
none            /dev/pts         devpts  gid=5,mode=620  0 0

Notice the users tag in the fourth column of the line beginning with /dev/cdrom. This allows anyone in the users group to mount the CDROM using the iso9960 filesystem with the command mount /mnt/cdrom.
You can also add individual user names to the end of the fourth column to give them only certain users access.
What's Related


All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004