6. Using the cd writer for the first time

6.1. Configuring cdrecord

Use cdrecord -scanbus to check the SCSI id of your cd writer on the SCSI bus. If there are no other "SCSI" devices, the SCSI id should be 0,0,0.

athlon:/home/chris# cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Using libscg version 'schily-0.5'
scsibus0:
	0,0,0	  0) 'PHILIPS ' 'CDRW1610A       ' 'P1.4' Removable CD-ROM
	0,1,0	  1) *
	0,2,0	  2) *
	0,3,0	  3) *
	0,4,0	  4) *
	0,5,0	  5) *
	0,6,0	  6) *
	0,7,0	  7) *

You need this information when you edit /etc/default/cdrecord. The /etc/default/cdrecord file contains defaults that are used if no command line option or environment are present.

athlon:/home/chris# emacs /etc/default/cdrecord

This is the listing of etc/default/cdrecord for my 8x speed Philips CDRW1610A with a 2MB buffer. (I have been conservative here. The drive reports 8MB, but the packaging states 2MB. The drive is advertised to write at 10x, but has been measured at 8x by "Roxio Easy CD Creator" in Windows 98.)

# The default device, if not specified elsewhere
#
CDR_DEVICE=philips

# 
# The default speed, if not specified elsewhere
#
CDR_SPEED=8

# 
# The default FIFO size if, not specified elsewhere
#
CDR_FIFOSIZE=2m

#
# The following definitions allow abstract device names.
# They are used if the device name does not contain the
# the characters ',', ':', '/' and '@'
#
# drive name	device	speed	fifosize driveropts
#
philips=		0,0,0	8	2	""

Save the file and exit using these commands:

<F10> f s
<F10> f e

6.2. Testing the cd (re-)writer

Put a non-blank data CD in the drive to test that you can read from the drive. Enter the following command, substituting for the SCSI id "0,0,0" if necessary:

athlon:/home/chris# cdrecord dev=0,0,0 -v -toc | more

This command prints the table of contents to the screen. The first few lines should look something like this:

Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
TOC Type: 1 = CD-ROM
Using libscg version 'schily-0.5'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 1
Vendor_info    : 'PHILIPS '
Identifikation : 'CDRW1610A       '
Revision       : 'P1.4'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).

6.3. Making your CD (re-)writer available as a device

If the CD (re)writer is your only CDROM drive, you need to make it available as "/dev/cdrom". Then you will be able to read your distribution CDs again. If it is your second CDROM drive, you need to make it available as a different device, for example "/dev/cdrw".

6.3.1. Making the CD (re-)writer available as the only CDROM drive

Skip this section if your CD (re)writer is your second CDROM drive, and go on to making a second CDROM drive available

You need to get rid of the current (non-functional) ide "/dev/cdrom", and replace it with a symlink to the emulated SCSI "/dev/scd0".

athlon:/home/chris# cd /dev

Rename "cdrom" rather than deleting it.

athlon:/dev# mv cdrom cdrom.old

Create the symlink to "scd0".

athlon:/dev# ln -s scd0 cdrom

That's it! Now test that you can read from /cdrom again. Put a data CD in the drive. Then:

athlon:/dev# mount /cdrom
athlon:/dev# ls /cdrom
athlon:/dev# umount /cdrom

6.3.2. Making the CD (re-)writer available as an additional CDROM drive available

Skip this section if your CD (re)writer is your only CDROM drive. You should have carried out the instructions for making a single CDROM drive available. You need to create a new device ("/dev/cdrw", for example), and create a symlink to the emulated SCSI device "/dev/scd0".

athlon:/home/chris# cd /dev

Create the symlink to "scd0".

athlon:/dev# ln -s scd0 cdrw

The symlink does not point to anything yet. You need to set up a directory for the mount point:

athlon:/dev# cd /
athlon:/# mkdir cdrw

Now modify /etc/fstab:

athlon:/# emacs /etc/fstab

Look for the existing cdrom line:

/dev/cdrom	/cdrom		iso9660	ro,user,noauto		0	0

Add a line for cdrw underneath using identical parameters.

/dev/cdrw	/cdrw		iso9660	ro,user,noauto		0	0

Your fstab should look something like this:

# /etc/fstab: static file system information.
#
# <file system>	 <mount point>	 <type>	 <options>		 <dump>	 <pass>
/dev/hda7	/		ext2	errors=remount-ro	0	1
/dev/hda6	none		swap	sw			0	0
proc		/proc		proc	defaults		0	0
/dev/fd0	/floppy		auto	user,noauto		0	0
/dev/cdrom	/cdrom		iso9660	ro,user,noauto		0	0
/dev/cdrw	/cdrw		iso9660	ro,user,noauto		0	0

That's it! Now test that you can read from /cdrom and /cdrw. Put a data CD in each drive in turn. Then:

athlon:/# mount /cdrom
athlon:/# ls /cdrom
athlon:/# umount /cdrom

athlon:/# mount /cdrw
athlon:/# ls /cdrw
athlon:/# umount /cdrw

6.4. Burning a test CD

Now the moment of truth. Put a blank CD-R in the drive. Make an image of, for example, your home directory with mkisofs. Save the image file to /tmp since you do not want to keep it beyond the current session. Then burn the image onto the CD-R using cdrecord.

athlon:/# cd /tmp
athlon:/tmp# mkisofs -r -o home-dir.img /home/chris/

This may take a little while, depending on the amount of data to be imaged.

athlon:/tmp# cdrecord dev=0,0,0 -v -data home-dir.img

This may also take a little while. When the burn has finished, mount the the new CD and check its contents with ls.

athlon:/tmp# mount /cdrom
athlon:/tmp# ls /cdrom
athlon:/tmp# umount /cdrom

Congratulations! You have now (hopefully) made a backup copy of your home directory on CD. You are now ready to add a front end for X.