HOW TO WRITE CDRs AND CDRWs

@(#) $Header: $


The command to create a CD image file is

  mkisofs -A "Disk Title" -publisher "Publisher info" -r -d -l -allow-leading-dots -o <file.cd> <sourcedirs> 

Where < file.cd> is the file we are creating. This file is a CD image. And where < sourcedirs> is one or more directories that will be copied into the CD image file.

You should fill in useful info where I have placed the fillers "Disk Title" and "Publisher info". The latter is a good place for a copyright notice. Or you could put the date.

Optional Step

You can mount the resulting CD image as a readable filesystem

  sudo mount -t iso9660 -o ro,loop=/dev/loop0 < file.cd> < mountpoint>

And to actually write the CD onto a CDR or virgin CDRW use the following. My CDRW drive writes at 4x, so I use speed=4.

  sudo cdrecord -v -multi speed=4 -data < file.cd>

Optional Step

To write a second session to the same CDR

  mkisofs -C $(sudo cdrecord -msinfo) -r -d -l -L -o < file.cd> < sourcedirs>
  sudo cdrecord -v -multi speed=4 -data < file.cd>

There is an option to cdrecord to finish off a multi session CDR. But I have never seen a reason why you would want to do that. The CDs seem to be every bit as readable without that step.


Alternate Approach

It is possible to pipe the output of mkisofs into cdrecord. This can be useful if you are short on disk space. The down side is that there is an increased chance that the cdrecord session will fail when the fifo buffer empties. I have used this piping method several times without trouble. Your mileage may vary.

  mkisofs -A "Disk Title" -P "Publisher info" -r -d -l -L < sourcedirs> |
    sudo cdrecord -v -multi speed=4 -data -

You can erase a CDRW disk and then rewrite it. As far as I can tell you have to do the erase as a separate step. At that point you treat the CDRW disk just like a CDR disk, writing new material onto it. To erase a disk:

  sudo cdrecord -v -blank=all speed=4

Last modified 10 Dec 2006
http://brown.armoredpenguin.com/~abrown/contact.html
http://brown.armoredpenguin.com/~abrown/Linux/HOWTO-cdrw-write.html