Home

CD-WRITING ON LINUX








Shailendra Trivedi
strivedi@ipr.res.in

A CD Writer, CD burner or CD recorder is an internal or external writable Compact Disc drive that can be attached to a computer. It lets you write and read files from a computer on to compact disc media, and is standard equipment in most new computers. CD-Recordable (CD-R) and CD-Rewritable (CD-RW) are the two most common types of CDs, which can be written on either once (in the case of CD-R) or repeatedly (in the case of CD-RW). The burner describes the process of laser burning the organic dye substrate in the disk, creating a non-reflective pit signifying a bit state.

CD-Writers are available in following three types:

  1. IDE CD-Writers (Internal type): They are fitted inside the computer System just like an internal CD-ROM.

  2. USB CD-Writers (External): This CD-Writers is connected externally to the USB port of the computer system.

  3. SCSI CD-Writers (internal or External): A SCSI card (like VGA/Network card) which can be fitted inside the computer on a SCSI slot and CD-Writer is connected on this card internally or externally

CD-Writers supported by Linux:

The driver for every peripheral connected to the computer must be available on in O/S, without which the connected device would not work. Most new CD-Writers are MMC-compliant and are therefore supported by Linux.

Configuring IDE CD-Writer on Linux

Stepwise procedure to configure an IDE CD-Writer on Linux:

  1. Firstly, perform the physical installation of the new drive just as you would do for any IDE drive. Make sure that the drive jumper is set for master or slave as required. The power cable must be connected and the data cable should have the correct orientation. You need not do any change in the CMOS setup. If writer is connected as a secondary master device on the second IDE cable, it will be recognized as /dev/hdc and if connected as a secondary slave device on the second cable it will be recognized as /dev/hdd.

  2. Boot the machine and login as root. Now to control an IDE CD-Writer drive, your kernel needs to load the ide-scsi emulation driver. You can check for its availability or presence of this driver by running the command

 

# lsmod | grep ide-scsi

 

The result will be the following:

ide-scsi 12208

 

This means that machine has loaded the ide-scsi driver. If not, then type the following command

 

# /sbin/insmod ide-scsi

 

If you are using lilo then put this in lilo.conf as under

 

append="hdc=ide-scsi"

 

type the command

#lilo

 

If you are using grub then put this in grub.conf

 

kernel /boot/vmlinuz-2.4.21-4.EL ro root=LABEL=/ hdc=ide-scsi

 

where "hdc" might be "hdb" or "hdd" depending on where your drive is installed

 

  1. Install cdrecord and mkisofs rpm files. Here are the commands to install software in RedHat.

 

cd /cdrom/RedHat/RPMS

rpm --install cdrecord*

rpm --install mkisofs*

include the path in /etc/profile or by following command

# export PATH=$PATH:/opt/shilly/bin/

  1. If you want to read with the recorder, you will need to add or modify the appropriate line in /etc/fstab so that the drive is addressed through the ide-scsi interface. The following worked for me, but the device name may not be correct for all distributions (/dev/sg0 and /dev/hdc are likely alternatives).

/dev/scd0 /cdrom auto defaults,ro,noauto,user,exec 0 0

 

To let any user read from the CD, you have to set the permissions correctly on /dev/scd0:

#chmod 666 /dev/scd0

 

  1. Reboot the machine and type the command

 

# cdrecord –scanbus

 

The command will display the following result

 

Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jrg Schilling

Linux sg driver version: 3.1.25

Using libscg version 'schily-0.7'

cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.75-RH '@(#)scsi-linux-sg.c 1.75 02/10/21 Copyright 1997 J. Schilling').

scsibus0:

0,0,0 0) 'SONY ' 'CD-RW CRX230ED ' '4YS1' Removable CD-ROM

0,1,0 1) *

0,2,0 2) *

0,3,0 3) *

0,4,0 4) *

0,5,0 5) *

0,6,0 6) *

0,7,0 7) *

 

Congratulations your cdwriter is configured

Writing CD

 

CD-Writing is normally a two step process. First the ISO filesystem (a bit-for-bit image of the CD to be recorded) is to be created on your hard disk:

# mkisofs -v -o file.iso file...

 

where file.iso is your output file and file... is the list of files and directories you want to burn on cd-rom. If you just list a single directory, the structure is maintained on the CD. Otherwise all the files and subdirectory files are dropped into the root directory with no subdirectory structure. There are a lot of options described in the man page. If you keep your filenames to 8.3 lower case, you need not be bothered with most of them. The "-J" option (for Joliet) will allow longer Windows style filenames, but if you actually use longer or case sensitive names your file names will look funny or not work in a minimal ISO9660 system.

 

Then you actually burn the cd using the following command

 

# cdrecord -v dev=0,0,0 file.iso

 

The ``dev=0,0,0'' specifies the output device, and might be different on your system, check the cdrecord -scanbus output if you have doubt. Because cdrecord wants to lock pages in memory, it has to be run as root. Making cdrecord setuserid root is endorsed by the Shilly's documentation. This would allow the non-root users to burn cds. If your cdrecord binary is still in the default location, this will make it 'suid root'

Configuring USB CD-Writer on linux

 

A USB CD-writer has the USB interface to communicate with the device. Linux has modules (program), which support USB devices. USB Devices are well supported by kernel version 2.4 and higher version. USB development is now being done in the 2.6 kernel tree. USB support is available starting with kernel version 2.2.18.

"USB" is an abbreviation of the Universal Serial Bus, which is widely used for peripherals in modern desktop systems. PCs typically support one or more USB controllers (one per "USB bus") each of which can support up to 127 different USB peripherals. "Legacy free" PCs omit non-USB peripheral support (like RS-232 serial lines, and PS/2 ports). Partially excepting the new USB 2.0 "OTG" (OnTheGo) support, USB is asymmetric. For example, its cabling is always asymmetric (even with OTG), so you can't hook things up incorrectly. USB supports "hotplugging" for all its peripherals, which means that you don't have to configure them by hand and that peripherals may rely on power delivered through USB. Both those features help reduce end-user setup and configuration problems, which was a major goal for USB technology.

Today, most USB peripherals and hosts support USB version 1.1, which supports two device speeds: low speed at 1.5 Mbit/sec, and full speed at 12 Mbit/sec. USB 2.0 is appearing in current product designs, and one of its main features is adding a new speed: high speed, at 480 Mbit/sec

 

Stepwise procedure to configure an USB CD-Writer

  1. Append following lines in /etc/modules.conf if not present.


alias usb-controller usb-uhci

alias usb-controller1 ehci-hcd


The above lines load the usb modules to support USB devices.



  1. BOOT the system

  2. Connect the USB CDWriter to USB port of the computer

  3. Run the following command

 

# cdrecord -scanbus

 

It will display the details of Cdwriter, usb device and drivers

 

Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jrg Schilling

Linux sg driver version: 3.1.24

Using libscg version 'schily-0.7'

cdrecord: Warning: using unofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.75-RH '@(#)scsi-linux-sg.c 1.75 02/10/21 Copyright 1997 J. Schilling').

scsibus0:

0,0,0 0) 'LITE-ON ' 'LTR-40125S ' 'ZS0K' Removable CD-ROM

0,1,0 1) *

0,2,0 2) *

0,3,0 3) *

0,4,0 4) *

0,5,0 5) *

0,6,0 6) *

0,7,0 7) *

 

USB cdwriter has been configured. You can use xcdroast software to write cds

 

Writing CD

 

First make an image of files and directory by using the following command

 

# mkisofs -r -o cd_image <directory or filenames>

 

Use the following command to write the CD

 

#cdrecord -v speed=1 dev=0,0,0 cd_image

 

Here one parameter to be noted is “dev=0,0,0”. This shows that the USB device is connected to scsibus0 as mentioned above. This is displayed when cdrecord -scanbus command is given.

 

 

Command to see help

 

# cdrecord -help

# cdrecord -dev=help

# cdrecord -blank=help