http://www.tldp.org/HOWTO/CD-Writing-HOWTO.html

These instructions currently list only OpenBSD filesystem paths such as
the CDRW devices...

--------------------------------------------------------------------------------

CDR Quick Reference (cdrecord)

cdrecord
	-v			increment general verbose level by one
	-v -v			increment general verbose level by two
	blank=fast		blank a CDRW disc
	speed=2			set speed of drive
	dev=0,6,0
	dev=$SCSI_BUS,$SCSI_ID,$SCSI_LUN
	dev=/dev/rcd0c:0,0,0
	-data cd_image.iso	Subsequent tracks are CD-ROM data mode 1 - 2048 bytes (default)
	-dummy			do everything with laser turned off
	-silent,-s		do not print status of failed SCSI commands

driveropts=burnproof

cdrecord dev=/dev/rcd0c driveropts=help -checkdrive
cdrecord dev=/dev/rcd0c       blank=fast
cdrecord dev=/dev/rcd0c:0,0,0 blank=fast
cdrecord dev=/dev/rcd0c speed=4 -sao -s -data x.iso

--------------------------------------------------------------------------------

CDR Command line utilities

One of the following packages are required to generate images of CD-Rs
(only required for data CD-ROMs):
	ftp://tsx-11.mit.edu/pub/linux/packages/mkisofs/ (mkisofs)
	ftp://ftp.ge.ucl.ac.uk/pub/mkhfs (mkhybrid) 
To write images to the CD-R, you need one of the following software packages: 
	ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ (cdrecord)
	http://www.ping.de/sites/daneb/cdrdao.html (cdrdao)
	http://www.munich-vision.de/vcd/ (mkvcdfs)

OpenBSD Packages Available (listed)
	cdrchive-1.0.1.tgz
	cdrdao-1.2.0.tgz
	cdrtools-2.01.tgz
	xcdroast-0.98a15p1.tgz

--------------------------------------------------------------------------------

OpenBSD CDR Information

Get some information about the CD-ROM device with disklabel:

	disklabel cd0

All iso9660 CDs have 2048 bytes per sector (I think), the total sectors is
what we want here. So now we can do this...

	dd if=/dev/rcd0c of=image.raw bs=2048 count=112026

	cdrecord dev=/dev/rcd0c:0,0,0 speed=10 image.raw

	cdrecord dev=/dev/rcd0c:0,0,0 blank=all speed=10

Notice where it says "...Drive needs to "reload media"...
It ejects the CD and closes it at that point to "return to proper status".

----------

Install Tools:
	pkg_add ftp://openbsd.mirrors.pair.com/3.8/packages/i386/cdrtools-2.01.tgz

Check if CDROM drive can write CDRs:
	cdrecord dev=/dev/rcd0c driveropts=help -checkdrive

use mkisofs to master your volume:
	mkisofs -o myfirst.iso file1 file2 file3

Write the ISO file:
	cdrecord -v -v dev=/dev/rcd0c -data myfirst.iso

Optionally mount newly written CDROM:
	mount_cd9660 /dev/cd0a /mnt
	ls -l /mnt
	umount /mnt

On high power systems, you can write on the fly without temporary image:
	mkisofs file1 file2 file3 | cdrecord dev=/dev/rcd0c -data -

--------------------------------------------------------------------------------

The following will tell you to which SCSI device your CD-writer is attached:

	cdrecord -scanbus

	SCSI_BUS=0   # taken from cdrecord -scanbus : "scsibus0:"
	SCSI_ID=6    # taken from cdrecord -scanbus : "TOSHIBA XM-3401"
	SCSI_LUN=0
	cdrecord -v speed=2 dev=$SCSI_BUS,$SCSI_ID,$SCSI_LUN -data cd_image

Same as above, but shorter:

	cdrecord -v speed=2 dev=0,6,0 -data cd_image

If you use cdrecord to overwrite a CD-RW, you must add the option "blank=..."
to erase the old content.

Writing audio CDRs:

	cdrecord -v speed=2 dev=0,6,0 -audio track1.wav track2.wav...


Mixed mode CD-ROMs 

	cdrecord -v dev=0,6,0 -data cd_image -audio track*.cdr

To simulate burning (testing)

Just add the command line switch -dummy when executing cdrecord and the
laser will be kept off. Watch the burning process.

--------------------------------------------------------------------------------

I hear a crack or click sound at the end of the each track.
You have to use disk-at-once mode (DAO) to get rid of the cracks.

You can put any filesystem you like on the CD. But other operating systems
than Linux won't be able to deal with this CD.
Create an empty file of 650MB size (Linux):
	dd if=/dev/zero of="empty_file" bs=1024k count=650
Create an extended-2 filesystem on this file:
	/sbin/mke2fs  -b 2048  empty_file
	empty_file is not a block special device.
	Proceed anyway? (y,n) y
Mount this empty file through the loopback devices:
	mount -t ext2 -o loop=/dev/loop1 empty_file /mnt

To copy audio CDROMs (1:1 copy), you have to use cdrdao or cdda2wav.

Copy data CDROM to image:
	dd if=/dev/scd0 of=cdimage
In case you run into errors, then install a recent version of cdrecord, which
ships a tool called "readcd" (found under misc/). It gives you the same result
as dd, but reads sectors on the CD-ROM several times in case of errors.

--------------------------------------------------------------------------------

How to make bootable CD-ROMs?

You must have an 1.44 MB bootable floppy-disk. Create an exact image of this
floppy-disk by issuing the command:
	dd if=/dev/fd0 of=boot.img bs=18k
Place this floppy image into the directory holding the collection of your
files (or into a subdirectory of it, just as you like). Tell mkisofs about
this file with the option '-b' and also use '-c'. For details read the file
README.eltorito in the mkisofs-distribution.

--------------------------------------------------------------------------------

How to burn over the network?

Usally a file transfer with FTP is fast enough to feed a CD-recorder at
quadruple (4x) speed even over a 10 Mbit ethernet. You can couple the
ftp-client and cdrecord via a fifo. First create a fifo named cdimage:
	mkfifo cdimage
	ftp other.host.org
	get cdimg cdimage
Then treat cdimage like a regular file, i.e. issue the following command:
	cdrecord dev=0,1,0 speed=2 cdimage
Your ftp-client will notice when cdrecord wants to read from the file and will
start transfering data from the ftp-host.

--------------------------------------------------------------------------------

How can this be set up so that a user can burn CDs instead of always
being root? You can add the setuid-bit to the cdrecord-executable.
However, this might be a security risk. Just setting the permissions
on the device files does not help as cdrecord issues privileged commands
via the SCSI generic interfaces.
	which cdrecord
	chown root.root /usr/bin/cdrecord
	chmod 4111 /usr/bin/cdrecord

When cdrecord stops getting input from the pipe, it will finish writing:
	"bru -size=640m -f - | cdrecord dev=0,1,0 speed=2 -"

--------------------------------------------------------------------------------

Install a few cd/dvd recording programs that includes cdrtools, cdrdao,
and dvd+rw-tools.

Set permissions for users on cdrecord and cdrdao:
	chmod 4711 /usr/local/bin/cdrecord
	chmod 4711 /usr/local/bin/cdrdao

Add "vfs.usermount=1" to "/etc/sysctl.conf"

Create an iso of a written cd with "dd":
	dd if=/dev/cd0 of=your_image_file.iso bs=2048

Blank your rewritable with "cdrecord":
	cdrecord -v dev=2,0,0 blank=fast

Burn ISO:
	cdrecord -v dev=2,0,0 your_image_file.iso