home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1999 August
/
PCWorld_1999-08_cd.bin
/
doc
/
HOWTO
/
CD-Writing-HOWTO
< prev
next >
Wrap
Text File
|
1999-04-27
|
50KB
|
1,651 lines
CD-Writing HOWTO
Winfried Trⁿmper <winni@xpilot.org>
v2.7, 11 April 1999
This document explains how to write CD-ROMs under Linux.
______________________________________________________________________
Table of Contents
1. Introduction
1.1 Copyright, license and terms of usage
1.2 Suggested readings
1.3 Terminology ... lasers at maximum ... fire!
1.4 Supported CD-Writers
1.5 Supported "features"
1.6 Mailinglists
1.7 Availability
2. Setup Linux-system for writing CD-ROMs
2.1 Set up the Linux-kernel
2.1.1 Special hints for the 2.2-series
2.1.2 Special hints for the 2.0-series
2.2 Hardware and devicefiles
2.2.1 IDE/ATAPI CD-writers
2.2.2 SCSI CD-Writers
2.2.2.1 Generic SCSI devices
2.2.3 CD-Writers for the parallel port
2.3 Get the user-software for burning CD-Rs
2.3.1 Command line utilities
2.3.2 Graphical user interfaces (optional)
3. Burning CD-Rs
3.1 Writing CD-ROMs (pure data)
3.1.1 Creating an image of the later CD-ROM
3.1.2 Test the CD-image
3.1.3 Write the CD-image to a CD
3.2 Writing audio CDs
3.3 Mixed mode CD-ROMs
4. Frequently asked questions with answers
4.1 "How sensitive is the burning process?"
4.2 "Has fragmentation a bad impact on the throughput?"
4.3 "Is it possible to store the CD-image on an UMSDOS-filesystem?"
4.4 "Isn't there some way to get around the ISO-9660 limitations?"
4.5 "How to read the tracks from audio CDs?"
4.6 "How to probe for SCSI-devices after boot?"
4.7 "Is it possible to make a 1:1 copy of a data CD?"
4.8 "Can Linux read Joliet CD-ROMs?"
4.9 "How do I read/mount CD-ROMs with the CD-writer?"
4.10 "How to put even more data on the CD-R?"
4.11 "How to make bootable CD-ROMs?"
4.12 "How to make CD-ROMs writable somehow?"
4.13 "Is it possible to use several writers at once?"
4.14 "Which media is the best?"
5. Troubleshooting
5.1 It doesn't work: under Linux
5.2 Error-message: No read access for 'dev=2,0'.
5.3 It doesn't work: under DOS and friends
5.4 SCSI errors during the burning phase
6. Credits
______________________________________________________________________
1. Introduction
Many people use Linux to burn CD-ROMs, 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 CD-writing HOWTO explains the setup, how to put data on
the media and gives some interesting applications kindly submitted by
the readers.
1.1. Copyright, license and terms of usage
Copyright Winfried Trⁿmper 1996,1997,1998,1999. All rights reserved.
Redistribution and use, with or without modification, are permitted
provided that the name of the author may not be used to endorse or
promote products derived from this software without specific prior
written permission.
The author disclaims all warranties with regard to this document,
including all implied warranties of merchantability and fitness for a
certain purpose; in no event shall the author be liable for any
special, indirect or consequential damages or any damages whatsoever
resulting from loss of use, data or profits, whether in an action of
contract, negligence or other tortious action, arising out of or in
connection with the use of this document.
Short: read and use at your own risk.
1.2. Suggested readings
The CD-R FAQ <http://www.fadden.com/cdrfaq/> is a general FAQ about
compact-disk recordables (CD-R), CD-writers and the required software.
As most CD-writers can be used to read CD-ROMs, too, you may want to
read the Linux CD-ROM HOWTO, the Linux SCSI HOWTO and the Linux Kernel
HOWTO.
1.3. Terminology ... lasers at maximum ... fire!
CD-ROM stands for Compact Disc Read Only Memory, a storage medium
utilizing an optical laser to sense microscopic pits on a silver
shimmering disk. The silver shimmering comes from an aluminized layer
which is the carrier. The pits represent the bits of the information
(in some way) and are so petite that some billions of them fit on the
disc. Thus a CD is a mass-storage medium.
The term CD-R is a short form of CD-ROM recordable and refers to a CD
that doesn't have those "microscopic pits" on it's surface. Thus it's
empty. Instead of the silver aluminium layer a CD-R has a special film
(colored) into which "microscopic pits" can be burned in. This is done
by giving the laser which normally only senses the pits a little bit
more power so he burns the pits. This action can only be taken once on
a CD-R, although you can leave out some areas for later writing,
creating a so called multi-session CD.
The CD-ROM rewritable (short: CD-RW) was developed to come around the
limitation of CD-R media. Here the laser can not even burn pits into
the media, but it can also melt the media back into it's original
state. This is possible, because the laser does not really burn holes
into the media - you do not see a puff of smoke while burning and no
voice from above tells you "target destroyed". What the laser really
does is to trigger a phase change, thus the name "phase change
devices" for CD-RW-writers. An example for a very similar technique
used in daily life is the cleaning car in an ice-hockey stadion:
during the pauses of the game, the car drives over the ice and fills
the scratches in the ice (-> bits containing some sort of information
about the game... hehehe) with melted splinter.
This HOWTO deals with the task of writing CD-Rs and CD-RWs. Welcome
on board, captain.
1.4. Supported CD-Writers
The detailed list of models which have been reported to work or not to
work under various Unix-like operating systems is available online
from <http://www.guug.de:8080/cgi-bin/winni/lsc.pl>.
Here is a comprehensive summary of drives known to work with cdrecord:
Acer: CDRW 6206A
BTC: BCE 621E (IDE)
Compro: CW-7502, CW-7502B
Dysan: CRW-1622
Elite: Elite b444.41
Grundig: CDR 100 IPW
Guillemot: Maxi CD-R 4X/8X
HP: SureStore 4020i, SureStore 6020i,
C4324, C4325
CD-Writer+ 7100, CD-Writer+ 7200i,
CD-Writer+ 8100i, CD-Writer+ 8110i,
Hi-Val: CDD-3610
JVC: XR-W2001, XR-W2010, XR-W2042, R-2626
Kodak: PCD 200, PCD 225, PCD 260, PCD 600
Matsushita: CW-7502
Memorex: CRW-620, CRW-1622
Microboards: PlayWrite 2000, PlayWrite 4000RW, PlayWrite 4001RW
MicroNet: MasterCD Plus 4x4, MasterCD Plus 4x6
Mitsubishi: CDRW-226
Mitsumi: CR-2401-TS, CR-2600 TE, CR-2801 TE, CR-4801 TE
Nomai: 680.RW
OTI: CDRW 965
Olympus: CDS 615E, CDS 620E
Optima: DisKovery 650 CD-R
OTI: CDRW 965
Panasonic: CW-7502, CW-7582
Philips: CDD-521/10, CDD-522
CDD-2000, CDD-2600, CDD-3600, CDD-3610
Omniwriter 26, Omniwriter 26A
Plasmon: CDR 480, CDR 4220, RF-4100, RF-4102, CDR 4400
Plextor: CDR PX-24 CS, PX-412 C, PX-R412 C
PX-R810Ti, PleXwriter 412C
Procom: PCDR 4
Ricoh: RO-1420C+, MP 1420C, MP 6200S, MP 6201S
Sanyo: CRD-R24S
Smart and
Friendly: CD-RW226, CD-R1002, CD-R1002/PRO, CD-R1004,
CD-R2004, CD-R2006 PLUS, CD-R2006 PRO,
CD-R4000, CD-R4006, CD-R4012
Sony: CDU 920S, CDU 924, CDU 926S, CDU-928E,
CDU 948S, CDRX 100E
Taiyo Yuden: EW-50
TEAC: CD-R50S, CD-R55S, CDR-55S
Traxdata: CRW 2260, CDR 4120, CDRW 4260,
Turtle Beach: 2040R
WPI (Wearnes): CDRW-622, CDR-632P
YAMAHA: CDR-100, CDR 102, CDR-200, CDR-200t, CDR-200tx
CDR-400, CDR-400c, CDR-400t, CDR-400tx, CDR-400Atx
CRW-2260, CRW-2260t,
CRW-4250tx, CRW-4260 t, CRW-4260 tx, CRW-4261,
CRW-4416 S
If your hardware isn't supported you can still use Linux to create an
image of the later CD. You may wish to do so because most DOS-software
cannot deal with RockRidge-Extensions. But then you have to use DOS-
Software to write the image to the CD-R.
1.5. Supported "features"
There are two classes of utilities for writing CD-Rs: the hardware-
drivers and the data-formatters. The hardware drivers support the
following features:
Supported Feature cdwrite-2.1 cdrecord-1.6
------------------------------------------------
IDE/ATAPI no yes
Parallel Port no yes
CD-RW no yes
Multisession only partial yes
cdwrite is an old software only referenced for completeness. Please
use cdrecord instead, as it supports a wider range of hardware and has
significantly more features. The purpose of the data-formatters is to
organise the data on the media ("put a filesystem on it").
Feature mkisofs mkhybrid
--------------------------------------------
ISO 9660 yes yes
RockRidge yes yes
El Torito yes yes
HFS no yes
Joliet no yes
The most obvious difference of the ISO 9660 filesystem compared to the
Extended-2 filesystem is, that you can't modify files once they are
written to the media. The limitations of the ISO-9660-filesystem are:
╖ only 8 levels of sub-directories allowed (counted from the top-
level directory of the CD) (use RockRidge Extensions to enlarge
this number)
╖ maximum length for filenames: 32 characters
╖ 650 MB capacity
RockRidge is an extension to allow longer filenames and a deeper
directory hierarchy for the ISO-9660 filesystem. These extensions are
not available when reading the CD-ROM under DOS or the Windows-family
of operating systems.
El Torito can be used to produce bootable CD-ROMs. The BIOS of your PC
must support this feature, too. Roughly speaking, the first 1.44 Mbyte
of the CD-ROM contain a floppy-disk image supplied by you. This image
is treated like a floppy by the BIOS and booted from.
HFS lets a Macintosh read the CD-ROM 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). The author knows of no tool to have long
filenames under plain DOS or Windows 3.11.
Section 2.8 lists the availability of the mentioned software.
1.6. Mailinglists
If you want to join the development team (with the intention to
actively help them), send e-mail to cdwrite-request@other.debian.org
and put the word subscribe in body of the message.
1.7. Availability
The newest version of this document is always available from
<http://www.guug.de/~winni/linux/>.
2. Setup Linux-system for writing CD-ROMs
If you succeed setting up your hardware and the rest of your Linux-
system, the command cdrecord -scanbus shows you a list of devices
available for writing. The goal of this chapter is to guide you in
setting up your Linux-system, so that you finally end up seeing
something like:
shell> cdrecord -scanbus
Cdrecord release 1.7a1 Copyright (C) 1995-1998 J÷rg Schilling
scsibus0:
0) 'Quantum ' 'XP34300 ' 'F76D' Disk
1) 'SEAGATE ' 'ST11200N ' '8334' Disk
2) *
3) 'TOSHIBA ' 'MK537FB/ ' '6258' Disk
4) 'WANGTEK ' '5150ES SCSI-36 ' 'ESB6' Removable Tape
5) 'EXABYTE ' 'EXB-8500-85QUE ' '0428' Removable Tape
6) 'TOSHIBA ' 'XM-3401TASUNSLCD' '3593' Removable CD-ROM
7) *
scsibus1:
100) 'Quantum ' 'XP31070W ' 'L912' Disk
101) *
102) *
103) 'TEAC ' 'CD-R55S ' '1.0H' Removable CD-ROM
104) 'MATSHITA' 'CD-R CW-7502 ' '4.02' Removable CD-ROM
105) *
106) 'YAMAHA ' 'CDR400t ' '1.0d' Removable CD-ROM
107) *
The example was provided by J÷rg Schilling and shows a total of four
cd-writers. You cannot distinguish ordinary CD-ROM drives from those
CD-ROM drives with burning capability. But the product identification
often has hints about the feature in form of a R, -R or -RW.
2.1. Set up the Linux-kernel
The Linux-kernel can be equipped with drivers for various features.
You can compile the drivers into the kernel-image statically or you
can compile them as a module for loading on-demand. The last method is
preferred for drivers not essential for bringing your Linux-system
into life. Example: if your system lives on a IDE-harddisk, you must
have the driver for IDE-harddisks in the kernel (and not as a module).
There are three different types of CD-writers: SCSI, IDE/ATAPI and
external writers for the parallel port. Table 4 shows how to configure
the Linux-kernel for those hardware types. The first column of the
table is the section of the configuration menu, where you can find the
setting. The second column is the description of the feature. The
third column gives the name of the resulting module.
Y stands for yes and means you should put the beast into the kernel.
M stands for module and means you should compile this feature as a
module. Y/M gives you the option to decide between both. 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...).
To check which drivers are active (provided by both, statical and
dynamical drivers) in your running kernel, you can read the file
/proc/devices. To check which modules are loaded, issue the command
'lsmod'. To check which modules are available for loading, issue the
command 'modprobe -l'. If you need a module not available on your
system, you must recompile and reinstall the kernel. Please read the
Kernel-HOWTO for more information upon this. The most recent
information about handling of kernel-modules can be read in the
Module-HOWTO.
Sect. Description Module SCSI IDE PP
------------------------------------------------------------
BLOCK Enhanced IDE/MFM/RLL... Y
BLOCK IDE/ATAPI CDROM ide-cd M/N/Y
BLOCK SCSI hostadaptor emulation ide-scsi M
BLOCK Loopback device loop M M M
PARIDE Parallel port IDE device paride Y/M
PARIDE Parallel port ATAPI CD-ROMs M
PARIDE Parallel port generic ATAPI M
PARIDE (select a low-level driver) Y
SCSI SCSI support scsi_mod Y/M Y/M
SCSI SCSI CD-ROM support sr_mod Y/M Y/M
SCSI Enable vendor-specific Y Y
SCSI SCSI generic support sg Y/M Y/M
SCSI (select a low-level driver) Y
FS ISO 9660 CDROM filesystem iso9660 Y Y Y
FS Microsoft Joliet cdrom... joliet M M M
If you have success in building or finding the required modules,
either add their names to /etc/modules or let an automatic facility
(kmod, kerneld) load them. Consult the documentation of your Linux-
distribution if you are unsure.
The feature "SCSI hostadaptor emulation" was named "SCSI emulation" in
earlier kernels (around 2.0.36). If your kernel allows it, compile the
driver for IDE/ATAPI CD-ROMs as a module. If not, disable it (N) and
use the driver for SCSI-CD-ROMs instead. For the 2.2 series of the
Linux kernel, it is no longer possible to run the drivers for IDE and
SCSI on the same physical device at the same time (if you still have
2.0.36, read below).
The loopback device is an optional feature, which helps you to test
the image before writing it to the media.
If you want to be able to read CD-ROMs, you need support for the ISO
9660 filesystem. This driver automatically includes RockRidge
Extensions. If you want to have MS Joliet cdrom extensions, compile
them as a module and load them.
In any case, you need a low-level driver for your hardware. Low-level
refers to the driver, which interacts directly with the hardware. For
SCSI and the parallel port, there are a lot of low-level drivers
available, which are described below.
2.1.1. Special hints for the 2.2-series
With kernel-version 2.2.1, don't enable CONFIG_SCSI_MULTI_LUN ('probe
for multiple luns') and ide-scsi support at the same time, there is
an ide-scsi bug that prevents this. Anyway, it is recommended to
upgrade to 2.2.5.
Some users reported conflicts with pre-compiled binaries and the
2.2-release. This is a problem of the Linux-kernel. Solutions:
╖ It may go away if you recompile cdrecord so that it adopts to the
actual values in linux/include/scsi/sg.h. These values must be the
values of the runing kernel due to the dumb sg user interface.
╖ It may be caused by a loabdable sg driver which cannot get enough
memory that is suitable for DMA. Get the sg_buffer patch from J÷rg
Schillings FTP-site:
<ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/alpha/>
2.1.2. Special hints for the 2.0-series
Kernels prior to 2.0.31 have several bugs and can't read the last file
on a CD-ROM. Please upgrade to 2.0.36.
With 2.0.36 and above, you can select which driver (IDE or SCSI) to
use for which ATAPI-device. To be more precise, you can add the
feature "SCSI emulation" to your kernel and activate the emulation for
specific devices on the kernel commandline (before/while booting). For
example, if your cd-writer has the devicefile /dev/hdb, then add the
statement hdb=ide-scsi.
image=/boot/zImage-2.0.36
label=Linux
read-only
append="hdb=ide-scsi"
linux "Linux 2.0.36" {
image=/boot/zImage-2.0.36
cmdline= root=/dev/hda5 readonly hdb=ide-scsi
}
2.2. Hardware and devicefiles
After you have installed all necassary drivers, boot the new kernel.
It should have all the features you need for the following sections.
[Users of devfs need not to care about the following steps of manually
setting up device files. If you use devfs, everything will
automacigally appear on the right place.]
Goto the /dev-directory and check for loopback devices. It's not
critical if you don't have those devices, but it's convenient if you
do (see 3.5). If you already have them, the ls-command should show
loop0-loop7:
shell> cd /dev
shell> ls loop*
loop0 loop1 loop2 loop3 loop4 loop5 loop6 loop7
If you don't have those device-files, then create them by using the
/dev/MAKEDEV-script:
shell> cd /dev/
shell> modprobe loop
shell> ./MAKEDEV loop
The last command only succeeds if you have the loop-module in your
kernel. What you read so far about handling of loop-devicefiles can be
applied to all other devicefiles (sg*, pg*, hd*, ...) and is not
explicitely mentioned in the following.
2.2.1. IDE/ATAPI CD-writers
ATAPI means "SCSI-commands over the IDE-bus". In other words, your
IDE/ATAPI-drives speak the SCSI-protocol (with some limitations) and
thus can act as if they were SCSI-drives.
Under Linux you can make your IDE-writer appear as a SCSI-devices
using the kernel-features "SCSI (hostadaptor) emulation". So activate
the associated kernel module ide-scsi like described above and proceed
as if you had a SCSI-writer.
2.2.2. SCSI CD-Writers
Please make sure that your writer is recognized by the BIOS of your
computer. It makes no sense to proceed if your computer does not
accept the hardware (the fact that it doesn't spit it out is no
confirmation; a message on the screen is required).
If you plan to connect your SCSI-drive to your parallel port, you need
a special active cable and a special kernel-driver. Read read
<http://www.torque.net/parport/parscsi.html> to learn more about this
option.
2.2.2.1. Generic SCSI devices
The devicefiles /dev/sd* and /dev/sr* for accessing SCSI harddisks and
SCSI CD-ROM drives are limited to block-oriented data transfer. This
makes them so fast and idealy suited for data storage. Driving the
laser of a CD-writer is a more complicated task and requires more than
block-oriented data transfer. To keep the sd* and sr* devices clean
and fast, a new type of SCSI-devices was introduced, the so called
generic SCSI-devices. As everthing can be done to SCSI-hardware
through the generic devices they are not fixed to a certain purpose -
therefore the name generic.
As true for other devices, you should find them in the /dev directory
(by convention):
shell> cd /dev
shell> ls sg*
sg0 sg1 sg2 sg3 sg4 sg5 sg6 sg7
If you don't have those device-files then create them by using the
/dev/MAKEDEV-script:
shell> cd /dev/
shell> ./MAKEDEV sg
2.2.3. CD-Writers for the parallel port
I have no clue about this, sorry. Please read
<http://www.torque.net/parport/paride.html> or your local file
/usr/src/linux/Documentation/paride.txt.
2.3. Get the user-software for burning CD-Rs
A survey of tools related to produce CD-ROMs is available from
<http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdb.html>.The
CD building project for UNIX
2.3.1. Command line utilities
One of the following packages are required to generate prototypes of
CD-Rs:
<ftp://tsx-11.mit.edu/pub/linux/packages/mkisofs/> (mkisofs)
<ftp://ftp.ge.ucl.ac.uk/pub/mkhfs> (mkhybrid)
Depending on the model of your CD-writer (see 1.3), one of the
following software for writing prototypes to CD-Rs is required:
<ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/> (cdrecord)
Don't trust the man-page of (old) mkisofs which states you need
version 1.5 of cdwrite. Just use cdrecord and you are fine. Please
note that use the mkisofs shipped with cdrecord has a few extensions
(referenced in the documentation of cdrecord).
2.3.2. Graphical user interfaces (optional)
Front-ends are really front-ends under Linux. That means, you still
have to install the command-line utilities, but you access them in a
better looking manner.
X-CD-Roast is a program-package dedicated to easy CD creation under
Linux. It combines command line tools like cdrecord and mkisofs into a
nice graphical user interface.
<http://www.fh-muenchen.de/home/ze/rz/services/pro¡
jects/xcdroast/e_overview.html>
BurnIT is a JAVA front-end to cdrecord, mksiofs and cdda2wav-0.95
making it a complete package for burning CD's on the Unix platform.
It's available from
<http://sunsite.auc.dk/BurnIT/>
3. Burning CD-Rs
"If to smoke you turn I shall not cease to fiddle while you
burn." (Roman emperor Nero about burning his own classic-
CDs, AD64. He misunderstood it completely.)
Writing CD-ROMs 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 CD-R with the utility
cdrecord
This chapter describes the steps for data- and audio-CDs in greater
detail.
3.1. Writing CD-ROMs (pure data)
Note that collecting the software usually takes up longer than one
expects. Consider that missing files cannot be added once the CD is
written and fixated.
Also keep in mind that a certain amount of the free space of a CD is
used for storing the information of the ISO-9660-filesystem (usually a
few MB). 620 MB data will always fit on a 650 MB CD-R.
3.1.1. Creating an image of the later CD-ROM
Before any storage medium (e.g. floppy disk, harddisk or CD) can be
used, it must get a filesystem (DOS speak: get formatted). The
filesystem is responsible for organising and incorporating the files
that should be stored on the medium.
The usal utilities for creating filesystems on harddisk partitions
write an empty filesystem onto them, which is then mounted and filled
with files by the user as he needs it. A writable CD is only writable
once so if we would write an empty filesystem to it, it would get
formated - but remain completely empty forever. This is also true for
rewritable media, as you cannot change arbritary sectors, but you must
erase their whole content.
So what we need is a tool that creates the filesystem while copying
the files to the CD. This tool is called mkisofs. A sample usage
looks as follows:
mkisofs -r -o cd_image private_collection/
`---------' `-----------------'
| |
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 Rock Ridge extensions. That is what one
usually wants and use of this option is recommended until you 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 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 8.3 filenames because Linux makes use of the Rock Ridge
extensions which contain the original file-information (permissions,
filename, etc.).
Now you may wonder why the output of mkisofs is not directly sent to
the writer-device. This has two reasons:
╖ mkisofs knows nothing about driving CD-writers.
╖ You may want to test the image before burning it.
╖ On slow machines it would not be reliable (see section 4.).
The method to write a CD-R in one go 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's a waste of disk-space because the CD-image
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. (However, if you have enough disk-space, an extra partition may
save you the time of deleting the image.)
3.1.2. Test the CD-image
Linux has the ability to mount files as if they were disk-partitions.
This feature is useful to check that the directory layout and file
access permissions of the CD-image matches your wishes. Although media
is very cheap today, the writing process is still time-consuming, and
you may at least want to save your time by doing a quick test.
To mount the file cd_image created above on the directory /cdrom, give
the command
mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom
Now you can inspect the files under /cdrom - they appear exactly as
they were on a real CD. To umount the CD-image, just say umount
/cdrom. (Warning: On Linux-kernels prior to 2.0.31 the last file on
/cdrom may not be fully readable. Please use more recent kernels like
2.0.36. The option -pad for cdrecord applies to audio-CDs only and the
optional option -pad for mkisofs requires a patch, which is as much
work to apply than to upgrade to a bug-free 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
it is a hint to upgrade your Linux-system.
Several people already suggested to put 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 had included all the information that is necessary to
work around bugs in bad designed Linux-Distributions, this
HOWTO would be a lot bigger and harder to read.
3.1.3. Write the CD-image to a CD
Not much more left to do. If you didn't already tried, it's a good
time for the command
cdrecord -scanbus
This will tell you to which SCSI-device your cd-writer is attached to.
All other methods of guessing the information printed so nicely by
cdrecord have been removed from the HOWTO (especially the somewhat
dangerous naming scheme for generic SCSI devices).
Before showing you the last command, let me warn you that CD-writers
want to be fed with a constant stream of data because they have only
small data-buffers. So the process of writing the CD-image to the CD
must not be interupted or a corrupt CD will be the result. It's easy
to interrupt the data-stream by deleting a very large file. Example:
if you delete a file of 650 Mbyte size, the kernel must update
information about 650.000 blocks on the harddisk (assumed you have a
blocksize 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 a few seconds. However, reading mail, browsing the web or
even compiling a kernel generally do not affect the writing process on
fast machines.
Please note that no writer can re-position it's laser and can't
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.
If you are mentally prepared, dress up in a black robe, multiply the
SCSI-id of the CD-writer with it's SCSI-revision and light as many
candles, speak two verses of the ASR-FAQ (newsgroup
alt.sysadmin.recovery) and finally type:
shell> SCSI_BUS=0 # taken from listing 1 "scsibus0:"
shell> SCSI_ID=6 # taken from listing 1 "TOSHIBA XM-3401"
shell> SCSI_LUN=0
shell> cdrecord -v speed=2 dev=$SCSI_BUS,$SCSI_ID,$SCSI_LUN \
-data cd_image
# same as above, but shorter:
shell> cdrecord -v speed=2 dev=0,6,0 -data cd_image
For better readability, the coordinates of the writer are stored in
three environment variables with speaking names: SCSI_BUS, SCSI_ID,
SCSI_LUN. The option -data is non-mandatory but is given to make the
commandline comparable to the one used for writing audio-CDs.
If you use cdrecord to overwrite a CD-RW, 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 CD-RW.
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 -print-size private_collection/`
shell> 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). Maybe your writer does not need to know the size of the image
to be written, so you can leave this out. The printed sized must be
passed as a tsize-parameter to cdrecord (it's stored in the enviroment
variable IMG_SIZE). The last command is a sequence of mkisofs and
cdrecord, coupled via a pipe.
3.2. Writing audio CDs
To write audio-CDs is very similar compared to the steps described
above. The two main differences are, that the audio-CD consists of
audio-tracks, which are organized in separate images. So if you want
to have ten tracks on your CD, you have to make ten images. The other
differnce is, that the format of the images is not ISO-9660 (or
whatever filesystem you prefer), but it is "16 bit stereo samples in
PCM coding at 44100 samples/second (44,1 kHz)".
One utility to convert your soundfiles into the required format is
sox. It's usage is straightforward:
shell> sox killing-my-software.wav killing-my-software.cdr
This command would convert the song killing-my-software from the WAV-
format into the CDR-format. See the man-page for sox for more details
about formats and filename-extensions sox recognizes. Because the
conversion takes up much diskspace, it was made a built-in feature of
cdrecord for the formats WAV and AU. So as long as your soundfiles
have the extensions .wav or .au (and the samplerate "stereo, 16 bit,
44,1 kHz"), you can use them as images without manual conversion.
Cdrecord writes the images as audio-tracks, if the option -audio is
specified. The other options are identical to those used for writing
data-CDs (unless you have very special requirements). Three examples
all doing the same, but reading the tracks from different soundfile-
formats:
shell> cdrecord -v speed=2 dev=0,6,0 -audio track1.cdr track2.cdr...
shell> cdrecord -v speed=2 dev=0,6,0 -audio track1.wav track2.wav...
shell> cdrecord -v speed=2 dev=0,6,0 -audio track1.au track2.au...
A special case are the MPEG3-files, which can be converted to the
required format with the command "mpg123 -s track1.mp3 > track1.cdr".
The other direction can be done with "8hz-mp3" for WAV-files.
Currently you will produce an audio-CD, which has a 2 seconds pause
between two audio tracks. If your burner supports to write the mode
"disc at once" (DAO), you can try the newest version of cdrecord to
get rid of the pauses.
3.3. Mixed mode CD-ROMs
Not much left to say. Just indicate the type of the (subsequent)
images with the options -data and -audio. Example:
cdrecord -v dev=0,6,0 -data cd_image -audio track*.cdr
4. Frequently asked questions with answers
4.1. "How sensitive is the burning process?"
Answer: that depends on your writer. Modern ones should have a data-
buffer of 1MB or larger and can live 1-2 seconds without data. See
the manuals or ask your manufacturer if you want to know the details.
Regardless of the size of those data-buffers you must guarantee a
constant throughput of 300kb/s or 600kb/s in the long time run.
Disk intensive processes such as updating the locate-database lower
the maximum flow-rate may corrupt the CD; you better check such
processes are not started via cron, at or anacron while you burn CD-
Rs.
On the other hand, people reported that they compiled a kernel while
burning a CD without a glitch. Of course you need a fast machine for
such experiments.
4.2. "Has fragmentation a bad impact on the throughput?"
Fragmentation is usually so low that it's impact isn't noticed.
However, you can easily construct pathological cases of fragmentation,
which lower the throughput of your harddisks under 100 kbyte/second.
So don't do that. :-)
Yes, files on a harddisk get fragmented over the years. The faster,
the fuller the filesystem is. Always leave 10% or 20% free space, and
you should run fine with respect to writing CD-Rs.
If you're uncertain then look at the messages printed while booting,
the percentage of fragmentation is reported while checking the
filesystems. You can check for this value with the very dangerous
command
shell> e2fsck -n /dev/sda5 # '-n' is important!
[stuff deleted - ignore any errors]
/dev/sda5: 73/12288 files (12.3% non-contiguous)
In this example the fragmentation seems to be very high - but there
are only 73 very small files on this filesystem (used as /tmp) so the
value is _not_ alarming.
There is an experimental utility called e2defrag to defragment
extended-2 filesystems. The current version does not work reliable
enough yet, to use it even for private environments. If you really
want to defragment your filesystem, make a backup copy (better: two
copies), practise restoring the data, then create a new filesystem
(will destroy the old) and restore the data. In a few words, this is
currently the safest technique.
4.3. "Is it possible to store the CD-image on an UMSDOS-filesystem?"
Yes. The only filesystem that isn't reliable and fast enough for
writing CD-ROMs from is the network filesystem (NFS).
I'm using UMSDOS myself to share the disk-space between Linux and
DOS/Win on a PC (486/66) dedicated for writing CD-ROMs.
4.4. "Isn't there some way to get around the ISO-9660 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
╖ Create an extended-2 filesystem on this file
shell> /sbin/mke2fs -b 2048 empty_file
empty_file is not a block special device.
Proceed anyway? (y,n) y
╖ Mount this empty file through the loopback-devices
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 ISO-9660-image.
If you want to make an entry in /etc/fstab for such a CD, disable the
checking of it, e.g.:
/dev/cdrom /cdrom ext2 defaults,ro 0 0
The first 0 means "don't include in dumps", the second (=important)
one means "don't check for errors on startup" (fsck will fail to check
the CD for errors).
4.5. "How to read the tracks from audio CDs?"
There are several software packages available. The newest one is
"cdpranoia" and can be downloaded from
<http://www.mit.edu/afs/sipb/user/xiphmont/cdpara¡
noia/index.html>
Or you want to try the combination of "cdda2wav" and "sox", available
from sunsite and it's mirrors:
<ftp://sun¡
site.unc.edu/pub/Linux/apps/sound/cdrom/cdda2wav0.71.src.tar.gz>
<ftp://sunsite.unc.edu/pub/Linux/apps/sound/convert/sox-11gamma-
cb3.tar.gz>
cdda2wav enables you to get a specific interval (or a whole track)
from your audio CD and converts it into a .wav-file. sox converts the
wav-files back into the (audio-CD) cdda-format so it can be written to
the CD-R using cdrecord. You don't necassarily need sox if you use a
recent version of cdrecord, because it has built-in support for .au
and .wav files.
4.6. "How to probe for SCSI-devices after boot?"
The file drivers/scsi/scsi.c contains the information
/*
* Usage: echo "scsi add-single-device 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 hotplugging 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 at
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 harddisk.
4.7. "Is it possible to make a 1:1 copy of a data CD?"
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.
First case: you have a CD-writer and a separate CD-ROM drive. By
issuing the command
cdrecord -v dev=3,0 speed=2 -isosize /dev/scd0
you read the data stream from the CD-ROM drive attached as /dev/scd0
and write it directly through the SCSI-device with ID 3 to the CD-R.
Second case: you don't have a separate CD-ROM drive. You have to use
the writer to read out the CD-ROM in this case:
dd if=/dev/scd0 of=cdimage
This command is equivalent to the result of mkisofs, so you should
procede as described in chapter 3. Please note that this method will
fail on audio CDs!
4.8. "Can Linux read Joliet CD-ROMs?"
Yes. Newer Kernels (2.0.36 and the upcoming 2.2) have built-in support
for the joliet format. Remember you have to use both options in your
/etc/fstab: the keywords iso9660 and joliet (later is really an
extension). For more details, see <http://www-
plateau.cs.berkeley.edu/people/chaffee/joliet.html>.
4.9. "How do I read/mount CD-ROMs with the CD-writer?"
Just as you do with regular CD-ROM drives. No tricks at all. Note that
you have to use the scd-devices (SCSI CD-ROM) to mount CD-ROMs for
reading. Example-entry for /etc/fstab:
/dev/scd0 /cdrom iso9660 ro,user,noauto 0 0
4.10. "How to put even more data on the CD-R?"
Use bzip2 instead of any other compressor like gzip or pkzip. It will
save you up to 30% of disk-space for larger (>100kb) files. You can
download it from
<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 ISO-9660
filesystem as regular files. Usually MPEG III gives you a compression
of 1:10.
Of course, most CD-players are not able to read files... this is the
drawback. On the other hand, why not running the music for your next
party from harddisk? 18 Gbyte are enough for 3000-4000 titles. :-)
A software MPEG III-encoder is available from
<http://www.stud.ifi.uio.no/~larsi/other/8hz-
mp3-cheng.tar.gz>
A MPEG III-player is available from
<http://homepages.uni-tuebingen.de/stu¡
dent/michael.hipp/mpg123/>
For recorded speech, you may want to try to reduce its size using
shorten or "GSM lossy speech compression":
<ftp://svr-ftp.eng.cam.ac.uk/pub/comp.speech/>
<http://kbs.cs.tu-berlin.de/~jutta/toast.html>
4.11. "How to make bootable CD-ROMs?"
You must have an 1.44 MB bootable floppy-disk. Create an exact image
of this floppy-disk by issuing the command
dd if=/dev/fd0 of=boot.img bs=18k
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 mkisofs-distribution.
An interesting application for a custom bootable CD is as a virus-safe
DOS- or Windows-system. It saves you the money for the harddisks (if
you have a network and use samba to put the user-data on a
fileserver). However, this is purely theoretical as nobody reported an
actual recipe to me.
Some details about the bootable RedHat CD-ROM is available from
<http://www.channel1.com/users/rodsmith/rhjol-technical.html>.
4.12. "How to make CD-ROMs writable somehow?"
There is an overlay-filesystem available for Linux, which is mounted
over the CD-ROM and intercepts all writing operations. New and
modified files are stored elsewhere, but for the user it looks like
the CD-ROM is modified. For more information, see
<http://home.att.net/~artnaseef/ovlfs/ovlfs.html>.
If that is not enough for your needs: wait for the UDF-filesystem to
be supported by Linux or help developing it (see
<http://trylinux.com/projects/udf/>.
4.13. "Is it possible to use several writers at once?"
Yes. However, it has been only tested with two writers yet. And you
need a kernel patch for more buffers in the SCSI-generic driver (
<ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/alpha>).
4.14. "Which media is the best?"
The german computer magazine "c't" had a list of tips regarding the
blank CD-Rs in their november 1996 issue:
╖ "No-name" discs are generally not of highest quality and should
better not be used.
╖ If a recordable CD is defective, this is likely to apply to the
whole batch (if you bought more than one at a time); maybe you are
lucky and can at least use the first 500MB of such CD-Rs ...
╖ Don't touch the CD-Rs at their shimmering side before writing.
5. Troubleshooting
Always remember, that you can still use corrupt CD-ROMs as coasters.
:-)
5.1. It doesn't work: under Linux
Please check first if the writer works under other operating systems.
Concretely:
╖ Does the controller recognize the writer as a SCSI device?
╖ Does the driver software recognize the writer?
╖ Is it possible to make a CD using the accompanied software?
If "it doesn't work" even under other operating systems you have a
hardware conflict or defective hardware.
If it works under the other operating system and you use loadlin to
boot Linux, then that is your problem. Loadlin makes a warm-boot with
most of the hardware already initialized and that confuses the Linux-
kernel.
5.2. Error-message: No read access for 'dev=2,0'.
Under Linux, some versions of the C-library are incompatible (buggy),
so that an application linked against one version will not work with
another. An example for an error triggered by pre-compiled binaries is
the following:
[root@Blue /dev]# cdrecord -eject dev=2,0
cdrecord: No such file or directory. No read access for 'dev=2,0'.
5.3. It doesn't work: under DOS and friends
Try to use Linux. Installation and configuration of SCSI-drivers for
DOS is the hell. Linux is too complicated? Ha!
5.4. SCSI errors during the burning phase
Most likely those errors are caused by
╖ missing dis-/reconnect feature on the SCSI bus
╖ unsufficiently cooled hardware
╖ defective hardware (should be detected by 5.1.)
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 CD-R.
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 FAST-SCSI [10MHz] [N/y/?] (NEW) y
allow DISCONNECT [N/y/?] (NEW) y
6. Credits
Alan Brown <alan@manawatu.net.nz>
Art Stone <stone@math.ubc.ca>
had the idea to put non-ISO-9660 filesystems on a CD
Bartosz Maruszewski <B.Maruszewski@zsmeie.torun.pl>
reported spelling mistakes
Bernhard Gubanka <beg@ipp-garching.mpg.de>
noticed the need of a recent version of mount to utilize the
loopback device
Robert Doolittle <bob.doolittle@sun.com>
good arguments for dropping cdwrite from the HOWTO
Brian H. Toby
polished the wording.
Martin Schulze <joey@Infodrom.North.DE>
gave information about the cdwrite-mailinglist
Dale Scheetz <dwarf@polaris.net>
helped improving the section about creating the cdimage.
Don H. Olive <don@andromeda.campbellsvil.edu>
URL of the mkhybrid tool
Erwin Zoer <ezoer@wxs.nl>
Gerald C Snyder <gcsnyd@loop.com>
tested writing of an ext2 CD-ROM (see 4.4)
Janne Himanka <shem@oyt.oulu.fi>
pointer to kernel patch to read Joliet CD-ROMs
Joerg Schilling <schilling@fokus.gmd.de>
information about cdrecord
Jos van Geffen <jos@tnj.phys.tue.nl>
noted the problem in 4.9.
Markus Dickebohm <m.dickebohm@uni-koeln.de>
Jesper Pedersen <jews@imada.ou.dk>
Pierre Pfister <pp@uplift.fr>
helped to develop the recipe on 1:1 copies.
Rick Cochran <rick@msc.cornell.edu>
hint about dis-/reconnect disabled by default in the ncr driver
Stephan Noy <stnoy@mi.uni-koeln.de>
information and experience about writing audio-CDs
Stephen Harris <sweh@mpn.com>
contributed hint about writing audio-CDs
The Sheepy One <kero@escape.com>
suggested using defective CD-ROMs as coasters for drinks
Martti.Rahkila@hut.fi
Reported problem with pre-initialized writers when booting via
loadlin.
End of the Linux CD-Writing HOWTO