CD
CD
CD
CDWriting HOWTO
Table of Contents
CDWriting HOWTO........................................................................................................................................1 Winfried Trmper <[email protected]>..................................................................................................1 1.Introduction...........................................................................................................................................1 2.Setup the Linuxsystem for writing CDROMs..................................................................................1 3.Burning CDRs....................................................................................................................................1 4.Dear Winfried,......................................................................................................................................1 5.Troubleshooting....................................................................................................................................2 6.Credits...................................................................................................................................................2 1.Introduction...........................................................................................................................................2 1.1 Copyright, license and terms of usage...............................................................................................3 1.2 Availability........................................................................................................................................3 1.3 Suggested readings .............................................................................................................................3 1.4 Terminology ... lasers at maximum ... fire!.......................................................................................4 . Adaptor vs. Adapter....................................................................................................................4 1.5 Supported CDwriters.......................................................................................................................4 1.6 Supported "features"..........................................................................................................................6 1.7 Mailing Lists......................................................................................................................................7 2.Setup the Linuxsystem for writing CDROMs..................................................................................8 2.1 Quickstart...........................................................................................................................................9 Special notes about SCSI CDwriters......................................................................................12 Special notes about CDwriters for the parallel port...............................................................12 Compiling missing kernel modules (optional).........................................................................12 . 2.2 Get the user software for burning CDRs.......................................................................................13 Command line utilities..............................................................................................................13 Graphical user interfaces (optional) ..........................................................................................14 3.Burning CDRs..................................................................................................................................15 3.1 Writing CDROMs (pure data).......................................................................................................15 Creating an image of the later CDROM.................................................................................15 Test the CDimage...................................................................................................................16 Write the CDimage to a CD...................................................................................................17 3.2 Writing audio CDs...........................................................................................................................18 Writing audio CDs (TAO)........................................................................................................19 DAO..........................................................................................................................................20 3.3 Mixed mode CDROMs ..................................................................................................................20 4.Dear Winfried,....................................................................................................................................20 4.1 How sensitive is the burning process?.............................................................................................21 4.2 Has file fragmentation a bad impact on the throughput?.................................................................21 4.3 Is it possible to store the CDimage on an UMSDOSfilesystem?................................................21 4.4 Isn't there some way to get around the ISO9660 limitations?.......................................................22 4.5 How to read the tracks from audio CDs?.........................................................................................22 4.6 How to probe for SCSI devices after boot?.....................................................................................23 4.7 Is it possible to make a 1:1 copy of a data CD?...............................................................................23 4.8 Can Linux read Joliet CDROMs? (obsolete answer)....................................................................24 4.9 How do I read/mount CDROMs with the CDwriter? ..................................................................24 4.10 How to put even more data on the CDR?....................................................................................25 4.11 How to make bootable CDROMs?..............................................................................................25 4.12 How to make CDROMs writable like a hard disk?.....................................................................26 i
CDWriting HOWTO
Table of Contents
4.13 Is it possible to use several writers at once?..................................................................................26 4.14 What about Solaris, *BSD, AIX, HPUX, etc.? Is my variant of Unix supported?.....................26 4.15 Where to store the local configuration permanently?....................................................................27 4.16 How can the CDinfo be retrieved?..............................................................................................28 4.17 What about rewriting...................................................................................................................28 4.18 How to create a multisession CD?...............................................................................................28 4.19 Should I use the SCSI adapter shipped with the writer? ................................................................29 4.20 How to burn over the network?.....................................................................................................29 4.21 I hear a crack or click sound at the end of the each track..............................................................30 4.22 How can this be set up so that a user can burn CDs instead of always being root?......................30 4.23 Where do I get the "Yellow Book" and "Orange Book" standards? ..............................................30 4.24 I've been searching for information on burning VideoCD under Linux.....................................30 . 4.25 Which is easier to set up, IDE or SCSI?........................................................................................31 4.26 How can I overburn a CD using {cdrecord,cdrdao}?....................................................................31 4.27 What will cdrecord do when it stops getting input from the pipe?................................................31 4.28 Is there an equivalent to ignore=hdX for the idescsi emulation?................................................31 4.29 How many times can you reuse CDRW before they become faulty?.......................................31 4.30 Which format to choose for a platform independant CDROM?.................................................32 4.31 Is multisession for audio tracks possible?...................................................................................32 4.32 What hardware resources do I need? Is an old Pentium enough? ..................................................32 5.Troubleshooting..................................................................................................................................32 5.1 It doesn't work: under Linux............................................................................................................33 5.2 Errormessage: No read access for 'dev=0,6,0'...............................................................................33 5.3 It doesn't work: under DOS and friends ...........................................................................................33 5.4 SCSI errors during the burning phase..............................................................................................33 5.5 Medium errors If cdrecord reports medium errors in the form of"Sense Key: ... Medium Error, Segment ..." 4 5.6 Newly written CDs are not readable on some players.....................................................................34 5.7 My scanner stopped working after I loaded the idescsi module ....................................................34 6.Credits.................................................................................................................................................35
ii
CDWriting HOWTO
Winfried Trmper <[email protected]>
v2.9.3, 23 July 2000
1.Introduction
1.1 Copyright, license and terms of usage 1.2 Availability 1.3 Suggested readings 1.4 Terminology ... lasers at maximum ... fire! 1.5 Supported CDwriters 1.6 Supported "features" 1.7 Mailing Lists
3.Burning CDRs
3.1 Writing CDROMs (pure data) 3.2 Writing audio CDs 3.3 Mixed mode CDROMs
4.Dear Winfried,...
4.1 How sensitive is the burning process? 4.2 Has file fragmentation a bad impact on the throughput? 4.3 Is it possible to store the CDimage on an UMSDOSfilesystem? 4.4 Isn't there some way to get around the ISO9660 limitations? 4.5 How to read the tracks from audio CDs? 4.6 How to probe for SCSI devices after boot? CDWriting HOWTO 1
CDWriting HOWTO 4.7 Is it possible to make a 1:1 copy of a data CD? 4.8 Can Linux read Joliet CDROMs? (obsolete answer) 4.9 How do I read/mount CDROMs with the CDwriter? 4.10 How to put even more data on the CDR? 4.11 How to make bootable CDROMs? 4.12 How to make CDROMs writable like a hard disk? 4.13 Is it possible to use several writers at once? 4.14 What about Solaris, *BSD, AIX, HPUX, etc.? Is my variant of Unix supported? 4.15 Where to store the local configuration permanently? 4.16 How can the CDinfo be retrieved? 4.17 What about rewriting 4.18 How to create a multisession CD? 4.19 Should I use the SCSI adapter shipped with the writer? 4.20 How to burn over the network? 4.21 I hear a crack or click sound at the end of the each track. 4.22 How can this be set up so that a user can burn CDs instead of always 4.23 Where do I get the "Yellow Book" and "Orange Book" standards? 4.24 I've been searching for information on burning VideoCD under Linux. 4.25 Which is easier to set up, IDE or SCSI? 4.26 How can I overburn a CD using {cdrecord,cdrdao}? 4.27 What will cdrecord do when it stops getting input from the pipe? 4.28 Is there an equivalent to ignore=hdX for the idescsi emulation? 4.29 How many times can you reuse CDRW before they become faulty? 4.30 Which format to choose for a platform independant CDROM? 4.31 Is multisession for audio tracks possible? 4.32 What hardware resources do I need? Is an old Pentium enough?
5.Troubleshooting
5.1 It doesn't work: under Linux 5.2 Errormessage: No read access for 'dev=0,6,0'. 5.3 It doesn't work: under DOS and friends 5.4 SCSI errors during the burning phase 5.5 Medium errors 5.6 Newly written CDs are not readable on some players. 5.7 My scanner stopped working after I loaded the idescsi module
6.Credits 1.Introduction
Many people use Linux to burn CDROMs, because it is reliable and easy. No bluescreens while burning and no headaches about getting the right combination of hard and software. It just works once properly set up. The CDwriting HOWTO explains the setup, how to put data on the media and gives some interesting 5.Troubleshooting 2
1.2 Availability
As the editor of this document I mostly sum up what other people report to me. I'm not a software developer nor an expert in hardware, so for specific problems with hard or software you may want to ask somebody else. What always makes sense is to report solutions for problems not already covered by the HOWTO to me.
I get several hundred emails concerning the CDWriting HOWTO each year. So please be patient with me, as I cannot always answer within hours. However, I read everything immediately and put you on my CDRqueue. Before you ask a question, please make sure you are aware of the newest version of this document; it is always available from http://www.guug.de/~winni/linux/.
CDWriting HOWTO software. As most CDwriters can be used to read CDROMs, too, you may want to read the Linux CDROM HOWTO, the Linux SCSI HOWTO and the Linux Kernel HOWTO.
CDWriting HOWTO out of the HOWTO. Here is a comprehensive summary of drives reported to work with cdrecord:
Acer: BTC: Compro: Creative: Delta: Dysan: Elite: Goldstar: Grundig: Guillemot: HP:
HiVal: Iomega: JVC: Kiss: Kodak: Matsushita: Memorex: Microboards: MicroNet: Mitsubishi: Mitsumi: Nomai: Olympus: Optima: OTI: Panasonic: Philips:
CDRW 4432A, CDRW 6206A, CDR/RW 6X4X32, 8432A BCE 621E (IDE) CW7502, CW7502B MK 4211, RW 4224E, OMEW 141 CRW1622 Elite b444.41 CED8041B CDR 100 IPW Maxi CDR 4X/8X SureStore 4020i, SureStore 6020i, C4324, C4325 CDwriter+ 7100, 7200i, 7500e, 8100i, 8110i, 8200i Plus, 8250i, 9100i, 9110i, 9200e, 9210, 9300i, 9310i CDD 2242, CDD3610, ZIPCD 4x650 XRW 2001, XRW 2010, XRW 2040, XRW 2042, XRRW 2224, YR 2626 CDRW (no model given) PCD 200, PCD 225, PCD 260, PCD 600 matsushita is the japanese name for panasonic, please see there CRW620, CDR622, CRW1622, CRW2224, CDRW4420 PlayWrite 2000, PlayWrite 4000 RW, PlayWrite 4001 RW MasterCD Plus 4x4, MasterCD Plus 4x6 CDRW226 CR2401TS, CR2600 TE, CR2801 TE, CR4801 TE, CR4802 TE, CR4804 TE 680.RW CDS 615E, CDS 620E DisKovery 650 CDR CDRW 965, CDRW 975 (Socrates 1.0) CW7285, CW7502, CW7503, CW7582 CDD521/10, CDD522, CDD2000, CDD2600, CDD3600, CDD3610, CDD 4201 PCA 267cr, PCA 460 RW, PCRW 404, Omniwriter 26, Omniwriter 26A, CDRW800 RCD100, RCD1000, RCD5020, RCD5040 DWS114X CDR 480, CDR 4220, RF4100, RF4102, CDR 4400 CDR PX24 CS, PX412 C, PXR412 C PXR 810Ti, PXR 820T, PXW 4220Ti, PXW 8220T, PXW 8432T Plexwriter RW 4/2/20 PCDR 4 820s RO1420C+, MP 1420C, MP 6200S, MP 6201S, MP 7040A, MP7060A SW204 CRDR24S CDRW 226, CDR 1002, CDR 1002/PRO, CDR 1004, CDR 2004, CDR 2006 PLUS, CDR 2006 PRO, CDRW 2224, CDR 4000, CDR 4006, CDR 4012, CDRW 4424A CDR 8020, CDR 8220 CDRX 100E, CDRX 120E, CDRX 140SRP, CDU 920S, CDU 924, CDU 926S, CDU 928E, CDU 948S EW50 CDR50S, CDR55S, CDR55S, CDR55K,
CDWriting HOWTO
CDR56S400, CDR56S600, R56S614 CRW 2260, CDR 4120, CDR 4120 Pro, CDRW 4260, CDRW 4424, CDR 4800 2040R wt 2036, wt 2444ei CDRW622, CDR632P CDR100, CDR 102, CDR200, CDR200t, CDR200tx CDR400, CDR400c, CDR400t, CDR400tx, CDR400Atx CDW2216E, CRW2260, CRW2260t, CRW4250tx, CRW4260t, CRW4260tx, CRW4261, CRW4416S, CRW6416S, CRW8424E
The detailed list of models which have been reported to work or not to work under various Unixlike operating systems is available online from http://www.guug.de:8080/cgibin/winni/lscorig.pl.
If your hardware isn't supported you can still use Linux to create an image of the CD. You may wish to do so because most burning software for DOS does not deal with RockRidgeextensions (Unixlike filesystems on CDROM). In a second step, you can use DOS or Macintosh software to write the image to the CDR.
Supported Feature cdwrite2.1 cdrecord1.6 cdrdao IDE/ATAPI yes yes yes Parallel Port no yes yes CDRW no yes yes Audio CD yes yes yes Data CDROM yes yes partial Multisession partial yes no TAO (track at once) yes yes yes DAO (disk at once) no partial yes packet writing no no no
Table:
cdwrite is unmaintained software referenced only for completeness. Please use cdrecord instead, as it supports a wider range of hardware and has significantly more features. The main benefit of cdrdao is the ability to create audio CDs without two seconds of silence between the tracks (writing in diskatonce (DAO) mode). The tools classified as "dataformatters" organize the data on the media ("put a filesystem on it").
CDWriting HOWTO
Feature mkisofs mkhybrid mkvcdfs ISO 9660 yes yes no RockRidge yes yes no El Torito yes yes no HFS no yes no Joliet yes yes no Multisession yes yes no CDExtra yes yes no VideoCD no no yes
Table:
The most obvious difference between the ISO 9660 filesystem compared to the ReiserFS or Extended2 filesystem is: you can't modify files once they are written. Other limitations of the ISO9660filesystem include: only 8 levels of subdirectories allowed (counted from the toplevel directory of the CD) maximum length for filenames: 32 characters 650 MB capacity RockRidge is an extension to allow longer filenames and a deeper directory hierarchy for the ISO9660 filesystem. When reading a CDROM with RockRidge extensions under Linux, all the known properties of files like owner, group, permissions, symbolic links appear ("feels like a Unix filesystem"). These extensions are not available when reading the CDROM under DOS or the heterogenous Windowsfamily of operating systems. El Torito can be used to produce bootable CDROMs. For this feature to work, the BIOS of your PC must support it. Roughly speaking, the first 1.44 (or 2.88 if supported) Mbytes of the CDROM contains a floppydisk image supplied by you. This image is treated like a floppy by the BIOS and booted from. (As a consequence, while booting from this virtual floppy, your original drive A: (/dev/fd0) may not be accessible.) HFS lets a Macintosh read the CDROM as if it were an HFS volume (the native filesystem for MacOS). Joliet brings long filenames (among other things) to newer variants of Windows (95, 98, NT). However, the author knows of no tool that allows long filenames under plain DOS or Windows 3.11. VideoCDs can be directly played on DVDdevices. Section 2.8 lists the availability of the mentioned software.
CDWriting HOWTO
shell> cdrecord scanbus Cdrecord release 1.7a1 Copyright (C) 19951998 Jrg Schilling scsibus0: 0,0,0) 'Quantum ' 'XP34300 ' 'F76D' Disk 0,1,0) 'SEAGATE ' 'ST11200N ' '8334' Disk 0,2,0) * 0,3,0) 'TOSHIBA ' 'MK537FB/ ' '6258' Disk 0,4,0) 'WANGTEK ' '5150ES SCSI 36 ' 'ESB6' Removable Tape 0,5,0) 'EXABYTE ' 'EXB850085QUE ' '0428' Removable Tape 0,6,0) 'TOSHIBA ' 'XM3401TASUNSLCD' '3593' Removable CDROM 0,7,0) * scsibus1: 1,0,0) 'Quantum ' 'XP31070W ' 'L912' Disk 1,1,0) * 1,2,0) * 1,3,0) 'TEAC ' 'CDR55S ' '1.0H' Removable CDROM 1,4,0) 'MATSHITA' 'CDR CW7502 ' '4.02' Removable CDROM 1,5,0) * 1,6,0) 'YAMAHA ' 'CDR400t ' '1.0d' Removable CDROM 1,7,0) *
The example was provided by Jrg Schilling and shows a total of four CDwriters. Please note that scanbus also reports other devices, e.g. regular CDROMs and hard disk drives. The last column gives the SCSI description of the device, from which you cannot clearly distinguish ordinary CDROM drives from those with burning capability. But the product identification (middle column) often has hints about the feature in form of a R, R or RW.
CDWriting HOWTO
2.1 Quickstart
This section is an attempt to provide an fast and easy description of the configuration. Not all possible setups are covered, but please go on and try it out anyways. First of all, check the Linux kernel version printed by the command "uname r". It should be something like 2.0.X or 2.2.Y, where X is higher than 36 and Y is higher than 11. If you run older versions or the so called development kernels, you are on your own. Installing a new kernel is as much work as fixing an old one, so I have removed all hints you need for buggy kernels. The listing below shows a set of commands you could start with. The commands create device file entries under /dev unless they already exists.
test `whoami` = 'root' || echo "You must be root to execute the commands." cd /dev/ umask S u=rwx,g=rwx,orwx [ f loop0 ] \ || ./MAKEDEV loop \ || for i in 0 1 2 3 4 5 6 7; do mknod loop$i b 7 $i; done [ f sg0 o f sga ] \ || ./MAKEDEV sg \ || for i in 0 1 2 3 4 5 6 7; do mknod sg$i c 21 $i; done
Hardware access is usally implemented through device files under Linux. So before any other thing you make sure those files do exists in the directory /dev. Still nobody could give me a compelling reason why this has not been automated through techniques like the device filesystem (devfs). The devfs is available for years know, brings a safer (!) and a far clearer naming of devices and makes the device entries appear automatically under /dev. Some prominent people argue devfs is not the perfect solution, but they do not come up with anything better, not even something comparable and last but least nothing available and tested now. Lets start to use devfs, so I can remove the above commands from this document. ( http://www.atnf.CSIRO.AU/~rgooch/linux/kernelpatches.html)
Next thing to ensure is, that the Linux kernel is equiped with the necessary drivers. The following commands check various files for the presence of drivers in the running Linux kernel. Usally the command "cdrecord scanbus" should trigger an automatic loading of all drivers. In case a driver is not present in the kernel afterwards, it is reported and the modularized driver (module) is manually loaded through insmod.
test `whoami` = 'root' || echo "You must be root to execute the commands." cdrecord scanbus > /dev/null if ! (pidof kerneld || test f "/proc/sys/kernel/modprobe"); then echo "Neither kerneld nor kmod are running to automatically load modules". fi report_no_autoload() { echo "Ensure the module $1 is loaded automatically next time." } if test ! f "/proc/scsi/scsi"; then report_no_autoload scsi_mod && insmod scsi_mod
2.1 Quickstart
CDWriting HOWTO
fi if ! grep "^........ sg_" /proc/ksyms > /dev/null; then report_no_autoload sg && insmod sg fi if ! grep "^........ sr_" /proc/ksyms > /dev/null; then report_no_autoload sr_mod && insmod sr_mod fi if ! grep "^........ loop_" /proc/ksyms > /dev/null; then report_no_autoload loop && insmod loop fi if ! grep iso9660 /proc/filesystems > /dev/null; then report_no_autoload iso9660 && insmod iso9660 fi echo "The following is only needed for IDE/ATAPI CDwriters." if ! grep idescsi /proc/ide/drivers > /dev/null; then report_no_autoload idescsi && insmod idescsi fi cdrecord scanbus
Please read the next chapter if insmod complains about missing module files. If you are in text mode (console), the loading of modules may cause some messages to be printed on your screen. If you are in graphics mode (X11, KDE, Gnome), you can recall these messages with the command dmesg. There are several ways to load the modules next time you start up your Linux system:
(1) Put the relevant insmod command into the startup sequence (a shell script named rc.local or equivalent). (2a) Run kerneld or kmod and (2b) configure them in /etc/modules.conf (to be more precise, you configure the utility modprobe, which is called by the daemons)
People with a SCSIwriter can skip the rest of this section, because cdrecord will most likely already detect their hardware. If not, then please send me an email with some information about your setup, so I can improve the section about SCSIwriters. Now to the people with CDwriters for IDE/ATAPI. As written in the previous chapter, you have to load the compatibility driver idescsi. But this driver can only access your CDWriter if no other driver has already done so. In other words, you have to tell the regular IDE driver to leave your CDwriter unrecognized, so the idescsi driver can grab it.
= = = =
0 0 1 1
2.1 Quickstart
10
CDWriting HOWTO The table above shows the relation of device file names and the placing of devices on the IDE busses. The device file name representing your CDWriter has to be passed to the driver in the Linux kernel. Example: hdb=idescsi. Such a setting should be added to lilo.conf or chos.conf if the driver is statically compiled into your kernel, which seems to be the most common setup. If you need to pass more than one parameter to the kernel, then seperate them with spaces (like shown in the chos example). The next two listings show example configurations containing more lines than just the relevant appendline. Please note the append and cmdlineentries are imagespecific (ie. don't add them immediatly at the top).
If the driver for IDE/ATAPI CDROMs is loaded as a module, then the above won't make any difference to you, but make sure you include the optionsline from the next listing. The last three lines of that listing are generally suggested to further automate the loading of the required modules.
options idecd ignore=hdb alias scd0 sr_mod #preinstall idescsi modprobe imm preinstall sg modprobe idescsi preinstall sr_mod modprobe idescsi preinstall idescsi modprobe idecd
# tell the idecd module to ignore hdb # load sr_mod upon access of scd0 # uncomment for some ZIP drives only # load idescsi before sg # load idescsi before sr_mod # load idecd before idescsi
If your CDwriter is the only CDROM attached to your machine, then remember you have to access the CDROM in the writer through the device file /dev/scd where =0,..,8. You may want to change the symbolic name cdrom to point to the new device file name. The listing below shows the command to achieve this with the example scd0.
If your CDwriter and CDROMdrive are two different devices, then don't change the cdrom symlink. 2.1 Quickstart 11
CDWriting HOWTO
Sect. Description Module SCSI IDE PP BLOCK Enhanced IDE/MFM/RLL... Y BLOCK IDE/ATAPI CDROM idecd M BLOCK SCSI emulation support idescsi M BLOCK Loopback device loop M M M PARIDE Parallel port IDE device paride Y/M
12
CDWriting HOWTO
PARIDE Parallel port ATAPI CDROMs PARIDE Parallel port generic ATAPI PARIDE (select a lowlevel driver) SCSI SCSI SCSI SCSI SCSI FS FS SCSI support scsi_mod SCSI CDROM support sr_mod Enable vendorspecific SCSI generic support sg (select a lowlevel driver) ISO 9660 CDROM filesystem Microsoft Joliet cdrom... iso9660 joliet Y/M Y/M Y Y/M Y Y/M Y Y/M Y/M Y Y/M M M Y
Y/M Y
Y/M Y
Y stands for yes and means you should put the beast into the kernel. M stands for module and means you should or must compile this feature as a module. Y/M gives you the option to decide between either (order indicates choices with less potential problems). Empty settings don't need to be modified and not changing them increases the chance that the resulting kernel will work for you (if it did before...). Especially in environments where SCSI and ATAPI devices are mixed, you better build most things as modules. Compiling loopback device is optional. It allows you to test the image before writing it to the media. If you want to be able to read CDROMs, you need support for the ISO 9660 filesystem. This driver automatically includes RockRidge Extensions. The Microsoft Joliet CDROM extensions have to be explicitly added to the ISO 9660 filesystem. In any case, you need a lowlevel driver for your hardware. Lowlevel refers to the driver, which interacts directly with the hardware. For SCSI and the parallel port, there are a lot of lowlevel drivers available. Installing the resulting Linuxkernel is beyond the scope of this HOWTO. Please consult the documentation of your Linuxdistribution. Users of RedHat Linux be aware that you have to compile in the features "Ramdisk support" and "Initial ramdisk". Furthermore, you have to generate a new ramdisk with the new modules by issuing a command like "mkintrd preload idecd initrd2.2.14.img 2.2.14".
ftp://tsx11.mit.edu/pub/linux/packages/mkisofs/ (mkisofs)
13
To write images to the CDR, you need one of the following software packages:
Don't trust the man page of old versions of mkisofs which state you need version 1.5 of cdwrite. Just use cdrecord and you are fine. Please note that newer versions of cdrecord ship with an enhanced version of mkisofs and some extra tools in the subdirectory misc/ (readcd, isosize) not found elsewhere.
http://www.fhmuenchen.de/home/ze/rz/services/projects/xcdroast/e_overview.html
BurnIT is a JAVA frontend to cdrecord, mkisofs and cdda2wav0.95 making it a complete package for burning CDs on the Unix platform. It is available from
http://sunsite.auc.dk/BurnIT/
CDTux is a character based frontend for the programs mkisofs and cdrecord. "It creates an easy to use enviroment for doing almost anything to a CD in full color through the use of the (in)famous NCURSES Library. And it does all this whith an executable of under 75K."
http://www.datadictator.co.za/cdtux/
14
CDWriting HOWTO
3.Burning CDRs
"If to smoke you turn I shall not cease to fiddle while you burn." (Roman emperor Nero about burning his own classicCDs, AD64. He misunderstood it completely and burned Rome down.)
Writing CDROMs consists of two steps under Linux: packaging the desired data (files, music or both) into files with special formats writing the data from the files to the CDR with the utility cdrecord This chapter describes the steps for data and audio CDs in greater detail.
mkisofs
o cd_image `' |
private_collection/ `' |
3.Burning CDRs
15
CDWriting HOWTO
write output to take directory as input
The option 'r' sets the permissions of all files to be public readable on the CD and enables RockRidgeextensions. You probably want to use this option unless you really know what you're doing (hint: without 'r' the mount point gets the permissions of private_collection!). mkisofs will try to map all filenames to the 8.3 format used by DOS to ensure the highest possible compatibility. In case of naming conflicts (different files have the same 8.3 name), numbers are used in the filenames and information about the chosen filename is printed via STDERR (usually the screen). Don't panic: Under Linux you will never see these odd 8.3 filenames because Linux makes use of the Rock Ridge extensions which contain the original file information (permissions, filename, etc.). Remeber do use the Option J (MS Joliet extensions) or use mkhybrid if you want to generate a more Windowsfriendly CDROM. For HFS CDROMS used on the Macintosh, you better read the manpage of mkisofs' bigger sister mkhybrid for details on various options. Now you may wonder why the output of mkisofs is not directly sent to the writer device. There are three reasons: mkisofs knows nothing about driving CDwriters. You may want to test the image before burning it. On slow machines it would not be reliable (see section 4.). There is a method to write a CDR in one go, which will be described below. One also could think of creating an extra partition and writing the image to that partition instead to a file. I vote against such a strategy because if you write to the wrong partition due to a typo, you can lose your complete Linux system. Read: that happened to me... Furthermore, it is a waste of disk space because the CDimage is temporary data that can be deleted after writing the CD. However, using raw partitions saves you the time for deleting files of 650 MB size.
Now you can inspect the files under /cdrom they appear exactly as they were on a real CD. To umount the CDimage, just say umount /cdrom. (Warning: On Linux kernels prior to 2.0.31 the last file on Test the CDimage 16
CDWriting HOWTO /cdrom may not be fully readable. Please use a more recent kernel like 2.0.36. The option pad for cdrecord applies to audio CDs only and the option pad for mkisofs requires a patch, which is as much work to apply than to upgrade to a bugfree Linux kernel.) Note: Some ancient versions of mount are not able to deal with loopback devices. If you have such an old version of mount, then upgrade your Linuxsystem. Several people have already suggested putting information about how to get the newest mount utilities into this HOWTO. I always refuse this. If your Linux distribution ships with an ancient mount, report it as a bug. If your Linux distribution is not easily upgradable, report it as a bug. If I include all the information that is necessary to work around bugs in badly designed Linux distributions, this HOWTO would be a lot bigger and harder to read.
cdrecord scanbus
This will tell you to which SCSI device your CDwriter is attached to. All other methods of guessing the information printed so nicely by cdrecord have been removed from the HOWTO. Before showing you the last command, let me warn you that CDwriters want to be fed with a constant stream of data. So the process of writing the CD image to the CD must not be interrupted or a corrupt CD will result. It's easy to interrupt the data stream by deleting a very large file. Example: if you delete an old CDimage of 650 Mbytes size, the kernel must update information about 650,000 blocks on the hard disk (assuming you have a block size of 1 Kbyte for your filesystem). That takes some time and is very likely to slow down disk activity long enough for the data stream to pause for a few seconds. However, reading mail, browsing the web, or even compiling a kernel generally will not affect the writing process on modern machines. Please note that no writer can reposition its laser and continue at the original spot on the CD when it gets disturbed. Therefore any strong vibrations or other mechanical shocks will probably destroy the CD you are writing. When you are mentally prepared, dress up in a black robe, multiply the SCSIid of the CDwriter with its SCSIrevision and light as many candles, speak two verses of the ASRFAQ (newsgroup alt.sysadmin.recovery) and finally type: Write the CDimage to a CD 17
CDWriting HOWTO
shell> shell> shell> shell> SCSI_BUS=0 # taken from listing 1 "scsibus0:" SCSI_ID=6 # taken from listing 1 "TOSHIBA XM3401" SCSI_LUN=0 cdrecord v speed=2 dev=$SCSI_BUS,$SCSI_ID,$SCSI_LUN \ data cd_image
data
cd_image
For better readability, the coordinates of the writer are stored in three environment variables with natural names: SCSI_BUS, SCSI_ID, SCSI_LUN. If you use cdrecord to overwrite a CDRW, you must add the option "blank=..." to erase the old content. Please read the man page to learn more about the various methods to blank the CDRW. In times where everybody except me owns a 400 Mhz machine, people feed the output of mkisofs directly into cdrecord:
shell> IMG_SIZE=`mkisofs R q printsize private_collection/ 2>&1 \ | sed e "s/.* = //"` shell> echo $IMG_SIZE shell> [ "0$IMG_SIZE" ne 0 ] && mkisofs r private_collection/ \ |cdrecord speed=2 dev=0,6,0 tsize=${IMG_SIZE}s data # don't forget the s ^ ^ read data from STDIN
The first command is an empty run to determine the size of the image (you need the mkisofs from the cdrecord distribution for this to work). You need to specify all parameters you will use on the final run (e.g. J or hfs). Maybe your writer does not need to know the size of the image to be written, so you can leave this dry run out. The printed size must be passed as a tsizeparameter to cdrecord (it is stored in the environment variable IMG_SIZE). The second command is a sequence of mkisofs and cdrecord, coupled via a pipe. The
CDWriting HOWTO
shell> sox killingmysoftware.wav killingmysoftware.cdr
This command would convert the song killingmysoftware from the WAVformat into the CDR audioformat. See the man page for sox for more details about formats and filenameextensions sox recognizes. Because the output of the manual conversion takes up much disk space, it was made a builtin feature of cdrecord for the sound formats WAV and AU. So as long as your sound files have the extensions .wav or .au (and the sample rate "stereo, 16 bit, 44.1 kHz"), you can use them as audio tracks without manual conversion into the CDR format. However, cdrecord requires the size of the sound data to be a integer multiple of 2352 and to be greater than 705,600 bytes, which is not fullfilled for some WAV files. For such files the usage of sox is needed to pad the audio data up to 2352 bytes.
shell> cdrecord v speed=2 dev=0,6,0 shell> cdrecord v speed=2 dev=0,6,0 shell> cdrecord v speed=2 dev=0,6,0
By doing this, you will produce an audio CD which has a 2 seconds of pause between audio tracks. One notable format not directly readable by cdrecord is MPEG Layer 3. To convert files in this format to the CDRformat, you can use the command "mpg123 cdr track1.mp3 > track1.cdr". The option cdr ensures the track is encoded in the required format (see above). Older versions of mpg123 require s instead of the plain to write to stdout. The other direction (converting from WAV to MPEG) can be done with LAME for WAVfiles (extract the track with cdda2wav from the audio CD and encode it into MP3 with the help of LAME). To create a CDR from a whole bunch of MP3files, you can use the following command sequence:
for I in *.mp3 do mpg123 cdr "$I" | cdrecord audio pad nofix done cdrecord fix
Depending on the speed of your machine, you may want to slow down writing to "speed=1" (cdrecord option). If you use "speed=4", your machine must be able to play the MP3file at quadruple speed. mpg123 consumes much CPUtime! If you are in doubt, try an empty run with dummy (keeps the laser switched Writing audio CDs (TAO) 19
DAO
If you want to get rid of the pauses between the audio tracks, you have to use diskatonce (DAO) recording versus the (individual) trackatonce (TAO) recording described above. Support for DAO is currently most advanced in cdrdao. Please see its homepage for details. If you master the CD in DAO mode, then you use a monolithic image (sound file) and control track information with a configuration file.
CD_DA TRACK AUDIO FILE "live.wav" 0 5:0:0 INDEX 3:0:0 TRACK AUDIO FILE "live.wav" 5:0:0 5:0:0 TRACK AUDIO FILE "live.wav" 10:0:0 5:0:0 INDEX 2:0:0
cdrecord
v dev=0,6,0
data
cd_image
audio
track*.cdr
4.Dear Winfried,...
This is the section usually known as "frequently asked questions with answers". If you have a problem with your partner, kids or dog, just send it in, as long as it is related to writing CDRs or is otherwise entertaining.
DAO
20
CDWriting HOWTO
shell> e2fsck n /dev/sda5 # 'n' is important! [stuff deleted ignore any errors] /dev/sda5: 73/12288 files (12.3% noncontiguous)
In this example the fragmentation seems to be very high but there are only 73 very small files on the filesystem. So the value is not alarming. There is an experimental utility called e2defrag to defragment extended2 filesystems. The current version does not work reliable enough to use it even for private environments. If you really want to defragment your filesystem, make a backup copy (better: two copies), practice restoring the data, then create a new filesystem (that will destroy the old) and restore the data. This sketch is currently the safest technique.
21
CDWriting HOWTO
4.4 Isn't there some way to get around the ISO9660 limitations?
Yes. You can put any filesystem you like on the CD. But other operating systems than Linux won't be able to deal with this CD. Here goes the recipe: Create an empty file of 650MB size.
dd if=/dev/zero of="empty_file" bs=1024k count=650
Mount this empty file through the loopback devices (you need a reasonable new mount for this; read above).
mount t ext2 o loop=/dev/loop1 empty_file /mnt
Copy files to /mnt and umount it afterwards. Use cdrecord on empty_file (which is no longer empty) as if it were an ISO9660image. If you want to make an entry in /etc/fstab for such a CD, then disable the checking of the device file on system startup. For example:
/dev/cdrom
/cdrom
ext2
defaults,ro
0 0
The first 0 means "don't include in dumps" (backup), the second (=important) one means "don't check for errors on startup" (fsck would fail to check the CD for errors).
http://www.xiph.org/paranoia/
4.4 Isn't there some way to get around the ISO9660 limitations?
22
CDWriting HOWTO Or you want to try the combination of "cdda2wav" and "sox", available from sunsite and its mirrors:
ftp://sunsite.unc.edu/pub/Linux/apps/sound/cdrom/cdda2wav0.71.src.tar.gz ftp://sunsite.unc.edu/pub/Linux/apps/sound/convert/sox11gammacb3.tar.gz
cdda2wav enables you to get a specific interval (or a whole track) from your audio CD and converts it into a .wavfile. sox converts the WAV files back into the (audio CD) cddaformat so it can be written to the CDR using cdrecord. You don't necessarily need sox if you use a recent version of cdrecord, because it has builtin support for .au and .wav files.
/* * Usage: echo "scsi addsingledevice 0 1 2 3" >/proc/scsi/scsi * with "0 1 2 3" replaced by your "Host Channel Id Lun". * Consider this feature BETA. * CAUTION: This is not for hot plugging your peripherals. As * SCSI was not designed for this you could damage your * hardware ! * However perhaps it is legal to switch on an * already connected device. It is perhaps not * guaranteed this device doesn't corrupt an ongoing data transfer. */
Please note that this should only be used if your add SCSI devices to the end of the chain. Inserting new SCSI devices into an existing chain disturbs the naming of devices (directory /dev) and may destroy the complete content of your hard disk. Some kernel versions do not like rescanning the SCSI bus at all and your system may freeze solid when trying out the above. You have been warned.
Yes. But you should be aware of the fact that any errors while reading the original (due to dust or scratches) will result in a defective copy. Please note that both methods will fail on audio CDs! You have to use cdrdao or cdda2wav on audio CDs.
23
CDWriting HOWTO First case: you have a CDwriter and a separate CDROM drive. By issuing the command
you read the data stream from the CDROM drive attached as /dev/scd0 and write it directly to the CDwriter. Second case: you don't have a separate CDROM drive. In this case you have to use the CDwriter to read out the CDROM first:
dd if=/dev/scd0 of=cdimage
This command reads the content of the CDROM from the device /dev/scd0 and writes it into the file "cdimage". The contents of this file are equivalent to what mkisofs produces, so you can proceed as described earlier in this document (which is to take the file cdimage as input for cdrecord). If you want to see a progressmeter and other fancy stuff, then you can also use Jrg Schillings sdd. In case you run into errors, then install a recent version of cdrecord, which ships a tool called "readcd" (found under misc/). It gives you the same result as dd, but reads sectors on the CDROM several times in case of errors.
/dev/scd0
/cdrom
iso9660
ro,user,noauto
24
CDWriting HOWTO
http://www.muraroa.demon.co.uk/
Instead of writing a true audio CD, you can optionally convert your WAV audio files into MP3 audio files and store them on a ISO9660 filesystem as regular files. Usually MPEG III give you a compression of 1:10. Of course, most CDplayers are not able to read files... this is the drawback. On the other hand, why not running the music for your next party from hard disk? 18 Gbytes are enough for 30004000 titles. :) A software MPEG IIIencoder is available from http://www.sulaco.org/mp3/
For recorded speech, you may want to try to reduce its size using shorten or "GSM lossy speech compression":
ftp://svrftp.eng.cam.ac.uk/pub/comp.speech/
http://kbs.cs.tuberlin.de/~jutta/toast.html
25
CDWriting HOWTO Place this floppy image into the directory holding the collection of your files (or into a subdirectory of it, just as you like). Tell mkisofs about this file with the option 'b' and also use 'c'. For details read the file README.eltorito in the mkisofsdistribution. An interesting application for a custom bootable CD is as a virus safe DOS or Windowssystem. It saves you the money for the hard disks (if you have a network and use samba to put the userdata on a file server). The German computer magazine c't has a article about this issue in the issue 11/99, page 206 ( http://www.heise.de/). Some details about the bootable RedHat CDROM is available from http://members.bellatlantic.net/~smithrod/rhjoltechnical.html.
4.14 What about Solaris, *BSD, AIX, HPUX, etc.? Is my variant of Unix supported?
Only chapter 2 is Linuxspecific. You can apply chapter 3 and 4 even if you run another family of operating systems than Linux. Please see the files README.NetBSD, README.aix, README.hpux, README.next, README.solaris, README.sunos, README.vms or README.xxxBSD from the cdrecorddistribution. Probably yes. Compile cdrecord for your platform and issue the command "cdrecord scanbus". Read the README.* file for your Unix distributed with the sources of cdrecord. However, not all variants of Unix can read the RockRidge, Joliet or HFS extensions on your newly written CDR.
26
CDWriting HOWTO
# be verbose v # set the speed of the writer speed=2 # the devicecoordinates in the form BUS,ID,LUN dev=0,6,0
The configuration files for the wrapper belong into /etc/cdrecord/ and must be referenced on the command line. Example: if you want to refer to the configuration /etc/cdrecord/mywriter.cfg, then you can issue the command "cdrecord.sh mywriter.cfg audio track1...". Everything after mywrite.cfg is passed to cdrecord.
#! /bin/bash CFGDIR="/etc/cdrecord" CFG="$1" shift ARGS_LEFT="$@" if [ ! f "$CFGDIR/$CFG" ] then echo "Configuration file $CFGDIR/$CFG not found. Exiting." exit 1 fi while read LINE do case $LINE in \#*|"") continue;; esac old_IFS="$IFS" IFS="$IFS=" set $LINE IFS="$old_IFS" O_NAME="$1" O_VALUE="" while shift do case $1 in "") continue;; esac O_VALUE="$1" done if [ z "$O_VALUE" ]
27
CDWriting HOWTO
then O_CDRECORD="$O_CDRECORD $O_NAME " continue fi O_CDRECORD="$O_CDRECORD $O_NAME=$O_VALUE " done < "$CFGDIR/$CFG" set x #DEBUG exec cdrecord $O_CDRECORD $ARGS_LEFT echo "Execution of cdrecord failed."
#! /bin/bash RD=/dev/cdrom for i in 32768,7 32776,32 32808,32 32958,128 33086,128 33214,128 \ 33342,128 33470,32 33581,16 33598,16 33615,16 33632,16 do old_IFS="$IFS" IFS="," set $i IFS="$old_IFS" OFFSET=$1 LENGTH=$2 echo "*`dd if=$RD bs=1 skip=$OFFSET count=$LENGTH 2> /dev/null`#" done
CDWriting HOWTO specify the switch data for cdrecord on the command line. The images for the second and subsequent sessions are a little bit more complicated to generate. Mkisofs must know where the free space on the CDR begins. That information can be gathered by using the option msinfo on cdrecord (see example below).
shell> NEXT_TRACK=`cdrecord msinfo dev=0,6,0` shell> echo $NEXT_TRACK shell> mkisofs R o cd_image2 C $NEXT_TRACK M /dev/scd5 private_collection/ \
For more information, please read the file README.multi, which is distributed with cdrecord.
4.19 Should I use the SCSI adapter shipped with the writer?
Reported via email: Most CDwriter docs say to use a separate SCSI bus if going from a CDROM to a CDwriter and I have seen this myself in the following scenario: Adaptec 2940UW SCSI card, a 24x SCSI CDROM and a 4x4 SCSI CDwriter. When I got the CDwriter, it came with its own ISA SCSI card which could only handle one device. I figured I'd toss this and use my better adaptec card for all the stuff. I noticed it was quite prone to buffer underruns when recording at the 4x speed, but as soon as I tried hooking up the ISA SCSI card, it had no problems. I know 2 other people (both using adaptec 2940 cards), who have experienced exactely the same symptoms, usually when writing from a CDROM to a CDrecorder. Though I've never experienced the problem when going from a hard drive to a CDwriter on the same bus.
Then treat cdimage like a regular file, i.e. issue the following command:
4.19 Should I use the SCSI adapter shipped with the writer?
29
CDWriting HOWTO Your ftpclient will notice when cdrecord wants to read from the file and will start transfering data from the ftphost.
4.21 I hear a crack or click sound at the end of the each track.
You have to use diskatonce mode (DAO) to get rid of the cracks.
4.22 How can this be set up so that a user can burn CDs instead of always being root?
You can add the setuidbit to the cdrecordexecutable. However, this might be a security risk. Just setting the permissions on the device files does not help as cdrecord issues privileged commands via the SCSI generic interfaces.
4.23 Where do I get the "Yellow Book" and "Orange Book" standards?
You get the printed specifications from Philips and they are expensive.
4.24 I've been searching for information on burning VideoCD under Linux.
Here you can find utilities for creation of MPEG videos and VideoCDs: http://www.mainconcept.de/ http://www.johanni.de/munichvision/vcd/ Political correct people mention the Berkeleytools and other YUVstrategies. Their usage is complicated, takes much time and harddiskspace and gives you no audio track. I recommend to use conceptually higher 4.21 I hear a crack or click sound at the end of the each track. 30
4.27 What will cdrecord do when it stops getting input from the pipe?
It will finish writing. So you can just couple your favourite backup tool with cdrecord using a pipe, like in "bru size=640m f | cdrecord dev=0,1,0 speed=2 ". You have to take special care within the backup utility if the backup spans multiple CDRs.
4.29 How many times can you reuse CDRW before they become faulty?
Good question.
31
CDWriting HOWTO
5.Troubleshooting
Always remember, that you can still use corrupt CDROMs as coasters. :)
32
CDWriting HOWTO
[root@Blue /dev]# cdrecord eject dev=0,6,0 cdrecord: No such file or directory. No read access for 'dev=0,6,0'.
CDWriting HOWTO Under various circumstances SCSI devices dis and reconnect themselves (electronically) from the SCSI bus. If this feature is not available (check controller and kernel parameters) some writers run into trouble during burning or fixating the CDR. Especially the NCR 53c7,8xx SCSI driver has the feature disabled by default, so you might want to check it first:
NCR53c7,8xx SCSI support [N/y/m/?] y always negotiate synchronous transfers [N/y/?] (NEW) n allow FASTSCSI [10MHz] [N/y/?] (NEW) y allow DISCONNECT [N/y/?] (NEW) y
5.5 Medium errors If cdrecord reports medium errors in the form of"Sense Key: ... Medium Error, Segment ...", then the mediumis not empty. If you use CDRW, then try to switch fromblank=fast to the more reliable blank=all. If you use CDRonly, then make sure the CDR has never seen a CDwriter beforeor try out discs from another manufacturer.
5.5 Medium errors If cdrecord reports medium errors in the form of"Sense Key: ... Medium Error, Segment .. 34
CDWriting HOWTO
cd /dev ls l scanner # shows current setting ln sf sg2 scanner # test the scanner ln sf sg1 scanner # test the scanner # and so on
Application developers should carefully think about support for this dangerous and error prone naming scheme. Please consider at least to use intermediate solutions like the SCSI coordinates used by cdrecord.
6.Credits
Many thanks go to the readers of this HOWTO, who contributed actively to its contents. As I don't had access to a CDwriter myself for several years, reports about real live setups and experience have always been of great value to me.
Doug Alcorn <[email protected]> helped to improve the handling of newer kernels Kalle Andersson <[email protected]> How to write audio CDs directly from MP3. Alan Brown <[email protected]>
Rick Cochran <[email protected]> hint about dis/reconnect disabled by default in the ncr driver Robert Doolittle <[email protected]> good arguments for dropping cdwrite from the HOWTO Markus Dickebohm <[email protected]>
Thomas Duffy <[email protected]> major cleanup of syntax and spelling Dave Forrest <[email protected]> 6.Credits 35
CDWriting HOWTO fixed adapter spelling problems Jos van Geffen <[email protected]> noted the problem in 4.9. Bernhard Gubanka <[email protected]> noticed the need of a recent version of mount to utilize the loopback device Stephen Harris <[email protected]> contributed hint about writing audio CDs Janne Himanka <[email protected]> pointer to kernel patch to read Joliet CDROMs Stephan Noy <[email protected]> information and experience about writing audio CDs Don H. Olive <[email protected]> URL of the mkhybrid tool Jesper Pedersen <[email protected]>
Pierre Pfister <[email protected]> helped to develop the recipe on 1:1 copies. Daniel A. Quist <[email protected]> information about IDE CDR and newer kernel versions [email protected] Reported problem with preinitialized writers when booting via loadlin. Dale Scheetz <[email protected]>
Joerg Schilling <[email protected]> many informations about cdrecord Martin Schulze <[email protected]> gave information about the cdwritemailinglist 6.Credits 36
CDWriting HOWTO Gerald C Snyder <[email protected]> tested writing of an ext2 CDROM (see 4.4) Art Stone <[email protected]> had the idea to put nonISO9660 filesystems on a CD The Sheepy One <[email protected]> suggested using defective CDROMs as coasters for drinks Erwin Zoer <[email protected]>
Futhermore, I would like to thank the following people for reporting spelling mistakes: Bartosz Maruszewski <[email protected]>, Alessandro Rubini <[email protected]>, Ian Stirling <[email protected]>, Brian H. Toby. End of the Linux CDWriting HOWTO. (You can stop reading here.)
6.Credits
37