Ever been stuck with no CD/DVD burner in a desktop PC, and the only one nearby is in a headless Linux server? The good news is you can SSH into the server and remotely write an ISO file to a CD or DVD.
The package you need to be able to do this is called “wodim” (write optical disk media). The wodim package is used to record data or audio Compact Discs on an Orange Book CD-Recorder or to write DVD media on a DVD-Recorder.
First, install the “wodim” package.
Ubuntu:
sudo apt-get install wodim
Once installed, get the device name for your CD or DVD burner:
wodim --devices
Sample output:
$ wodim --devices wodim: Overview of accessible drives (1 found) : ------------------------------------------------------------------------- 0 dev='/dev/scd0' rwrw-- : 'PIONEER' 'DVD-RW DVR-216' ------------------------------------------------------------------------- $
Burn the ISO file to the specified device:
wodim -v -dev='/dev/scd0' image_file.iso
The ISO file selected will now be burned to the CD/DVD. Ensure a blank CD or DVD is inserted into the burner. The -v option sets the verbose level. The -dev option must match one of the valid devices found in the previous step (–devices).
Sample output from burning the XenServer install ISO:
$ wodim -v -dev='/dev/scd0' XenServer-6.0.0-install-cd.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.10 SCSI buffer size: 64512 Device type : Removable CD-ROM Version : 5 Response Format: 2 Capabilities : Vendor_info : 'PIONEER ' Identification : 'DVD-RW DVR-216 ' Revision : '1.06' Device seems to be: Generic mmc2 DVD-R/DVD-RW. Current: 0x0009 (CD-R) 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: 0x0002 (Removable disk) Profile: 0x0011 (DVD-R sequential recording) Profile: 0x0010 (DVD-ROM) Profile: 0x000A (CD-RW) Profile: 0x0009 (CD-R) (current) Profile: 0x0008 (CD-ROM) 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 Drive buf size : 1136640 = 1110 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 508 MB Total size: 583 MB (57:51.41) = 260356 sectors Lout start: 584 MB (57:53/31) = 260356 sectors Current Secsize: 2048 ATIP info from disk: Indicated writing power: 5 Is not unrestricted Is not erasable Disk sub type: Medium Type A, high Beta category (A+) (3) ATIP start of lead in: -11634 (97:26/66) ATIP start of lead out: 359846 (79:59/71) Disk type: Short strategy type (Phthalocyanine or similar) Manuf. index: 3 Manufacturer: CMC Magnetics Corporation Blocks total: 359846 Blocks current: 359846 Blocks remaining: 99490 Speed set to 7056 KB/s Starting to write CD/DVD at speed 40.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: 508 of 508 MB written (fifo 100%) [buf 99%] 36.4x. Track 01: Total bytes read/written: 533204992/533204992 (260354 sectors). Writing time: 155.255s Average write speed 25.0x. Min drive buffer fill was 99% Fixating... Fixating time: 18.629s wodim: fifo had 8399 puts and 8399 gets. wodim: fifo was 0 times empty and 6230 times full, min fill was 92%. $
Note: On Ubuntu the command “cdrecord” is a symbolic link to the “wodim” application. The commands above can be run using either “wodim” or “cdrecord”.