CDR on Linux

Using “cdrdao”

For reading
cdrdao read-cd –source-device /dev/sg0 –device /dev/sg0 –driver generic-mmc
–datafile /test/tour_images/image_1/part_one.dat /test/tour_images/image_1/part_one.toc
or for atapi address for source
cdrdao read-cd –source-device ATAPI:0,0,0 –device ATAPI:0,0,0 –driver generic-mmc
–datafile /tmp/tante.dat /tmp/tante.toc

For writing
cdrdao write –device /dev/sg0 –driver generic-mmc /test/tour_images/image_1/part_one.toc
would be same with ATAPI:0,0,0 for atapi
cdrdao write –device ATAPI:0,0,0 –driver generic-mmc /test/tour_images/image_1/part_one.toc

using “cdrrecord” to burn iso image to cdr

This was taken from a backup scrip that copies a bunch of directories and files, creates an ISO images from them then writes a CDR (or a CRDW).
#!/bin/bash

# the iso file
ISO_PATH=/mnt/backup/
ISO=$ISO_PATH/backup.iso

# CDR parameters BLANK only applies to CDRWs
SPEED=4
DEV=0,0,0
BLANK=fast

# …
# backup functionality goes here. In my case it copies a lot of stuff to a mount called backup.
# …

# prompt the user, read and wait for a response before continuing
echo -n “Insert a CD-RW and hit enter. This disc will be erased.”

read

# Now write to a CD-RW disc
echo -n “Writing backup…”
# lines for CDR one for CDRW that needs a blank before write
# using su as my drive’s permissions is set to only allow root to write to it
# you can remove su (e.g. “cdrecord -v dev=$DEV speed=$SPEED -data $ISO” )
#su - -c “cdrecord -v dev=$DEV blank=$BLANK speed=$SPEED -data $ISO”
su - -c “cdrecord -v dev=$DEV speed=$SPEED -data $ISO”

#eject the disc when finished
eject

echo “****************************************”
echo “* BURN FINISHED *”
echo “****************************************”
exit 0