Linux Know-How provides a collection of introductory texts on often needed Linux skills.

How can I access my CDROM?

Mount it. The mounting adds all the directories and files from your CD to your Linux directory tree so you can easily access them without the drive letter.

As root, you can mount the CDROM with a command like this:

mount -t auto /dev/cdrom /mnt/cdrom

If this works, the contents of your CD appears in the directory /mnt/cdrom

Chances are this command will not work for you right away--you may have to customize it. Here is how it works.

The command tells the operating system to mount a file system autodetecting the file system type ("-t auto"). The device is /dev/cdrom. The mountpoint (the directory where to which "mounting" takes place) is /mnt/cdrom. This directory must exist and be empty. If it does not exist, create it with:

mkdir /mnt/cdrom

If the mounting command fails, maybe the device /dev/cdrom does not exist on your system? Try

ls -l /dev/cdrom

/dev/cdrom is just a convenient symbolic link to a real "device" that is mapped onto your hardware. On an IDE system, chances are your real cdrom is on /dev/hdb. Therefore, try /dev/hdb instead of /dev/cdrom in the mount command above:

mount -t auto /dev/hdb /mnt/cdrom

If this fails, you can try /dev/hdc or /dev/hdd, if your CD is an IDE CDROM on the second IDE interface. If none of them is your CDROM, maybe you don't have IDE but a SCSI CDROM? Then try /dev/sda, /dev/sr0, etc.

A short listing of possible drives could include:

  • hda -- the master drive on the first IDE interface (that's always the first hard drive)

  • hdb -- the slave drive on the first IDE interface (you must have at least two hard drives for that)

  • hdc -- the master drive on the second IDE interface (if you have two IDE interfaces on your computer, most newer computers do)

  • hdd -- the slave drive on the second IDE interface (if you have one)

  • sda -- the first SCSI drive

  • sdb -- the second scsi drive ("sdc" is the third scsi drive, etc. There can be many scsi drive on a system).

  • sr0 -- the first scsi CD drive (sometimes called scd0)

  • sr1 --the second scsi CD drive (sometimes called scd1), (sr2 is the third scsi CD drive, etc. There can be many scsi CD drives on the system).

It is a good idea to have a device /dev/cdrom anyway because some programs assume that it exists. If it does not exist on your system, you may create it as a symbolic link using, for example:

ln -s /dev/hdb /dev/cdrom

if your cdrom is the /dev/hdb drive.

If you cannot mount because "the device is already mounted or directory busy", perhaps the mountpoint /mnt/cdrom is your current directory. You have to change the directory to somewhere else in order to be able to mount to it; for example change the current directory to the root directory by issuing this command:

cd /

To unmount a mounted CD, exit the directory /mnt/cdrom and type as root:

umount /mnt/cdrom

Your CDROM may refuse to eject the media if it is not unmounted. Also, you may have problems mounting the next CD if the previous one was not unmounted. If you cannot unmount because "the device is busy", perhaps /mnt/cdrom (or any subdirectory underneath) is your current directory? You need to change your current directory to somewhere else out of the mountpoint in order to unmount the device.

Last Update: 2010-12-16