ISO, CDR, and CDRW in Linux


Creating an ISO Image

Here are a couple of different commands for creating an ISO image:

[[email protected] /root]# mkisofs -RJ -o image.iso /burndirectory/
[[email protected] /root]# mkisofs -J -o image.iso /burndirectory

The options (-RJ) will preserve long filenames, casing and Rock Ridge extensions (long mixed-case filenames and symbolic links for *nix).

   -J  Generate Joliet directory records  in  addition  to
       regular iso9660 file names.  This is primarily use­-
       ful when the discs are to be used on Windows-NT  or
       Windows-95  machines.    The  Joliet  filenames are
       specified in Unicode and each path component can be
       up to 64 Unicode characters long.

   -R  Generate  SUSP  and RR records using the Rock Ridge
       protocol to  further  describe  the  files  on  the
       iso9660 filesystem.


Copying a CD to a File on your Filesystem

Here are a couple of mentods for copying a CD to a file:

[[email protected] /root]# dd if=/dev/cdrom of=image.iso
[[email protected] /root]# cat /dev/cdrom >image.iso

More info can be found here: cdimage.html


Buring an ISO Image to CDR or CDRW

[[email protected] /root]# cdrecord -v dev=3,0,0 image.iso


Blanking CDRW Media

Here are a few methods to blank CDRW media:

[[email protected] /root]# cdrecord blank=fast dev=3,0,0
[[email protected] /root]# cdrecord blank=all dev=3,0,0
[[email protected] /root]# cdrecord blank=all -force dev=3,0,0


Copying Directly from One CD to Another

[[email protected] /root]# cdrecord -v dev=3,0,0 -isosize /dev/cdrom

Where the dev designation is the cd burner and /dev/cdrom is your regular cdrom drive.


Verifying an ISO Image or CDR/CDRW

[[email protected] /root]# md5sum
- or -
[[email protected] /root]# diff /dev/cdrom image.iso
- or -
[[email protected] /root]# mount /mnt/cdrom;
[[email protected] /root]# mount -t iso9660 iso.image /mnt/isotest -o loop;
[[email protected] /root]# diff -r /mnt/cdrom /mnt/isotest
- or -
[[email protected] /root]# md5sum /dev/cdrom >md5sum-cdrom.txt
[[email protected] /root]# md5sum image.iso >md5sum-file.txt

#Script to verify the md5sum results:
echo "Verifying MD5SUMS:"
MD5SUM1=md5sum-file.txt
MD5SUM2=md5sum-cdrom.txt
cat $MD5SUM1 | while read CODE NAME; do
     if [ -n "`cat $MD5SUM2 | grep $CODE`" ]; then
          echo "Success: $NAME"
     else
          echo "Failure: $NAME"
     fi
done


Using an ISO Image without Burning it to CD Media

Mount it via the loop device:

[[email protected] /root]# mkdir /mnt/isotest
[[email protected] /root]# mount -t iso9660 /dev/cdrom /mnt/isotest -o loop
[[email protected] /root]# ls /mnt/isotest

More Info:
loop.html
cdimage.html


Setting up your system to work with cdrecord

Before performing the entries mentioned for /etc/modules.conf, try just adding the following line to the global section of /etc/lilo.conf:

append=”hda=ide-scsi”

Then run /sbin/lilo, reboot, then run cdrecord -scanbus to see if your CDRW is detected:

[[email protected] /root]# /sbin/lilo
[[email protected] /root]# shutdown -r now
...
[[email protected] /root]# cdrecord -scanbus

If the above doesn’t work, then you may need to complete the following steps:

Red Hat 7.1 (and probably 6.2 and 7.0) should already have a kernel that is ready to work with cdrecord. You probably need to add some or all of the following entries into /etc/modules.conf (or /etc/conf.modules):

options ide-cd ignore=hda            # tell the ide-cd module to ignore hdb
#alias scd0 sr_mod                    # load sr_mod upon access of scd0
alias scd0 ide-scsi                    # load sr_mod upon access of scd0
#pre-install ide-scsi modprobe imm    # uncomment for some ZIP drives only
pre-install sg     modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd   before ide-scsi

Script for checking out your system: cdre_sh.txt


Finding your CDR or CDRW drive

[[email protected] /root]# cdrecord -scanbus

Leave a Comment