Using the DVD and/or CD (Re)Writer.

(improvements to/suggestions for this text are gladly accepted ... the author is no specialist in the art of DVD/CD-writing himself ;-)


Both a DVD (Re)Writer and CD (Re)Writer device are installed in the computer with the scanner attached to (in the room A03.120 where printer p3b is located ). You can use these devices to create/copy your DVD/CD's.

DVD's and CD's are very much alike when it comes to being read from/written to. A typical CD can contain from 650 to 700MB (and some even more), a typical DVD can contain 4.7GB.

Writing a DVD/CD is a 2-step procedure ... and with a DVD/CD-RW optionally prefaced with an extra step to blank the DVD/CD-RW to be able to re-use it.

The first step is to make an image of what you want to put on the DVD/CD. This image contains all required files and directories but in the iso9660-format. This iso9660-format is analogous to other file systems (such as ext2 on Linux, NTFS on Microsoft Windows, ...) but with its own specific details, therefore the translation.

Once you've got such an (iso) image, you can write it to DVD/CD with a simple command.

Instead of using the elementary commands described in the rest of this text, you can of course also use a GUI interface such as cdrtoaster, gcdw, gcombust, graveman, k3b, nautilus-cd-burner, xcdroast ... .

The principle remains the same though: first you have to create an image containing all necessary files and folders, then burn that image to DVD/CD. Usually these GUI interfaces use the elementary commands described in this text, themselves but hidden and behind the scenes.

More information about these GUI tools can be found in their on-line help and/or manual page or on the Internet.

Copying a DVD/CD is done best by first copying the contents of the original DVD/CD as an iso-image to hard disk and then write that image to (another) DVD/CD (see below for the exact commands how to do this).

This does not apply to audio-CD's however ... for those you must put the individual tracks of the CD on hard disk with special commands and then write them to (another) CD. More information about this can be found in the manual pages, on-line help or the Internet.

When copying DVD/CD's do make sure you are not infringing upon copyrights ... illegally copying copyrighted material is an offense.

What you need to know

- what device how and where to mount

Physical DeviceLogical DeviceCommand to mount it withDirectory it will be mounted on
DVD±R/RW/dev/dvdrwmount /dvdrw/dvdrw
DVD-ROM/CD-RW/dev/dvdrommount /dvdrom/dvdrom
/dev/cdrwmount /cdrw/cdrw
/dev/cdrommount /cdrom/cdrom

The latter 3 cannot be mounted together because they all refer to the same physical device ... in fact it doesn't matter how you mount it, the effect of all 3 is the exactly same, just the directory it is mounted on differs.
(you might perhaps prefer to mount a DVD-Rom on /dvdrom, a CD-ROM on /cdrom and a CD-RW on /cdrw, but this is just a feeling and really doesn't matter for the rest)

- /export/home1/dvd
the directory in which you can create (and have ample space available for) iso-images ... use it well (consider putting your files in a sub-directory with name cache, to prevent useless backups) ... when disk space runs low, we reserve the right to remove files/directories as we see best fit.

- DEVICE=...
the (ATAPI or SCSI identification of the) device you want to write to ... double check this setting because you might write to the wrong device when mistaken ... look below to find out how to determine which devices are available on your machine.

- SPEED=16
the speed with which to write ... give it a realistic value ... if taken too high, the chance for write-errors rises ... the cdrecord command will query the actual physical disk you want to write to, to determine its maximum speed however and will adjust the value you specified accordingly.
When write-errors occur, the DVD/CD written to is completely useless ... except as a saucer or Christmas tree decoration ... a DVD/CD-RW can be blanked again (hopefully) for a second (third/next) attempt.
Also mind the difference between CD- and DVD-speed ... speed 16 is (at the time of this writing) unrealistic for DVD's ;-)
Read this for some explanation about CD/DVD speed.

- OPTIONS="driveropts=burnproof"
the options with which to write ... burnproof is a very usefull option ... it minimizes the risk for errors and thus the risk for bad DVD/CD's. The driveropts must be specified as a comma separated list. To get a list of valid options use:
cdrecord -v dev=$DEVICE -checkdrive driveropts=help

DVD±/CD-R[W] discs

The below explanation is our understanding of ... please let us know if you think we made a mistake.
  • CD-R[W] media must be written to using the cdrecord command.
    • CD-R discs are ready for use ... put them in the drive and write ... no worries.
    • CD-RW discs must be blanked before being re-written to ... no need to blank them before first use however.

  • DVD+R[W] media can only be written to using the growisofs tool.
    • DVD+R discs are written to in a way that maximizes compatibility with other DVD-drives.
    • DVD+RW discs must be formatted before first use with growisofs. growisofs detects this and formats if/when/how needed. If you want an explicit (re)format (e.g. to obtain a lead-out or a complete blanking), use dvd+rw-format /dev/dvdrw.
    • DVD+RW discs need not be blanked before being rewritten to ... new sessions overwrite (-Z option with growisofs) or merge (-M option) with the previous one.

  • DVD-R[W] media can be written to using
    • cdrecord-ProDVD, but only in DAO mode (thus the DVD-R[W] disc needs to be in Sequential format).
    • growisofs in both Incremental (thus Sequential disc format) and Restricted Overwrite mode (and thus Restricted Overwrite disc format).

    Initially, DVD-R[W] discs are in Sequential format.

    • DVD-R discs are therefore ready to be written to with either cdrecord-ProDVD and growisofs ... since they are write-once media anyway, DAO is just as good as the other write modes (and maybe even better because of compatibility issues).

    • DVD-RW discs in Restricted Overwrite format need not be blanked before being rewritten to ... new sessions overwrite (-Z option with growisofs) or merge (-M option) with the previous one, just as for DVD+RW discs.
      • Putting a DVD-RW disc in Restricted Overwrite format must be done with dvd+rw-format /dev/dvdrw.

    • DVD-RW discs in Sequential format need to be blanked before a complete new session can be written (using cdrecord-ProDVD or -Z option with growisofs) ... merging additional data (-M option with growisofs and thus only in Incremental Sequential mode) is possible however without blanking (blanking would destroy the initial session and thus there would be nothing to add to anymore ... not what you'd expect with the -M option ;-)
      • Blanking a DVD-RW for DAO mode (cdrecord-ProDVD) can be done with the fast -blank option;
      • Blanking for Incremental Sequential mode (growisofs) needs a lengthy, an hour per 1x media, -blank=full procedure.
      • Blanking must be done with dvd+rw-format -blank[=full] /dev/dvdrw.
      • Blanking a disc currently in Restricted Overwrite format, will put it in Sequential format ... thus you can switch between formats
      • There is (probably) a limit on how many times a disc can be re-formatted.

You can get some information about a DVD-disc by using dvd+rw-mediainfo

Some DVD-drives have difficulties reading discs with no lead-out, others have problems reading discs with less than 1GB ... YMMV ... consult the above web page for more information.

Example commands:

To create an (anonymous) iso-image that can be read on the majority of systems (Unix/Linux, Microsoft Windows, ...):

mkisofs -r -J -U -pad -o image.iso files-and/or-folders

This uses both the Rock-Ridge and the Joliet extensions en thereby removes all owner/group identification and reset the access rights to `sensible' values: no suid/sgid bits, no write access, either no or all execute bits, all read access, ... in this way, you create an anonymous DVD/CD, where all specific details about the original files and folders are removed ... ideal if you want to give the DVD/CD to strangers etc.

For the -pad option, see the explanation with the cdrecord command.

If the input-charset is not specified, utf-8 (detected in locale settings) is used. To avoid this problem, try:

LANG=C mkisofs -r -J -U -pad -o image.iso files-and/or-folders

or equivalent in other (non-bash-compatible) shells.

And lastly, sometimes simple Joliet isn't enough ... mkisofs will tell you when it is needed ... you then need/can use the -joliet-long option as in:

LANG=C mkisofs -r -J -U -pad -joliet-long -o image.iso files-and/or-folders

To create an iso-image where owner/access rights/other details are preserved:

mkisofs -R -J -U -pad -o image.iso files-and/or-folders

This extra owner/access rights info is presumably only useful on Unix/Linux computers, but the DVD/CD as such is readably on other systems (e.g. Microsoft Windows) as well.

If you create the iso-image on another operating system and then copy it to the DVD/CD (Re)Writer machine to write it to DVD/CD, the specific characteristics of that OS and the software with which you created the image of course apply.

Use this method if you want to use the DVD/CD as (long lasting) backup medium.

Extra mkisofs options:

With the -m option for the mkisofs command, you can exclude certain files and/or folders ... they will not be included in the image.

More information about the mkisofs command can be found with `man mkisofs'.

Older versions of mkisofs (like the one on Solaris) do not understand the -U option ... use -R -J -a -d -l -L -N instead.

To create the iso-image on the machine were the files are located and copy it directly to the machine with the DVD/CD writer device, use:

mkisofs -R -J -a -d -l -L -N -pad file(s) | ssh sagitta dd of=/export/home1/dvd/cache/my-image.iso bs=32k

To test/verify/see the image you just created:

There are some utilities which test or lookup file system info of an iso-image:
isoinfo -d -i image.iso
isovfy image.iso

These commands can give you some indication whether an image contains errors or not.

The ultimate test is to mount the image, but only root can do this !

mount -o loop image.iso /mnt
ls -lR /mnt
df /mnt
umount /mnt

To test/verify/see which DVD/CD-RW device is available:

  • For platforms which use the ATAPI interface (e.g. Debian Sarge):

    Identify the device you are looking for by means of:

    cat /proc/ide/hd*/model

    e.g. if you find the device you want to use in /proc/ide/hdd/model, then you must use /dev/hdd as device to write to.

  • For real SCSI devices and/or platforms which use the ide-scsi interface (e.g. Debian Woody):

    Look up the identification of the device you want to use by means of:

    cdrecord -scanbus

    The identification is of the form a,b,c where a is the controller number, b is the device number on that controller and c is the logical unit number of that device (usually 0).

To blank a CD-RW (make it empty to be able to use it again):

cdrecord -v dev=$DEVICE speed=$SPEED $OPTIONS blank=fast

To write an iso-image to CD:

cdrecord -v dev=$DEVICE speed=$SPEED $OPTIONS -pad image.iso

The -pad option instructs cdrecord (and mkisofs) to pad the last block written with zeroes such that the CD can be read on/with (the majority of) other hardware/software. Without this option, some readers fail to read the last block(s) correctly.

To obtain information about the (filesystem on the) CD:

isoinfo -d -i /dev/cdrom

To read the (entire contents of the) CD as an image:

dd if=/dev/cdrom of=image.iso bs=X count=Y

where X and Y are the corresponding values you find with the above isoinfo command: X = Logical block size, Y = Volume size.

To obtain information about the DVD disc:

dvd+rw-mediainfo /dev/dvdrw

To blank/format a DVD±RW:

Please read the above explanation about DVD-discs ... there might be no need to format/blank.

To write an iso-image to DVD:

growisofs -Z /dev/dvdrw=image.iso

the speed with which to write is detected and set automatically according to the drive and disc being used ... if things go wrong, you can consider to use the -speed=1 option to minimize the chance for write-errors.

You also might consider to use the -dvd-compat option to maximize media compatibility for use in other devices.

growisofs -dvd-compat -speed=1 -Z /dev/dvdrw=image.iso

Please note that the -dvd-compat option closes the disk, making it unappendable!

To write an iso-image to DVD-R[W] in DAO mode:

cdrecord-ProDVD -v -dao dev=$DEVICE $OPTIONS image.iso

To append to an already (partially) written DVD:

growisofs -M /dev/dvdrw <mkisofs-options> <files/directories>

the options are the usual mkisofs options (e.g. -R, -J, ...) and you can specify more than one file and/or directory in a single append session.

If you use the -Z option with this syntax, you can write to DVD without first having to create the iso-image ... doing so with files/directories being mounted over the network depends on the stability of the network infrastructure, introduces extra network load, will take more time and thus increases the likeliness of failures.
This -M option is (for the same reason) probably only usefull if the files/directories you are adding are available locally on the machine with the DVD writer device.

To open the DVD/CD tray:

eject /dev/dvdrom

To close the DVD/CD tray:

eject -t /dev/cdrw

To compare the contents of the DVD/CD to/with the original iso-image:

diff /dev/cdrw image.iso