20070502 burning cds from the command line in linux - plembo/onemoretech GitHub Wiki

title: Burning CD’s from the command-line in Linux link: https://onemoretech.wordpress.com/2007/05/02/burning-cds-from-the-command-line-in-linux/ author: lembobro description: post_id: 718 created: 2007/05/02 13:50:00 created_gmt: 2007/05/02 13:50:00 comment_status: open post_name: burning-cds-from-the-command-line-in-linux status: publish post_type: post

Burning CD’s from the command-line in Linux

Only posting this here so I don’t have to Google for the procedure after senility kicks in (taken from my original personal web site):

As an old DOS hacker, I sometimes find things get done quicker from the command line. In the case of burning CDs or DVDs on Fedora 3, cdrecord is my tool of choice.

Make an ISO image

There are a couple of ways to do this.

To copy an existing disk, do this:

dd if=/dev/hdc of=cdrom.iso bs=2048

To make your own iso, do this:

mkisofs -o /tmp/cdrom.iso -J -r -v /tmp/content

Where “/tmp/content” is the path to a folder containing the files and/or folders you want on the CD (the root of the folder will be the root of the CD). Use -r instead of -R to invoke Rockridge extensions because -r results in better compatibility cross-platform (file permissions, etc are set to more reasonable values).

Test the iso

Test the resulting iso by mounting it:

Create a mountpoint (e.g. “/mnt/loop”) and then:

mount -t iso9660 -o loop=/dev/loop0 /tmp/cdrom.iso /mnt/loop

Find your recorder

To find out where on the bus your recorder resides (you need this to use cdrecord):

cdrecord -scanbus

If you have an IDE burner and its connected to the second controller on the board, you should get a response that ends with something like:

scsibus1:
       1,0,0   100) 'PLEXTOR ' 'CD-R   PX-W5224A' '1.01' Removable CD-ROM
       1,1,0   101) *
       1,2,0   102) *
       1,3,0   103) *
       1,4,0   104) *
       1,5,0   105) *
       1,6,0   106) *
       1,7,0   107) *

The key info here is the “1,0,0” which indicates the drive location. If you’ve got a SATA hard disk, that your system considers a SCSI device, your IDE burner will show up as “0,0,0”.

This command does not work in CentOS/RedHat 5, and apparently other newer distributions. As of yet I haven’t found any satisfactory explaination as to why.

Burn the iso

To have the drive burn your iso image (here we’ll call it “cdrom.iso”):

cdrecord -v dev=ATA:1,0,0 -eject -speed=8 cdrom.iso

The “:ATA” flag lets the program know this is an ATA, not a SCSI, drive. I usually add “-eject” so I’ll know when the burn is done. The “-speed” switch is optional, I use it more out of habit than anything else (slower burns are sometimes less error-prone).

Copyright 2004-2019 Phil Lembo