November 21, 2006

Burning CDs in Linux Unix

Some very basic cd burning commands. Non GUI, just command line.

cdrecord - record audio or data Compact Disks or Digital Versatile Disks from a master

Let's say you have a folder with files you want to backup by burning them to a CD or DVD.
First out would be to make an iso file of the files in the folder.
Example:

$ mkisofs -r -o filename.iso folder_to_make_iso_of
(filename.iso is the iso file you will burn in the next step)
Output, something similar to this

$ mkisofs -r -o wpa.iso wpa
INFO: UTF-8 character encoding detected by locale settings.
Assuming UTF-8 encoded filenames on source filesystem,
use -input-charset to override.
Using WPA_S000.TGZ;1 for /wpa_supplicant-0.4.9.tar.gz (wpa_supplicant-0.3.11.tar.gz)
Using DRIVE000.C;1 for wpa/wpa_supplicant-0.4.9/driver_bsd.c (driver_broadcom.c)
Using DRIVE001.C;1 for wpa/wpa_supplicant-0.4.9/driver_ndis.c (driver_ndis_.c)
Using DRIVE002.C;1 for wpa/wpa_supplicant-0.4.9/driver_ndis_.c (driver_ndiswrapper.c)
Using L2_PA000.C;1 for wpa/wpa_supplicant-0.4.9/l2_packet_freebsd.c (l2_packet_pcap.c)
Using WPA_S000.H;1 for wpa/wpa_supplicant-0.4.9/wpa_supplicant_i.h (wpa_supplicant.h)
Using DRIVE003.C;1 for wpa/wpa_supplicant-0.4.9/driver_wext.c (driver_wired.c)
Using L2_PA001.C;1 for wpa/wpa_supplicant-0.4.9/l2_packet_pcap.c (l2_packet_linux.c)
Using WPA_S000.SGM;1 for wpa/wpa_supplicant-0.4.9/doc/docbook/wpa_supplicant.conf.sgml (wpa_supplicant.sgml)
Total translation table size: 0
Total rockridge attributes bytes: 17015
Total directory bytes: 30720
Path table size(bytes): 104
Max brk space used 21000
1702 extents written (3 MB)



$ su - (switch to user root)
# cdrecord filename.iso
Example:

# cdrecord wpa.iso
cdrecord: No write mode specified.
cdrecord: Asuming -tao mode.
cdrecord: Future versions of cdrecord may have different drive dependent defaults.
cdrecord: Continuing in 5 seconds...
Cdrecord-Clone 2.01.01a03-dvd (i686-pc-linux-gnu) Copyright (C) 1995-2005 Jörg Schilling
NOTE: This version contains the OSS DVD extensions for cdrtools and thus may
have bugs related to DVD issues that are not present in the original
cdrtools. Please send bug reports or support requests to
http://bugzilla.redhat.com/bugzilla The original cdrtools author should
not be bothered with problems in this version.
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.85-RH '@(#)scsi-linux-sg.c 1.85 05/05/16 Copyright 1997 J. Schilling').
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'SONY '
Identifikation : 'DVD+-RW DW-Q58A '
Revision : 'UDS1'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Speed set to 1764 KB/s
Starting to write CD/DVD at speed 10.0 in real TAO mode for single session.
Last chance to quit, starting real write 4 seconds.

trackno=0
Track 01: Total bytes read/written: 3485696/3485696 (1702 sectors).


That's it!

For troubleshooting, try the --scanbus option and specify the device if you have more than one on your scsibus.

# cdrecord --scanbus (the --scanbus option, scsibus, target, lun)

Cdrecord has many options. See manpage.
$ man cdrecord

If you need to make your iso file bootable, look at the manual for mkisofs. (Several options)
$ man mkisofs
(This should not be needed if you have downloaded a live cd or a Unix Linux distribution. You should only need to burn the iso file, as is.)