Next Previous Contents

4. Dear Winfried,...

In other words, this is the section usally 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 CD-Rs or is otherwise entertaining.

4.1 How sensitive is the burning process?

Test it. Use the option -dummy to do an empty run of cdrecord. Do everything you would do otherwise and watch if the burning process survives.

If you feed cdrecord directly from mkisofs, then disk intensive processes such as updating the locate-database lower the maximum flow-rate and may corrupt the CD. You better check such processes are not started via cron, at or anacron while you burn CD-Rs.

4.2 Has fragmentation a bad impact on the throughput?

Fragmentation is usually so low that its 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 used 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:

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/cdparanoia/index.html

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/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 necessarily 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=0,6,0 speed=2 -isosize /dev/scd0

you read the data stream from the CD-ROM drive attached as /dev/scd0 and write it directly to the CD-writer.

Second case: you don't have a separate CD-ROM drive. In this case you have to use the CD-writer to read out the CD-ROM first:

dd if=/dev/scd0 of=cdimage

If you are running a recent version of cdrecord, then use the tool "readcd" (found under misc/). Both commands are 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! You have to use cdrdao or cdda2wav 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, even if you have an ATAPI CD-ROM (remember you configured your ATAPI-devices to act like SCSI). 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 give 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/student/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. You need either a recent version of the Linux kernel (2.2.10 as of writing) or a a kernel patch for more buffers in the SCSI-generic driver ( ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/alpha; works up to 2.2.5).

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:

4.15 What about Solaris, *BSD, AIX, HP-UX, etc.?

Only chapter 2 is Linux-specific. 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 cdrecord-distribution.

4.16 Where to store the local configuration permanently?

You have two options. Either you use the built-in configuration file for cdrecord, or you use a shell-wrapper like the one shown below. This shell-script reads a configuration file, which lists the options and parameters for cdrecord line by line. The names are exactly the same as on the commandline, but without the leading -. Comments are allowed. Example:

# be verbose
v
# set the speed of the writer
speed=2
# the device-coordinates 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 commandline. 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...". Everthing 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" ]
    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."

4.17 How can the CD-info be retrieved?

Somewhere behind the first 32 k on the CD, a block with information about the CD is located. You can extract the information with the following shell-script:

#! /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

4.18 What about re-writing

When overwriting CD-RW media, specify the parameter blank=fast to cdrecord. That's all. See the man-page of cdrecord for details about this parameter.

4.19 How to create a multi-session CD?

First of all, the image for a multi-session CD must be formatted using the ISO-9660-filesystem using RockRidge-Extensions. And you must use the option -multi for cdrecord as long as you want to add further sessions. So at least for the first session, you must use -multi.

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 CD-R 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.


Next Previous Contents