CD Howto

(How to read and write CD's)

© (2004) Pablo Arés, pablo /at/

How to read CD's

Reading a CD is a simple task. Here are the steps:

  1. Put the CD in the drive (press the buttom to get the drive open, put the CD inside and press the buttom again to close the drive).
  2. Issue the following command:
       mount /cdrom
  3. Now the files on the CD can be access in the /cdrom directory. You can cd to it and operate as any other normal directory.
  4. Just in case you are in the cdrom directory, give the following command to go back to your home directory:
  5. Now do:
       umount /cdrom
  6. Finally press the buttom to open the drive or do
  7. Remove the CD and press the buttom to close the drive.

How to write CD's

Writing a CD is a litte more complex task. There are several things you have to take into account, and depending on that, you will have to execute (or not) some of the steps below:

Here are the steps. I will write the different options depending on the possibilities above. I will assume that the files you want to write in the CD are in a directory called /cdwrite/myfiles. You can make this directory with the command:
   mkdir /cdwrite/myfiles
and then move/copy there the files you want to write in the CD (the directory /cdwrite is available in the machines with CD writers, and you can always write in that directory).
  1. Change directories with
       cd /cdwrite
  2. Put the CD in the drive (see above).
  3. If your CD has data and you want to preserve it, do the following:
       cdrecord -msinfo dev=0,0,0
    That will produce two number, n,m Write them down since you will need them later.
  4. If your CD is RW and you want to erase the data, do:
       cdrecord blank=gas dev=0,0,0
  5. Make the "image" to be written in the CD, that is the file containing all the files you want to write in the CD. The way to make it depends on whether there is data to be preserved in the CD or not. Here are the two cases:
  6. Finally write the cd with the command:
       cdrecord -multi dev=0,0,0 -eject -data /cdwrite/cd.iso
  7. Get the CD from the drive (it will automatically open when the system finishes writing the CD) and close the drive.
  8. Erase the files you have created:
       rm -fr /cdwrite/myfiles
       rm -f /cdwrite/cd.iso