One of the most popular and commonly encountered types of disk images is a CD/DVD image. In simple terms, a CD/DVD-image is an exact digital replica of a CD/DVD, whereby all of the data is stored in one file to completely preserve the data structure and integrity of the CD/DVD. CD/DVD images are essential for retaining copy-protection data and multi-track data/audio.
Images of CD-ROMs are usually .ISO files, referring to the ISO 9660 file system commonly used on such disks. The .ISO format is the most common format for software disk images. Other common disk image formats include: .BIN/.CUE, .IMG, .MDF/.MDS, .DAA, .UIF, and .CCD/.IMG/.SUB.
Creating an .iso file is the easiest way to create an image from a CD and mount it into the linux filesystem. Just insert the CD into your CD-drive and copy all data from the device file to any file:
# dd if=/dev/cdrom of=/path/to/the/image.iso
To mount it, you have to ensure that the loopback device driver (in kernel "make menuconfig" "Device Drivers -> Block devices -> Loopback device support") is enabled as module or built-in, what should be the case in all standard kernels.
Now just enter this command as root to mount your .iso file:
# mount -o loop -t iso9660 /path/to/the/image.iso /path/to/mountpoint
The only advantage of creating an .iso file instead of copying the data manually from the mounted CD is that the bootable block of the CD is also copied to the image. So the .iso format is great for purposes like holding a collection of distribution CDs. But e.g. PlayStation CDs consist normally of more than one track, so an .iso image wouldn't work here.
Burning an .iso file works with the following command:
# cdrecord -v dev=0,0,0 /path/to/the/image.iso
.BIN / .CUE / .TOC Files
The advantage of .bin/.cue image files is that it is a "RAW" copy of the CD. What this means is that every bit (including header and error correction) is copied to the image file. Generation of such a RAW CD copy can easily be done with cdrdao:
# cdrdao read-cd --read-raw --datafile /path/to/image.bin --device ATAPI:0,1,0 --driver generic-mmc-raw /path/to/image.toc
IDE users should use --device ATAPI:0,0,0 (for the first drive, ATAPI:0,1,0 for the second), SCSI users only need to give out the device number (--device 0,3,0). It is also possible to point directly to the device path: --device /dev/cdroms/cdrom1.
Some programs need exactly this information, but formatted in a .cue file. The program bin2iso can be used to get such a .cue file from the image.
# bin2iso /path/to/image.cue -c /path/to/image.bin
The disadvantage of the .bin/.cue format is that it can't be mounted onto the linux filesystem with standard kernels. You need the kernelmodule and program of the cdemu project.
Burning a CD of a .bin file works this way:
# cdrdao write --device ATAPI:0,1,0 /path/to/image.toc