Linux Burn CD from Command Line with genisoimage and wodim

By | 2011/08/31

Burning to CD from the command line is easy with genisoimage and wodim. I’ll show you how!


On Debian/Ubuntu, install these:

$ sudo apt-get install genisoimage wodim

1. Create iso image with genisoimage

To first make an iso image of a directory, do this:

$ genisoimage -r -J -o stuff.iso /mydirectory

(tack r adds Rock Ridge extensions, tack J for Joliet extensions for Windows)

Output looks something like this:

stmiller@brahms:~/Downloads$ genisoimage -r -J -o test.iso tmp3
I: -input-charset not specified, using utf-8 (detected in locale settings)
Using IMG_2000.JPG;1 for  /IMG_20110827_155357.jpg (IMG_20110827_155402.jpg)
Using IMG_2001.JPG;1 for  /IMG_20110827_155402.jpg (IMG_20110827_155444.jpg)
Using IMG_2002.JPG;1 for  /IMG_20110827_155444.jpg (IMG_20110827_155718.jpg)
Using IMG_2003.JPG;1 for  /IMG_20110827_155718.jpg (IMG_20110827_155947.jpg)
Using IMG_2004.JPG;1 for  /IMG_20110827_155947.jpg (IMG_20110827_155151.jpg)
Using IMG_2005.JPG;1 for  /IMG_20110827_155151.jpg (IMG_20110827_155924.jpg)
Using IMG_2006.JPG;1 for  /IMG_20110827_155924.jpg (IMG_20110827_155422.jpg)
Using IMG_2007.JPG;1 for  /IMG_20110827_155422.jpg (IMG_20110827_155159.jpg)
Using IMG_2008.JPG;1 for  /IMG_20110827_155159.jpg (IMG_20110827_155940.jpg)
Using IMG_2009.JPG;1 for  /IMG_20110827_155940.jpg (IMG_20110827_155722.jpg)
Using IMG_200A.JPG;1 for  /IMG_20110827_155722.jpg (IMG_20110827_155732.jpg)
Using IMG_200B.JPG;1 for  /IMG_20110827_155732.jpg (IMG_20110827_160116.jpg)
Using IMG_200C.JPG;1 for  /IMG_20110827_160116.jpg (IMG_20110827_160109.jpg)
Using IMG_200D.JPG;1 for  /IMG_20110827_160109.jpg (IMG_20110827_160123.jpg)
Using IMG_200E.JPG;1 for  /IMG_20110827_160123.jpg (IMG_20110827_155411.jpg)
Using IMG_200F.JPG;1 for  /IMG_20110827_155411.jpg (IMG_20110827_155205.jpg)
Using IMG_200G.JPG;1 for  /IMG_20110827_155205.jpg (IMG_20110827_155824.jpg)
Using IMG_200H.JPG;1 for  /IMG_20110827_155824.jpg (IMG_20110827_155951.jpg)
Using IMG_200I.JPG;1 for  /IMG_20110827_155951.jpg (IMG_20110827_160103.jpg)
Using IMG_200J.JPG;1 for  /IMG_20110827_160103.jpg (IMG_20110827_155829.jpg)
Using IMG_200K.JPG;1 for  /IMG_20110827_155829.jpg (IMG_20110827_155931.jpg)
Using IMG_200L.JPG;1 for  /IMG_20110827_155931.jpg (IMG_20110827_155522.jpg)
Using IMG_200M.JPG;1 for  /IMG_20110827_155522.jpg (IMG_20110827_155407.jpg)
Using IMG_200N.JPG;1 for  /IMG_20110827_155407.jpg (IMG_20110827_155452.jpg)
Using IMG_200O.JPG;1 for  /IMG_20110827_155452.jpg (IMG_20110827_160100.jpg)
Using IMG_200P.JPG;1 for  /IMG_20110827_160100.jpg (IMG_20110827_155658.jpg)
Using IMG_200Q.JPG;1 for  /IMG_20110827_155658.jpg (IMG_20110827_155122.jpg)
Using IMG_200R.JPG;1 for  /IMG_20110827_155122.jpg (IMG_20110827_155352.jpg)
Using IMG_200S.JPG;1 for  /IMG_20110827_155352.jpg (IMG_20110827_155928.jpg)
  7.48% done, estimate finish Wed Aug 31 20:17:26 2011
 14.92% done, estimate finish Wed Aug 31 20:17:26 2011
 22.38% done, estimate finish Wed Aug 31 20:17:26 2011
 29.85% done, estimate finish Wed Aug 31 20:17:29 2011
 37.30% done, estimate finish Wed Aug 31 20:17:28 2011
 44.77% done, estimate finish Wed Aug 31 20:17:28 2011
 52.22% done, estimate finish Wed Aug 31 20:17:27 2011
 59.69% done, estimate finish Wed Aug 31 20:17:27 2011
 67.13% done, estimate finish Wed Aug 31 20:17:27 2011
 74.60% done, estimate finish Wed Aug 31 20:17:27 2011
 82.05% done, estimate finish Wed Aug 31 20:17:27 2011
 89.52% done, estimate finish Wed Aug 31 20:17:28 2011
 96.97% done, estimate finish Wed Aug 31 20:17:28 2011
Total translation table size: 0
Total rockridge attributes bytes: 3114
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
67034 extents written (130 MB)


2. Burn iso image with wodim

(Note! Ubuntu and other distros automount discs which can get in the way. I suggest disabling automounting of media before continuing. See this post for help!)

First run the following to poll your disc burning devices present:

$ wodim --devices

Outputs:

wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/scd0'	rwrw-- : 'ASUS' 'DRW-24B1ST'
-------------------------------------------------------------------------

And now burn to disc:

$ wodim -eject dev=/dev/scd0 -v -data /path/to/stuff.iso

And here is the example output you will see:

stmiller@brahms:~/Downloads$ wodim -eject dev=/dev/scd0 -v -data test.iso 
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/scd0'
devname: '/dev/scd0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'ASUS    '
Identification : 'DRW-24B1ST      '
Revision       : '1.01'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x002B (DVD+R/DL) 
Profile: 0x001B (DVD+R) 
Profile: 0x001A (DVD+RW) 
Profile: 0x0016 (DVD-R/DL layer jump recording) 
Profile: 0x0015 (DVD-R/DL sequential recording) 
Profile: 0x0014 (DVD-RW sequential recording) 
Profile: 0x0013 (DVD-RW restricted overwrite) 
Profile: 0x0012 (DVD-RAM) 
Profile: 0x0011 (DVD-R sequential recording) 
Profile: 0x0010 (DVD-ROM) 
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R) 
Profile: 0x0008 (CD-ROM) 
Profile: 0x0002 (Removable disk) 
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED 
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1275648 = 1245 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size      : 12582912 = 12288 KB
Track 01: data   130 MB        
Total size:      150 MB (14:53.81) = 67036 sectors
Lout start:      150 MB (14:55/61) = 67036 sectors
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 3
  Reference speed: 6
  Is not unrestricted
  Is erasable
  Disk sub type: High speed Rewritable (CAV) media (1)
  ATIP start of lead in:  -11635 (97:26/65)
  ATIP start of lead out: 359849 (79:59/74)
  1T speed low:  4 1T speed high: 10
  2T speed low:  4 2T speed high:  0 (reserved val  6)
  power mult factor: 1 5
  recommended erase/write power: 3
  A1 values: 24 1A BC
  A2 values: 26 B2 26
Disk type:    Phase change
Manuf. index: 3
Manufacturer: CMC Magnetics Corporation
Blocks total: 359849 Blocks current: 359849 Blocks remaining: 292813
Forcespeed is OFF.
Speed set to 1765 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 in    0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Performing OPC...
Starting new track at sector: 0
Track 01:  130 of  130 MB written (fifo 100%) [buf 100%]  10.3x.
Track 01: Total bytes read/written: 137285632/137285632 (67034 sectors).
Writing  time:   92.749s
Average write speed   9.6x.
Min drive buffer fill was 100%
Fixating...
Fixating time:   33.083s
BURN-Free was never needed.
wodim: fifo had 2163 puts and 2163 gets.
wodim: fifo was 0 times empty and 1960 times full, min fill was 95%.


Erase CDRW

wodim can also black cdrw discs:

$ wodim -vv dev=/dev/scd0 blank=all

Output looks like this:

stmiller@brahms:~$ wodim -vv dev=/dev/scd0 blank=all
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/scd0'
devname: '/dev/scd0'
scsibus: -2 target: -2 lun: -2
Error trying to open /dev/scd0 exclusively (Device or resource busy)... retrying in 1 second.
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
Using libusal version 'Cdrkit-1.1.11'.
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'ASUS    '
Identification : 'DRW-24B1ST      '
Revision       : '1.01'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x002B (DVD+R/DL) 
Profile: 0x001B (DVD+R) 
Profile: 0x001A (DVD+RW) 
Profile: 0x0016 (DVD-R/DL layer jump recording) 
Profile: 0x0015 (DVD-R/DL sequential recording) 
Profile: 0x0014 (DVD-RW sequential recording) 
Profile: 0x0013 (DVD-RW restricted overwrite) 
Profile: 0x0012 (DVD-RAM) 
Profile: 0x0011 (DVD-R sequential recording) 
Profile: 0x0010 (DVD-ROM) 
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R) 
Profile: 0x0008 (CD-ROM) 
Profile: 0x0002 (Removable disk) 
Supported CD-RW media types: 0F
Drive current speed: 10
Drive default speed: 10
Drive max speed    : 10
Selected speed     : 10
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED 
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1275648 = 1245 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
 01 00 00 01 00 00 00 00
 01 AA 01 01 00 00 00 00
Track 1 start -150
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 3
  Reference speed: 6
  Is not unrestricted
  Is erasable
  Disk sub type: High speed Rewritable (CAV) media (1)
  ATIP start of lead in:  -11635 (97:26/65)
  ATIP start of lead out: 359849 (79:59/74)
  1T speed low:  4 1T speed high: 10
  2T speed low:  4 2T speed high:  0 (reserved val  6)
  power mult factor: 1 5
  recommended erase/write power: 3
  A1 values: 24 1A BC
  A2 values: 26 B2 26
Disk type:    Phase change
Manuf. index: 3
Manufacturer: CMC Magnetics Corporation
Forcespeed is OFF.
Speed set to 1765 KB/s
Starting to write CD/DVD at speed  10.0 in real BLANK mode for single session.
Last chance to quit, starting real write in    0 seconds. Operation starts.
Performing OPC...
Blanking entire disk
Blanking time:  506.292s

Sweet!

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.