13.5 CD Data

Nautilus provides by far the simplest approach to burning data CDs. See Section ?? for details.

The command line alternative is also quite simple and is covered in the following sections. The first will build an image of the CD ready to burn, and then show the command to burn to CD. The second will also build an image but will directly burn it to the CD.

13.5.1 Intermediate Image

The first step is perhaps to copy all of the files you wish to burn to CD into a single directory, perhaps /home/kayon/cdimage/. Then create the iso9660 CD image with:

  $ cd /home/kayon
  $ mkisofs -r -o cdimage.raw cdimage

The file cdimage.raw will be created in /home/kayon. You could now check that it looks okay by mounting the file as a file system (you usually need to be root to do this):

  $ sudo mount -t iso9660 -o ro,loop=/dev/loop/0 cdimage.raw /mnt
  $ ls /mnt
  $ sudo umount /mnt

Now write the image to a CD. Here’s some alternatives for a number of systems I use:

  $ cdrecord -data cdimage.raw

(No device is specified, assuming it is specified appropriately in /etc/default/cdrecord as /dev/cdrom.)

If you are writing to a CD-RW be sure to blank the CD first with:

  $ cdrecord -blank=fast

13.5.2 No Intermediate Image

The output of mkisofs can be fed directly into cdrecord if the CPU is fast enough (better than 400MHz).

The first step is to determine the image size:

  # IMG_SIZE=$(mkisofs -R -q -print-size /home 2>&1 | sed -e "s/.* = //")
  # echo $IMG_SIZE

Then write the data CD:

  # [ "0$IMG_SIZE" -ne 0 ] &&
  $ mkisofs -r /home |
    cdrecord tsize=${IMG_SIZE}s -data -

13.5.3 Direct Copy Data CD from /dev/cdrom to SCSI burner

This works for Alpine, Mint and Festival and only for root (unless cdrecord is configured to install setuid), by default.

  # cdrecord -v dev=1,1,0 speed=8 -isosize /dev/cdrom   (Alpine)
  # cdrecord -v dev=0,1,0 speed=8 -isosize /dev/cdrom   (Mint)
  # cdrecord -v dev=0,0,0 speed=16 -isosize /dev/cdrom   (Festival)

13.5.4 Copy Video CD

To copy a Video CD (these use audio CD disks—the common CD-R) the following should do the trick:

  $ cdrdao read-cd --paranoia-mode 2 --read-raw data.toc

To then write it to another CD-R:

  $ cdrdao write data.toc

There are other tools including readvcd, vcdimager, and vcdgear.



Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.