How to mount cdrom in Linux
CD's and DVDs are using ISO9660 filesystem. The aim of ISO9660 is to provide a data exchange standard between various operating systems. As a result any Linux operating system is capable of handling the ISO9660 file system. This guide describes a way on how to mount / umount ISO9660 file-system in Linux and thus enabling user to read data from CD or DVD media.
If you still have some questions after reading this article please try our new LinuxCareer Forum.
1. Detecting CD/DVD-ROM drives
At first we need to find usable devices capable reading ISO9660 data. In other words we need to find CD/DVD drives available on our Linux system. In order to do that, we can use "wodim" command and its --devices option. wodim will scan and output symbolic device names found in /dev/* directory:
# wodim --devices
If a wodim command is not available on your system make sure cdrecord package is installed on your system.
Debian and Ubuntu:
# apt-get install cdrecord
RedHat, Fedora, CentOS:
# yum install cdrecord
Once you execute wodim command and you have some CD/DVD device hardware available in your system you should see an output similar to the one below:
$ wodim --devices wodim: Overview of accessible drives (1 found) : ------------------------------------------------------------------------- 0 dev='/dev/scd0' rwrw-- : 'TSSTcorp' 'CD/DVDW SH-S183L' -------------------------------------------------------------------------
From the above output we can determine that our CDROM / DVDROM drive can be accessed at the symbolic location /dev/scd0.
Furthermore, it needs to be mentioned that different systems may behave differently. For example in Debian Linux a user running wodim command must belong to cdrom group, otherwise the wodim command will fail with an error message similar to the one below:
wodim: No such file or directory. Cannot open SCSI driver! For possible targets try 'wodim --devices' or 'wodim -scanbus'. For possible transport specifiers try 'wodim dev=help'. For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from the wodim documentation.
2. Creating mount point
Your Linux system may already have created a mount point for you, it is usually something like /cdrom, /media/cdrom, /media/cdrom0 or /mnt/cdrom . If this is not your case, feel free to create your own mount point. To have mount point available is a absolute must! Mount point will represent a place from where data located on CD or DVD will be made accessible to the user.
# mkdir /media/cdrom
3. Mount CDROM
If you do not belong into cdrom group and thus do not posses permissions to mount CDROM, switch to root user and execute a command below:
# mount -t iso9660 /dev/scd0 /media/cdrom mount: block device /dev/sr0 is write-protected, mounting read-only
your CDROM is now mounted and accessible from /media/cdrom directory. At this point simply navigate to this directory to access your data.
4. Mounting Audio CD's
Sometimes you would like to listen to your favorite music and when you try mount music cd with a command above you can get problems like:
linuxcareer.com# mount -t iso9660 /dev/hdc /media/cdrom0/
mount: block device /dev/hdc is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/hdc,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
This is because music CD's does not contain standard iso9660 filesystem as such. In fact the story with music CDROMs is easier as it is with data CDROMs using iso9660 filesystem.
In order to listen to a music CD all what needs to be done is to insert music CD ( Compact Dics ) into CD-ROM/DVD-ROM drive and fire up you favorite music CD player. The only thing you may need to be concerned about is whether "kdemultimedia-kio-plugins" package for KDE or "gnome-media" package for gnome window manager are installed. Those packages allow you to listen to music CD content.
In case you would like to see a content of your music CD or perhaps convert some music trakcs to MP3 / OGG format just start "KONQUEROR" and enter location:
into Konqueror's navigation bar.
5. Allowing users to mount CDROM
You can also allow users on the system mount CD's or DVD's. To do that edit your /etc/fstab file and add line similar to the one below:
/dev/sdc0 /media/cdrom0 iso9660 ro,user,noauto 0 0
6. Umount and eject CDROM
There are couple ways how to remove/unmount CDROM.
# umout /dev/hdc
or you can simply run:
If you are unable to unmount your previously mounted CDROM, make sure that you are not in the directory where your CDROM is mounted or that some other application is not using it.
If you are still having problems to unmount your CDROM medium you can use fuser command to kill all related processes using your device.
# fuser -mk /dev/hdc
NOTE: Never use the above command on devices mounted read/write unless you are sure what you are doing.
7.1. Testing for ISO9660 support
Although it is highly unlikely that your system does not support this specific filesystem here are some tips on how to test for ISO9660 presence in your Linux system.
In case you face some troubles try to search for loaded kernel modules with lsmod command or by reading a content of /proc/filesystem file:
# cat /proc/filesystems | grep iso9660
# lsmode | grep iso9660
The actual module is be a part of libiso9660 package. Both commands should report available ISO9660 filesystem.