ISO, CDR, and CDRW in Linux



Creating an ISO Image

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


[root@server /root]# mkisofs -RJ -o image.iso /burndirectory/
[root@server /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:


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

More info can be found here: cdimage.html


Buring an ISO Image to CDR or CDRW


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


Blanking CDRW Media

Here are a few methods to blank CDRW media:


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


Copying Directly from One CD to Another


[root@server /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


[root@server /root]# md5sum
- or -
[root@server /root]# diff /dev/cdrom image.iso
- or -
[root@server /root]# mount /mnt/cdrom;
[root@server /root]# mount -t iso9660 iso.image /mnt/isotest -o loop;
[root@server /root]# diff -r /mnt/cdrom /mnt/isotest
- or -
[root@server /root]# md5sum /dev/cdrom >md5sum-cdrom.txt
[root@server /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:


[root@server /root]# mkdir /mnt/isotest
[root@server /root]# mount -t iso9660 /dev/cdrom /mnt/isotest -o loop
[root@server /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:


[root@server /root]# /sbin/lilo
[root@server /root]# shutdown -r now
...
[root@server /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


[root@server /root]# cdrecord -scanbus

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.