|
Softpanorama
(slightly skeptical)
Open Source Software Educational Society |
May the
source be with you,
but remember the KISS principle ;-)
|
Burning CD and DVD on Linux
Gnome's Nautilus permits burning CD. With Nautilus,
it is as simple as drag and drop:
- First, insert a blank CD in the writer. A window will popup
- Drag the files you want to burn into Blank CD-R disk item in the
left menu
- When you have selected all the files you want on the CD, click the
"Write to CD" button on the nautilus menu. You will then get a simple
dialog
- Update the CD name to something meaningful, if you like and hit
"Write files to CD". When the CD is complete, it will eject.
See
Same procedure is applicable to the burning CD/DVD ISO images. Browse
to the desired ISO file and right click on it. You will notice an option
called “Write to Disc…” at the bottom of the menu. Select it.
Alternative way for burining ISO is to use recommendations from
SDBBurning
DVDs with SuSE Linux - openSUSE
Burning DVD-R(W)
You can burn DVD-R(W) with the program dvdrtools, included in
SuSE Linux 8.1 Prof., or with cdrecord-ProDVD from the
cdrecord page.
Please observe the license regulations and copy of the license
key of cdrecord-ProDVD: it is currently free of charge for private
use.
Its operation is almost identical to that of cdrecord on the
command line. First, create an ISO image of the data to record.
By default, mkisofs does not write any files bigger than 2GB. Thus,
you must enter a special option -split-output:
mkisofs -J -v -split-output -o isofile /path_to_files
This generates several 1 GB files, which build an ISO image of
the files at /path_to_files.
Write the DVD-R with
dvdrecord -v speed=4 dev=0,0,0 isofile*
Replace the right device (dev=), which can be detected by using
dvdrecord --scanbus
Adjust the top speed and insert further options, like burn-proof
(driveropts=burn-proof).
A DVD-RW can be deleted again by entering
dvdrecord -v speed=4 dev=0,0,0 blank=fast
or
dvdrecord -v speed=4 dev=0,0,0 blank=all
Burning DVD+R(W)
Unfortunately, SuSE does not yet include any program to write
DVD+R(W). Thus, download the latest version of dvd+rw-tools from
the
dvd+rw tools page and compile it.
tar -xvzf dvd+rw-tools-*
cd dvd+rw-tools-4.1.3.0.3 (the version number can vary!)
make
make install
Medium formatting:
dvd+rw-format -f /dev/scd0
formats the RW medium. This is not necessary in the case of R
media. The drive can be addressed under the device name /dev/scd0.
If you are not sure, use
hwinfo --cdrom
to detect it. Search for your DVD+R(W) drive and check how it
is mounted under "Device file".
growisofs -R -J -Z /dev/scd0 /path_to_files
If there is enough disk space available, some additional files
can be attached with
growisofs -R -J -M /dev/scd0 /path_to_files
Use a separate binary "cdrecord-dvd": cdrecord-dvd -v -data SLED-10-SP2-DVD-x86_64-GMC-DVD1.iso
04-15-2009 | Novell
cdrecord will not burn DVD ISO'sThis document (7003017) is provided
subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Desktop 10
Situation
Executing:
cdrecord -v -data SLED-10-SP2-DVD-x86_64-GMC-DVD1.iso
you will get the similar output:
cdrecord: Found DVD+ media but DVD+R/DVD+RW support code is missing.cdrecord:
If you need DVD+R/DVD+RW support, ask the Author for cdrecord-ProDVD.cdrecord:
Free test versions and free keys for personal use are at ftp://ftp.berlios.de/pub/cdrecord/ProDVD/cdrecord:
Sorry, no CD/DVD-Recorder or unsupported CD/DVD-Recorder found on this
target.cdrecord: This version of cdrecord does not include DVD-R/DVD-RW
support code.cdrecord: If you need DVD-R/DVD-RW support, ask the Author
for cdrecord-ProDVD.cdrecord: Free test versions and free keys for personal
use are at ftp://ftp.berlios.de/pub/cdrecord/ProDVD/cdrecord: Unspecified
command not implemented for this drive.cdrecord: Data will not fit on
any disk.cdrecord: Cannot write more than remaining DVD capacity.Burning
of CD-ROM sized ISO images works fine.
Resolution
Use a separate binary "cdrecord-dvd"
Executing:
cdrecord-dvd -v -data SLED-10-SP2-DVD-x86_64-GMC-DVD1.iso
results in a proper DVD record to DVD media.
There are currently three formats for recordable DVDs:
DVD-RAM: not widely spread in the private sphere, but very often used
in professional environments to store big amounts of data. DVD-RAM is
not compatible with other DVD standards. It requires particular drives.
Pros: easy media handling and data security. Cons: high price.
DVD-R(W): DVD-R was supported by the first DVD writers. Media can be
read with DVD-ROM drives and played by new DVD players (approximately
95% according to the German computer magazine c't).
DVD+R(W): This is the format supported by new DVD writers. In
addition, these media are cheaper to manufacture. The DVD consortium
has not given this format its blessing yet. DVD+R is a standard from
various hardware manufacturers. Media can be read with DVD-ROM drives
and played by new DVD players (approximately 92% according to the German
computer magazine c't).
You can burn DVD-R(W) with the program dvdrtools, included in SuSE
Linux 8.1 Prof., or with cdrecord-ProDVD from the
cdrecord page.
Please observe the license regulations and copy of the license key
of cdrecord-ProDVD: it is currently free of charge for private use.
Its operation is almost identical to that of cdrecord on the command
line. First, create an ISO image of the data to record. By default,
mkisofs does not write any files bigger than 2GB. Thus, you must enter
a special option:
mkisofs -J -v -split-output -o isofile /path_to_files
This generates several 1 GB files, which build an ISO image of the
files at /path_to_files.
Write the DVD-R with
dvdrecord -v speed=4 dev=0,0,0 isofile*
Replace the right device (dev=), which can be detected by using
dvdrecord --scanbus
Adjust the top speed and insert further options, like burn-proof
(driveropts=burn-proof).
A DVD-RW can be deleted again by entering
dvdrecord -v speed=4 dev=0,0,0 blank=fast
or
dvdrecord -v speed=4 dev=0,0,0 blank=all
Burning DVD+R(W)
Unfortunately, SuSE does not yet include any program to write DVD+R(W).
Thus, download the latest version of dvd+rw-tools from the
dvd+rw tools
page and compile it.
tar -xvzf dvd+rw-tools-*
cd dvd+rw-tools-4.1.3.0.3 (the version number can vary!)
make
make install
Medium formatting:
dvd+rw-format -f /dev/scd0
formats the RW medium. This is not necessary in the case of R media.
The drive can be addressed under the device name /dev/scd0. If you are
not sure, use
hwinfo --cdrom
to detect it. Search for your DVD+R(W) drive and check how it is
mounted under "Device file".
growisofs -R -J -Z /dev/scd0 /path_to_files
If there is enough disk space available, some additional files can
be attached with
growisofs -R -J -M /dev/scd0 /path_to_files
Burn Data-CDs
ISO CD images can be burned to CDs by using the program
"cdrecord". You can use it like this with a SCSI
burner:
$ cdrecord -v speed=XX dev=0,Y,0 -data cd_image.iso
XX sets the speed, dev=0,Y,0 is the burners (SCSI)
ID. Run cdrecord -scanbus to view your drive(s) and
their ID(s)
For IDE CD burners (most likely what you got) you
must use -dev ATAPI:/ and add the link to your device:
$ cdrecord -dev ATAPI:/dev/hdc -data cd_image.iso
It is also possible to use a numbered ID when using
IDE/ATAPI: cdrecord dev=ATAPI:0,0,0 Run cdrecord dev=ATAPI
-scanbus to find the valid IDs.
(cdrecord is a part of cdrtools)
3. Mounting ISO Images
.iso images can be mounted as if they were burned
to a CD. This is a quick and good way to test your .iso
images or extract files from them without actually burning
it - the mounted image folder will act like a CD with
the syntax:
$ mount -t iso9660 -o loop [isofile] [mountpoint]
Example:
$ mount -t iso9660 -o loop /path/cd_image.iso /mountpoint/cdrom
You can specify the loop device you want, that it
is not needed. (loop=/dev/loop0).
This only works if you have CONFIG_BLK_DEV_LOOP=m
or y in your kernel configuration.
Or, if you prefer CLI:
for CD-ISO:
wodim your.iso
for DVD-ISO:
growisofs -Z /dev/dvdrw=your.iso
regards,
Paul
Piracy notwithstanding, there are some good, valid reasons for making
a backup of a DVD. K9Copy,
a utility for copying DVDs, receives
high marks
in many forums, so I took it for a spin -- and found out its reputation
is deserved.When I travel, I like to view movies on my laptop, but
I'm not too keen on taking the original DVDs along; I prefer downloading
them to the hard disk and keeping the originals at home. Also, if you
have small kids, you know that DVDs probably won't be treated well,
so making a backup copy makes good sense. Note, however, that laws differ
in each country, and even such fair use might be prohibited where you
live.
When using K9Copy to copy a DVD, you can either keep the original
menu structure on the disc or create a new one. You can also create
an ISO image or compress the original video (producing an
AVI file, for example)
and store it on your hard disk or burn it to a CD. K9Copy is licensed
under the
GNU General
Public License (GPLv2), so it's fully open source and also free
of cost.
The latest version of the program is 2.0.2, from June 2008, for KDE
4; if you're still using KDE 3, use version 1.2.3 from January 2008.
About: ISO Master is an easy to use GUI CD image editor for
Linux and BSD. Basically, you can use this program to extract files
from an ISO, add files to an ISO, and create bootable ISOs, all in a
graphical user interface. It can open both ISO and NRG files, but can
only save as ISO. It is based on bkisofs, a library for reading, modifying,
and writing ISO images.
Changes: This release adds Belarusian and Estonian translations.
It fixes a couple of serious bugs to do with floppy emulation boot records
and extracting files from very large images.
About: Asunder is a graphical audio CD ripper and encoder
for Linux. You can use it to save tracks from an audio CD as WAV, MP3,
OGG, and FLAC. It has CDDB support and can create M3U playlists. It's
independent of any desktop environment. It can rip and encode at the
same time. It aims to make CD ripping as quick and easy as possible.
Changes: This release adds Polish and Japanese translations.
It adds BSD support. A serious bug that could cause encoding to stop
working has been fixed. There are some usability improvements.
|
About: ISO Master is an easy to use GUI CD image editor
for Linux and BSD. Basically, you can use this program to extract
files from an ISO, add files to an ISO, and create bootable
ISOs, all in a graphical user interface. It can open both ISO
and NRG files, but can only save as ISO. It is based on bkisofs,
a library for reading, modifying, and writing ISO images.
Changes: This release adds Hebrew and Indonesian translations,
makes a few usability improvements, adds a couple of features,
and fixes some minor bugs.
|
This cookbook is designed to help notebook users burn ISO images
onto CDs and validate the contents.
While burning ISO images onto CDRs is a part of the Linux culture,
not all of the distributions address validation of this process in the
same manner. We need to burn ISO images with increasing regularity,
and we may be burning them from a platform running Linux or the Solaris
OS. So let's take a few minutes and review the process and see what
we can do to validate the bits that actually make it to the optical
disc.
The fundamental question is, how do you know your burn was successful?
The trivial answer would be, the exact same way you validate your
ISO image download from the network, by using MD5 checksums. Unfortunately
the answer is not quite as simple as that. In other words, a rather
obscure problem might prevent you from validating a CDR in this manner,
and it could leave you very frustrated.
First, here's an example where I am burning the Sun Java Desktop
System beta documentation ISO image. The unimportant lines have been
edited out for readability.
First, let's select a CD-RW device:
# cdrecord --scanbus
Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jörg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.7'
scsibus2:
2,0,0 200) 'SONY ' 'DVD RW DRU-510A ' '1.0a' Removable CD-ROM
2,1,0 201) 'SAMSUNG ' 'CD-R/RW SW-248F ' 'R602' Removable CD-ROM
Now, let's burn the ISO image to a CDR. Four important
cdrecord options can make your experience
a lot more pleasurable.
speed=<n>: This will set the speed
of the write. Unless forced, cdrecord
will limit this by the media speed, if it can be determined. In
this example I am using 40x CDRs, and a 48x capable IDE writer.
driveropts=burnfree: This enables
buffer underrun protection. This is the most frequent cause of failed
burns (which we affectionately call coasters). Most modern drives
have a form of underrun protection and this command option enables
support for it. Many other tools, such as cdrdao,
enable burnfree by default; cdrecord
does not.
-dao: This tells
cdrecord to write the disc in 'session
at once' mode, sometimes called 'disc at once'. This will tell the
laser to burn the lead out area so that no more data can be written
to the device, effectively closing it permanently. Like burnfree,
the default is not your favor, as we will see in a few minutes.
For now, let's use -dao and see what
happens.
-eject: This will eject the CD-ROM
media at the end of the write operation. If you forget to do this,
you will not be able to calculate the correct MD5 checksum, and
you will be left thinking you are having problems burning CDs.
Time to burn the CD.
# cdrecord -v dev=2,1,0 speed=40 driveropts=burnfree -dao -eject MadHatter-Beta-Docs.iso
Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jörg Schilling
TOC Type: 1 = CD-ROM
scsidev: '2,1,0'
Starting to write CD/DVD at speed 40 in real SAO mode for single session.
BURN-Free was 11 times used.
cdrecord: fifo had 1760 puts and 1760 gets.
cdrecord: fifo was 0 times empty and 911 times full, min fill was 95%.
So now let's compare checksums.
# md5sum /dev/cdrom3 MadHatter-Beta-Docs.iso
8831242df75ea5bdc2c56e7f0e9830d3 /dev/cdrom3
8831242df75ea5bdc2c56e7f0e9830d3 MadHatter-Beta-Docs.iso
Outstanding! No coaster.
So what's the big deal?
If I had not specified -dao (session at
once mode) and taken the cdrecord default
recording mode (track at once), the following would have happened:
# md5sum /dev/cdrom
md5sum: /dev/cdrom: Input/output error
Further stubborn attempts at verification might produce something
like:
# dd if=/dev/cdrom bs=2048 | md5sum
dd: reading `/dev/cdrom': Input/output error
269860+0 records in
269860+0 records out
7c996f932254bfae7a24a1fba14e57bb -
And you would be convinced you had a coaster.
The problem is that the last block may be confused with the lead
out area, and some drives will not read it properly. Thus your MD5 checksums
will fail. You can pad the last blocks using the
-pad option of cdrecord, but your
checksums still might not match as you have added additional data to
the CD that was not present in the original ISO image.
Of course you could loopback mount the original ISO image, mount
the newly burned CDR, and do something like this:
# mount -o ro,loop -t iso9660 `pwd`/MadHatter-Beta-Docs.iso /mnt
# mount -o ro -t iso9660 /dev/cdrom /media/cdrom
# diff -r /media/cdrom /mnt
If nothing is reported, you are good to go. If you are doing this
on a laptop with a single ATA drive and not much memory, you don't want
to do this very often. It is a rather resource-intensive way of validating
your ISO image. But then again, you may find the sound of popcorn popping
in a microwave oven pleasurable.
So the moral of the story is to remember to pad the last block with
-pad or better yet, write your CDRs in 'session
at once' mode using -dao, and then use
md5sum to compare with the original ISO binary
image.
So far we have talked about Linux; what about the Solaris OS?
A patch (107645) for the Solaris 7 OS fixes the partial-last-block
read problem. It was integrated into the Solaris 8 OS, so later releases
do not have this particular problem.
As for MD5 checksums on the Solaris platform, find a copy of
gmd5sum (it is on the companion CD).
One last note, make sure you enable DMA mode on your CD writer device.
Most Linux distributions, including the Java Desktop System, turn DMA
off by default. You can enable DMA via boot options, a Yast2 setting,
or by the DEVICES_FORCE_IDE_DMA_ON variable
in /etc/sysconfig/hardware.
You can increase the responsiveness of a laptop by enabling 32-bit
EIDE support and unmasking interrupts.
# hdparm -d1 -c1 -u1 /dev/hdc
This enables DMA and 32-bit EIDE support, and it allows disk interrupts
to be interrupted.
Linux offers powerful, flexible tools for creating CDs. You can create
disks that are readable on almost any platform and create .iso files
for download and distribution.
Burning CDs from the command line on
any platform can be mysterious and vexing, and this is certainly true
on Linux. However, the commands and terminology are similar enough across
platforms that it's useful to learn how to write CDs on Linux. A lot
of Linux software is distributed via .iso images, so if you know how
to burn your own CDs, you can download the .isos to create your own
installation disks.
CD-writing programs are available
for both Linux and Windows, but the Linux versions are more powerful
and versatile than their Windows cousins. In this article, we'll look
at mkisofs
and cdrecord,
the workhorses of Linux CD recording.
mkisofs creates
a pre-mastered image, to generate an ISO9660/JOLIET/HFS hybrid filesystem.
It both creates and populates a filesystem. Unlike other data storage
media such as hard drives and floppy drives, a filesystem on CD is not
first created, then populated with data. There is only one chance with
a CD-R: formatting it first would create a disk with an empty filesystem.
cdrecord
records data on Orange Book CD-R/RWs, which is pretty much all
of them.
With newfangled technology like
CD recording, newer versions of these programs are best.
mkisofs and
cdrecord
should both be 1.10 or newer. The latest version of
cdrecord, version
2.0, has been renamed cdrtools.
To find the versions installed on your machine, type:
$ cdrecord --version
and
$ mkisofs --version
For those who are new to the world of
recordable CDs, here are a few things worth knowing before we press
on:
- CD-R:
CD-Recordable. These are WORM (Write Once, Read Many).
- CD-RW:
CD-Rewritable. These are WMRM (Write Many, Read Many).
- CD-Rs are universal and should be
readable in any CD-ROM drive.
- CD-RWs should be readable in all
contemporary drives. A drive must be "multiread" to be able to read
CD-R and CD-RW disks. Older drives are troublesome. Retire that
old 4x drive and buy a new one; it's not worth the irritation.
- Commercial CDs are pressed, not
burned with a laser.
- Which CD-R/RW drives are best? Visit
the usual hardware reviewers for advice.
And, a few terms related to file formats:
- Yellow Book:
Physical format for data CDs
- Orange Book:
Physical format for recordable CDs:
- Part I:
CD-MO (Magneto-Optical)
- Part II:
CD-WO (Write-Once; includes "hybrid" spec for PhotoCD)
- Part III:
CD-RW (Re-writable)
- ISO-9660:
The old file layout standard, allowing only 8.3 filenames
- Rock Ridge:
Extensions to ISO-9660 allowing long filenames and UNIX-style symlinks;
preserves all file attributes, such as ownership and permissions.
UNIX file attributes are not displayed when the disk is read on
a Windows system.
- Joliet:
Microsoft extension to the ISO 9660 filesystem that allows Unicode
characters to be used in filenames, as well as long filenames. It
also creates truncated filenames for MS-DOS compatibility (these
weird-looking things: FILENA~1.TXT). It allows filenames up to 64
characters, including spaces, and is readable by Windows 95 or later,
and Macintosh computers running the Joliet Volume Access extension.
Macs will not read Joliet file names longer than 31 characters.
- El Torito:
Bootable CD-ROM format specification
- HFS (Hierarchical File
System): Native file system used by Macintosh
- Multisession:
Allows adding files over time, rather than during a single session.
For a disk to be readable, the session must be "closed." However,
this prevents adding more files to the disk. Multisession links
the individual sessions and update the disk's table of contents
so that it appears as a single directory.
- CD-UDF (Universal Disk
Format): Industry-standard incremental
packet-writing filesystem
A brief word on UDF: UDF means being
able to drop files directly onto the disk. Currently, this is done at
the software level. Reading the disk requires the software used to create
it. UDF is in the works to be added to the Linux kernel, probably 2.6.
CD drives need CD-MRW circuitry ("CD Mount Rainier ReWrite"; don't ask
me how they choose these names) for this to work, so it will be a feature
of new drives. When this is implemented, copying files to CD-R/RW will
be as easy as copying to a floppy disk, and the disks will be universally
readable. This is touted as yet another replacement for the venerable
3.5" diskette. We'll see. (See Resources for
a link to more information on Mount Rainier.)
Linux SCSI emulation adventures
Use either an IDE/ATAPI or SCSI CD writer if you can. Parallel port
interface is a horrid kluge asking for trouble, and USB drives are slow.
Neither is well-supported in Linux (although you might have better luck
with the newer USB 2.0 drives).
IDE/ATAPI drives, which are the
most common, need a bit of tweaking to work. So, what happens if
cdrecord
shows no drives configured? To check, type this:
$ cdrecord -scanbus
If it displays your CD-RW drive (see
Burning the disk, below), you can skip most
of this section, although you might want to skim through anyway for
your own information.
Linux uses a SCSI emulation subsystem,
so IDE/ATAPI CD-writers need compatibility drivers. If there is a CD-ROM
and a CD-R/RW on the same PC, both need to use the ide-scsi pseudo device
driver to enable copying disks. There is no downside to using the SCSI
emulation on a CD-ROM; it will work just the same; only the name will
change. Depending on your particular flavor of Linux, the drive designation
will change from something like /dev/cdrom0, or /dev/hdc, to /dev/scd0
(see Table 1 for a list of IDE/ATAPI device names).
Table 1. IDE/ATAPI device names
| Name |
Device |
| hda |
IDE bus/connector 0 master device |
| hdb |
IDE bus/connector 0 slave device |
| hdc |
IDE bus/connector 1 master device |
| hdd |
IDE bus/connector 1 slave device |
To find drives on your system, type:
$ dmesg | grep '^hd.:'
hda: IBM-DTLA-305020, ATA DISK drive
hdb: TOSHIBA DVD-ROM SD-M1202, ATAPI CD/DVD-ROM drive
hdc: LITE-ON LTR-24102B, ATAPI CD/DVD-ROM drive
hda: 40188960 sectors (20577 MB) w/380KiB Cache, CHS=2501/255/63, UDMA(66)
Most modern Linuxes come with the SCSI
emulation already compiled into the kernel:
$ locate ide-scsi.o
/lib/modules/2.4.19/kernel/drivers/scsi/ide-scsi.o
If your system does not have this, you'll
have to compile it into your kernel. That is way too big a subject for
this wee article, so please see Resources (it's
not hard, when you know how).
You'll need to edit two text files to
configure the system to use the ide-scsi driver. The first is /etc/modules.conf
(in Debian, /etc/modules). My system has a CD-ROM and CD-R/RW drive,
hdb and hdc. Add these lines to /etc/modules.conf (or /etc/modules)
using values appropriate for your system:
ide-cd ignore=\"hdb hdc\"
ide-scsi
By default, the IDE subsystem claims
all ATA devices for its own, so the
ignore line enables the SCSI subsystem
to grab both the CD-R/RW and CD-ROM.
Next, edit the configuration file for
your bootloader, GRUB or LILO. For LILO users, add the following to
the end of lilo.conf:
append="hdb=ide-scsi"
append="hdc=ide-scsi"
For GRUB users, add the following
to /etc/grub.conf (or in Debian, /boot/grub/menu.lst) at the end of
the kernel
line:
hdb=scsi hdc=scsi
Now reboot and verify that it has loaded:
$ lsmod
This will return a long list; look for
ide-scsi.
Creating an .iso file
Once you've selected the files you want to copy, writing to a CD consists
of two steps: creating an .iso with
mkisofs, then burning to disk with
cdrecord.
Use the following to create the .iso file:
$ mkisofs -o test.iso -Jrv -V test_disk
/home/carla/
In this example:
-o
names the new .iso image file (test.iso)
-J
uses Joliet naming records, for Windows compatibility
-r
uses Rock Ridge naming conventions for UNIX/Linux compatibility,
and makes all files publicly readable
-v
sets verbose mode, for a running commentary as the image is created
-V
provides a volume ID (test_disk); this is the disk name that shows
up in Windows Explorer
- Last in the list are the files selected
for packaging into the .iso (everything in /home/carla/)
Now, mount the .iso for verification;
I like to create a test directory:
$ mkdir /test_iso
$ mount -t iso9660 -o ro,loop=/dev/loop0 test.iso /test_iso
Look at the directory contents; all your
files should be there and readable. If they are not, the image is bad,
and if you burn it onto a disk, you'll end up creating a coaster.
Burning the disk
Writing the image to disk is easy as pie. First find the SCSI address
of your CD-R/RW:
$ cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jrg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'TOSHIBA ' 'DVD-ROM SD-M1202' '1020' Removable CD-ROM
0,1,0 1) 'LITE-ON ' 'LTR-24102B ' '5S54' Removable CD-ROM
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *
The first three numbers for each
item refer to SCSI bus, device ID, and LUN (Logical Unit Number), respectively.
(The fourth number is the device ID again.)
cdrecord wants these
three numbers. In this example, the CD recorder is 0,1,0. Anything on
SCSI bus 0 can be shortened to 1,0, leaving off the first 0. This is
a common convention. Additional buses, if any, must be specified --
no shortcuts.
Now write to disk:
$ cdrecord -v -eject speed=8 dev=0,1,0
test.iso
In this example:
-v
is verbose
-eject
ejects the disk when finished
-speed
specifies write speed (8)
-dev
is the device number (0,1,0) obtained from
cdrecord -scanbus
- Last is the name of the image being
burned (test.iso)
This is a simple, serviceable way
to create disks for public distribution, as it creates a disk that can
be read on any Windows or Linux system.
mkisofs alone is
good for creating .isos for download, and
mkisofs is capable
of creating filesystems for many platforms. Please see
mkisofs man pages
for more information.
On a fast machine with lots of memory,
you can get away with doing low-CPU-intensive tasks during recording,
but it is better to do nothing else during a burn. The laser is not
capable of stopping and then picking up where it left off, so any interruptions
are fatal.
cdrecord
will try to run the recorder at its highest speed, so it is not necessary
to specify a speed, but let experience be your guide. Specifying slower
speeds is useful for correcting errors and buffer underruns. Newer drives
with "burn-proof" technology (the opposite of what it's supposed to
do; again, who comes up with these names?) are not plagued by buffer
underruns as older drives are.
Copy disk
To directly copy from the source disk to the recordable disk, use this
command:
$ cdrecord -v dev=0,1,0 speed=4
-isosize /dev/scd0
This command directly streams the contents
of the CD-ROM, /dev/scd0, to the CD recorder, dev=0,1,0. Don't do this
on an old, slow machine. Direct copying is fast, but more error-prone.
It is better to first copy the source disk to a hard drive, then copy
from the hard drive to the CD recorder:
$ mount /cdrom
$ dd if=/dev/scd0 of=/tmp/diskfile.iso
$ cdrecord dev=0,1,0 speed=8 fs=8m -v -eject -dummy /tmp/diskfile.iso
Notice a couple of new options,
fs=8m
and -dummy.
fs=8m
defines the size of the ring buffer: the bigger the better, up to a
point. Remember, interruptions are fatal;
fs=8m creates a
large enough buffer to keep the recorder working if something slows
down the data transfer. If 8 MB isn't enough, you might need a better
PC. On the other hand, more than 8 MB is not necessarily better, as
the operating system can waste time reloading the MMU (Memory Management
Unit) tables. The default is 4 MB.
-dummy
is a marvelous option for doing a dry run before risking an actual disk.
The recorder does everything with the laser turned off, giving the user
a chance to catch errors before committing them to disk.
Multisession
CDs are built with sessions, and sessions are divided into tracks. On
a single-session disk, there is a lead-in, a single TOC (table of contents),
the data, and a lead-out, which finalizes the disk and prevents further
recording on the disk. mkisofs
links the separate sessions together. Creating multisession disks may
be easier with GUI programs like X-CD-Roast or KonCD, but here's how
command-line commandos do it.
The first time you record a session
on a disk, use the -multi
switch in cdrecord:
$ cdrecord -v -eject speed=8 dev=0,1,0
-multi test.iso
The disk will be fixated in a manner
that makes it readable and open for adding more data. To add more sessions
to this disk, mkisofs
needs to know the starting and ending sector numbers, which you can
find like this:
$ cdrecord dev=0,1,0 -msinfo
0,27139
Be sure to have the disk you are
adding data to in the CD recorder. Then add two new switches,
-C and
-M:
$ mkisofs -o test2.iso -Jr -V Session2
-C 0,27139 -M 0,1,0 /files/path/
Or better, let the command shell do the
work:
$ mkisofs -o test2.iso -Jr -V Session2
-C `cdrecord dev=0,1,0 -msinfo` -M 0,1,0 /files/path/
Multisession CD drives read the
last session written. This command takes the TOC from the last session
and combines it into the new TOC. For the last session on the disk,
omit the -multi
option.
Conclusion
CD writing in Linux is powerful and versatile. CD recorders can be shared
over networks and used in automated backups;
mkisofs and
cdrecord
also work with DVDs. Although there are many good graphical front ends,
complete functionality is at the command line.
Resources
- Check out the
CDRecord home page for information on downloads, bug reporting,
FAQs, and everything else related to
cdrecord.
- Find more information on
Mount Rainier
at mt-rainier.org.
- The
Linux Kernel HowTo is a guide to compiling, upgrading, and troubleshooting
Linux on x86.
- The "Super
quick guide to compiling a kernel" offers a good refresher if
compiling the Linux kernel is something you need to do.
- Andy McFadden's
CD-Recordable
FAQ answers countless CD-R questions, both general and specific.
- For a specialized and highly useful
Linux distribution on a single, bootable CD-ROM, read about Knoppix
in "Knoppix
gives bootable, one-disk Linux" (developerWorks, February
2003).
- If you're just getting started with
Linux, "Basic
tasks for new Linux developers" (developerWorks, January
2003) shows how to log in/out, mount/unmount CDs, and open shell
windows, among other tasks.
- For a complete listing of CD-ROM
and CD-RW drives for IBM personal computing systems, go to the
Storage Accessories and Upgrades page.
- Find more
resources for Linux developers in the developerWorks
Linux zone.
About the author
Carla Schroder is a freelance PC tamer, administering Linux
and Windows systems for small businesses and writing how-tos
for real people. Carla discovered computers and high-tech around
1994, and is living proof that self-taught middle-aged persons
make fine computer gurus. You can reach her at
dworks@bratgrrl.com. |
[July 30, 2002] Burning CDs in Linux: Tips and Tricks by
Dee-Ann LeBlanc
Not all CD-ROMs burn cooperatively. I've
especially run into problems lately trying to burn a distribution beta
onto CD-ROM, and there's a few interesting issues that came up while
trying to solve the problem:
- Large CD-ROM images can be fussier
than we think. If you're consistently having trouble with disks
burned at your burner's faster speed, drop the speed down quite
low, say to only 4X.
- If your CD burning software has
a verification feature, this may not be enough to check a subtle
problem with a burn! Some Linux distributions are starting to answer
this need. For example, Red Hat Linux provides a function in its
installation routine called "mediacheck," as of version 7.3.
- If you're having consistent problems
getting CD-ROMs burned and can't stand to deal with the slow speed
fix, consider getting a CD-ROM drive that contains BURN-Proof (tm)
technology. The BURN stands for Buffer UnderRuN, which is a term
that refers to how we make nice shiny coasters when the buffer containing
the next bit of data to burn to the CD-ROM is empty or the machine
is too busy to send the data, and the CD writer just merrily goes
along and writes junk to the media. BURN-Proof burners have a massive
buffer and have the ability to stop and wait for more data. There
are a number of products and sites that support and contain up to
date information about what's happening in this product area, a
quick Google search on "burnproof" is pretty educational.
The latest versions of cdrecord support
BURN-Proof.
Dee-Ann LeBlanc has written
over 10 computer books, over fifty articles, taught classes, and more,
mostly involving the Linux operating system and its programs. Her latest
book is Linux Routing from New Riders.
You can reach her at dee@renaissoft.com,
or find out more at
http://www.Dee-AnnLeBlanc.com/.
«
Back:
This Does Not Have to Be Difficult
About:
Magma is a bash script designed to make CD burning at the console easier.
It supports burning normal data CDs, audio CDs, blanking CD-RWs, multisession,
and more.
Changes:
Some more functions and some documentation updates.
(Oct 11, 2000, 06:31 UTC) (2424 reads) (4 talkbacks)
(Posted by marty)
"CD-Writer are very common these
days and can be seen on most desktops. Linux, as with most things, doesn't
make things very easy for you. I've suffered through it so you don't."
"If you don't want to support
an obsolete drive, or an older kernel, or VAX VMS, then you probably
don't need to recompile the kernel or make any devices. This short document
should be sufficient to get you started burning disks. Once you are
started, the official documents will guide you to such esoterica as
audio, bootable, multisession and hybrid disks."
"Burning cd-roms under linux is just as easy as it is under Windows,
probably easier."
(Aug 13, 2000, 14:04 UTC) (461 reads) (2 talkbacks)
(Posted by mhall)
"Most of us know about cdrecord
and mkisofs and front-ends to those two tools. These tools are very
powerful and can do alot of things but one thing they aren't able to
do is record an exact copy of a compact disc."
In case of broken links
please try to use Google search. If you find the page please notify
us about new location
Hardware setup:
Of course Linux must be up and running on your computer and you need a CD
burner to do the job.
If you have a SCSI CD burner chances are very good that your burner is immediately
recognized by the kernel. You only have to check whether your SCSI hostadapter
is supported by Linux (see the
hardware database for
this). All SCSI CD writers will work under Linux.
For an ATAPI/IDE burner you have to configure SCSI emulation to make your
burner look like a SCSI device even though the hardware is physically connected
via the IDE bus. How to do this is e.g described in the
README.atapi file from xcdroast and we also recommend you to read the
CD Writing HOWTO at
linuxdoc.org
For USB burners see the USB-CD Writer HOWTO at
mobilix.org/linux_usb_cd.html.
As we both only have experience with SCSI burners we could only repeat what
we have read there.
Software to burn CDs:
For burning CDs you need the following programs:
- cdrecord: this is the program that actually communicates with your
CD writer.
- mkisofs: you need it for making data CDs. It is used to generate
a file system image for the CD called ISO image.
- cdda2wav: this is needed to read digital audio data from audio CDs.
All three are included in the cdrtools package you can download from
www.xcdroast.org
or ftp.fokus.gmd/pub/unix/cdrecord/
With these tools you can already burn your CDs using the command line. But
if you want a nicer and friendlier graphical user interface you need one
of the frontends in addition. There are a lot of frontends available but
in this article we will only talk about xcdroast (http://www.xcdroast.org)
and koncd (http://www.koncd.org/).
xcdroast seems to be the frontend with the most possibilities and we like
koncd because it is really very easy to use.
Installation
In many cases xcdroast will already be installed on your computer but at
least with the RedHat distribution it is compiled with the pam-library which
means it will always ask you for the root password if you want to burn CDs
and you probably don't want to give the root password to all users who want
to burn CDs. A second drawback is that it will not allow you to start the
program remote over a network. Therefore it is better to download the latest
version from http://www.xcdroast.org. This should be straight forward as
there are pre-compiled packages for most of the common distributions available.
koncd can be downloaded from www.koncd.org. Recent versions of koncd rely
on new QT/KDE features. If you don't want to spend time updating your QT
and KDE libraries you can use an older version of koncd. For this article
we have used koncd-0.7.5 running under redhat 7.1.
Burning CDs as a normal (non-root) user
To burn CDs you first of all must have write permissions to the /dev/sg*
devices which are used for the communication with the hardware. But cdrecord
also uses some realtime extensions to avoid buffer underruns during the
writing process that require root permissions as well. The best solution
is therefore to use SUID on cdrecord and cdda2wav. Uhh? SUID? Don't worry.
You can read Guido's article on
file permissions if you want to know exactly what it is but for the
moment it is sufficient if you type in the following two commands and then
forget about it again :-)
chmod 4111 /usr/bin/cdrecord
chmod 4111 /usr/bin/cdda2wav
Be aware that this could be a potential security risk but it is definitively
less of a security risk than telling everybody who wants to burn a CD what
the root password is.
Now you can test if your CD writer is recognized correctly. Just run:
cdrecord -scanbus
If everything is alright then you should see something like:
0,6,0 6) 'PLEXTOR ' 'CD-ROM PX-W8220T ' '1.03' Removable CD-ROM
The numbers and the description may be different dependent on your hardware
setup.
Alternatively you can also click on the SETUP button of xcdroast or koncd
and check there if your burner is recognized correctly.
So let's now finally start burning a CD.
General notes on burning CDs
There are four necessary steps to write CDs:
- You have to select the data/music you want to burn on CD
- You have to set some options for the CD that is going to be burned.
For example when you want to burn an audio CD you have to choose between
TAO and DAO mode or for a data CD you have to set some options for the
filesystem.
- You must create an image directory with the files you want to burn
on CD. If you only want to duplicate another CD completely you will
"write on the fly" otherwise you have to create an image on harddisk
first.
An image directory is a temporary storage place for the data that will
be written to the CD. For audio CDs these are index files and the wav
files containing the music and for data CDs this is a big file called
ISO image.
- You actually burn the CD.
CDs generally need to be written in "one go" and the data flow needn't
be disturbed during the writing process. Thanks to the realtime extensions
buffer underruns who lead to faulty CDs are only a problem of windows users.
With Linux you don't really need "burn proof". There is a special buffer
called FIFO inside the CD writer to compensate for small disturbances which
is usally enough to avoid burn failures under Linux. Nevertheless you should
be cautious and don't do things that need too much CPU power. You can browse
the web, compile software, ... but deleting a large file can be a problem
and maybe is enough to disturb the process which then results in a faulty
CD.
If you are concerned about buffer underruns you can use the simulation write
(dummy write) option to first test if the CD writing would work before actually
burning it. There the burning process is tested with real data but the laser
inside the CD writer is turned off. It is always better to run a test first
than to have to do it all over again.
The fact that you usually have to burn in "one go" which means that if you
have forgotten something, even if it is only a single small file you have
to burn the CD again. There is the possibility of multisession where you
can add something later but we won't talk about it here because with multisession
you can't read the CD on many CD writers as long as it is not ready and
as the prize of one CD is so low we never had a reason to use it.
Setup
When you start koncd or xcdroast you will recognize that both of them
have a setup button. Here you can find out if your burner is recognized
correctly and set general options.
Let's look at the setup of xcdroast and koncd:
- xcdroast:
The first time you will get a pop up window saying that root should
start the program first and configure it so that not every single user
has to do it all over again.
- Device Scan: here you will see all devices connected to your
SCSI bus.
- CD settings: here you can select your CD burner and the device
where the data/music should be read from.
For "CD writer mode" you have to give the right driver but usually
"autodetect" should be okay. CD Writer FIFO Buffer size: this depends
on your hardware. You have to look at the manual of your writer
for its size. Common values for that buffer are 4MB or 8MB.
As a CD must be written without an interruption in the data flow
(due to the design of CD burners) there is a buffer (=FIFO) which
avoids that just because of small disturbances the burning process
will fail.
- HD settings: Here you need to specify a temporary storage directory
for the ISO image. There should be more than 800MB of free space
available (you can check your free space with the shell command
df -k /the/directory or by using a file manager).
- Miscellaneous:
- Audio: this is only of interest if you want xcdroast to
play the songs, it doesn't have any influence on the burning
process. DSP stands for digital signal processor and it is the
part that will send sound to the loudspeaker.
- Network: for a lot of CDs there are information about their
titles available from a database in the internet. When burning
your CD you can ask for this information which can save you
a lot of typing work if you want.
- Logging: to create a log file
- Internationalization: here you can choose your language
and everything will be in your chosen language then.
- Options: here you can e.g. set if you will get tips on the options
buttons when you go over them with your mouse pointer. Especially
if you don't know the program very well we recommend to have these
tips.
- Users: This panel appears only if you are logged in as root.
Here you can define what normal users are allowed to do.
- koncd:
You see the devices that koncd automatically detected in a selection
box. You can tell the program to which writer it should write when burning
(this should be your CD burner) and from where it should read CDs. This
could be your CD ROM or if you only have this one CD burner then this
can be used for reading and writing CDs.
You can also select "burn proof" here if it is supported by your CD
burner. Burn proof slows down the speed of your writer when the FIFO
(see above) is almost empty.
(Pure) music (audio) CDs
Here you should think about the format a little bit first. If the song
is from another CD there is no problem. You can just go on and copy it.
But otherwise you should notice that cdrecord recognizes au and wav files
and converts them automatically to the right format to play it on your CD
player but for other formats you need to convert them to wav first if you
later don't want to hear only noise on your CD. To convert a file from mp3
to wav you can do the following on the command line:
mpg123 -w /tmp/song.wav song.mp3
This allows you to make normal audio CDs from mp3 music. It takes more space
but can be played in almost every CD player.
When finally burning the CD you can choose whether you want the copy to
be in TAO or DAO mode. In TAO mode you will have 2 seconds of a pause between
each song while you don't have that in DAO mode which makes it the mode
of choice for live music recordings. TAO= Track at Once and DAO= Disk at
Once.
You can copy a CD completely or mix songs from different CDs, or other sound
files e.g. downloaded from the internet.
Let's first see how you can copy a CD without changes:
- xcdroast:
Select "Duplicate CD".
You get a menu on the left side where you can see:
CD/Image Info, Read Tracks, Verify CD, Play Audio-Tracks:
We don't know why these menu entries are available. They don't make
sense if you just want to duplicate a CD. At least in the version used
for this article (xcdroast-0.98alpha9) xcdroast only allows you to do
a "write on the fly" for which you only need the "Write CD" menu. Therefore
go directly to "Write CD".
Write CD:
- On top you again have to specify the device to read from and
its speed. Next select the CD burner and its speed. The speed of
the reader should be a bit higher than the writing speed (to avoid
buffer underruns).
- Left you see "CD to write":
This is just for your information. You have no other choice than
"write on the fly".
- Right you see "write parameters":
CD R/RW type: here you have to specify how many minutes will fit
on the CD you are burning the music onto
and then you have to choose between TAO or DAO mode (see above).
You can then decide to make a simulation write first (see above)
and if you want the CD to be ejected after the burning is finished.
"Pad tracks" is not important when duplicating CDs.
With "Blank CD-RW" you can delete rewritable CDs and finally with
"WRITE CD" you can burn your CD. That's it.
- koncd:
Choose "Copy CD".
On top you can delete the content of a rewritable CD and set the burning
speed. Under "options" you don't need to select anything. Press "START"
and the burning begins.
Let's now look what you have to do if you want to burn a CD with music from
various places:
- xcdroast
Now you have to select "Create CD".Let's look at the menu:
- CD/Image info:
On the left side you see the content of the CD that is read from.
On the right side you see the content of the image directory if
you have anything in there. There is nothing to do here. Go straight
to "Read Tracks"
- Read Tracks:
On top you have to choose the device where the music should be read
from and the image directory. Now in this case the tracks will be
written as individual wav files and not as a single big image file.
For music CDs you should not go too high in speed because audio
CDs are only specified to be read at "1 x" speed and a higher speed
increases the occurence of bit errors which reduces the quality.
However a speed of "4 x" or "8 x" should be ok.
To read the music tracks to the image directory select the tracks
you want to copy and then press READ SELECTED TRACKS.
- Verify CD:
If you press the VERIFY button it is verified that the reading of
the music tracks was done without bit errors.
- Play Audio-Tracks:
With this you can play the songs as they are in the image directory.
To select a song to be played you need to double click on it.
- Master tracks:
This is only for data CDs. Ignore it for the moment.
- Delete Tracks:
Here you can see how much space you have already used and how much
is still left. And you can delete all or some tracks from the image
directory according to your wishes.
- Write Tracks:
Here you first need to go to the second panel "Layout tracks". On
the right you will see the content of the image directory. Select
the tracks and press "add" to copy them over to the left panel for
writing tracks. Go back to the "write tracks" panel. Here you find
the same options that were already explained under "Duplicate CD".
But now you have to select the option "PAD tracks". This is to ensure
that all .wav's are properly terminated on sector boundaries. The
Audio CD format requires that all wav files are a multiple of 2352
Bytes long. "PAD tracks" adds some zero-bytes to ensure the correct
length. Press "WRITE CD" to burn the CD.
- koncd:
Choose "audio CD". The version used for this article (0.7.5) does not
yet have the possibility to read individual audio tracks from another
audio CD. But you can select a number of wav files somewhere on your
harddisk and write them as audio tracks to the CD. Click on "Add track"
and add several wav files to the list of selected tracks. Under "options"
select "Use padding" and then click on "start" to burn your CD.
(Pure) Data CDs
For data CDs you need a filesystem or as is often said the CD must be
formatted. You have to choose which filesystem you want. This choice will
depend on which operating system(s) you want to be able to read the data.
The ISO-9660 standard which describes the CD filesystem for example does
not allow long file names. Therefore extensions have been made for this
standard. For Linux and Unix RockRidge extensions are used, Microsoft uses
Joliet extensions.With the RockRidge format you can also have permissions
etc. as you already know it from your system.
The recommended solution is to use RockRidge and Joliet extensions on the
same CD.
If you just want to copy a CD from another existing CD you don't have to
worry about that because then the CD already has a filesystem and this is
copied as well.
- xcdroast:
Choose "Duplicate CD"
and then do everything as described above. Just go to "WRITE CD".
- koncd:
Choose "Copy CD" ( see above).
If you want to copy data from your hard disk :
- koncd:
Copy all the files that you want to write to CD into one directory (using
either the shell command cp or a file manager).
Open koncd and choose "Master CD".
Under "data" you give the source directory to where you copied the files.
Now you have several possibilities to create the CD. We suggest to create
an ISO image first and then write the image to your CD. Under Data ->
"image file" enter the name for the image file that will be created.
The version used for this article required that the file would already
exist. Therefore create an empty file called "image" with the shell
command "touch image".
Go to "options" and click on "Create CD image", press "calculate size"
on the right and then "start".
Once the image is created you click on the option "Write CD" and unselect
"Create CD-image". Now the CD writer will burn the CD for you.
Backup of your home directory
Basically you can backup everything on CD with the method described under
"pure data CDs". If the data in your home directory is too big to fit onto
one CD then you need to select individual sub-directories and write them
to a different CD.
Tips and Tricks:
It can be useful to check if the ISO image is correct before finally
burning it. To do this you can mount the ISO image as if it was a real CD:
Change to root: su -
Create an empty directory (known as mount point): mkdir /tmp/mycd
Mount the ISO image (connect the ISO image to the directory):
mount -o loop -t iso9660 Image.iso /tmp/mycd
Now you can use the command "ls" to inspect the CD image: ls /tmp/mycd
If it looks ok then unmount it: umount /tmp/mycd
... and burn the image to your CD.
Command line tools
Above we have discussed two graphical frontends to burn CDs but you can
also burn CDs using only the command line. If you look at the man page of
cdrecord you will see that there are hundreds of options, uuuhh... don't
be scared. It's much easier than it looks at first. Download the two perl
scripts cdrecordeasy and mkisofseasy.
They are included in the package
easycdscripts (download page)
Unpack them with the command
tar zxvf easycdscripts-0.1.tar.gz
Now run the command cdrecord -scanbus. Look at the line where you see
your CD burner and remember the numbers that you see at the beginning. It
should be something like 0,4,0 or 0,6,0 ....
Edit the file cdrecordeasy by entering this number behind the line that
says $dev=... You will find it somewhere at the beginning.
Now the installation of our two little scripts is finished. Creating a data
CD is now very easy:
- Copy all the files that you want to have on the CD into one directory
(e.g ~/cdrom). Harddisks are very big and cheap these days and it should
be no problem to copy a few hundred MB.
- Run the command: mkisofseasy ~/image.iso ~/cdrom
This will create an ISO image of all the files in the directory ~/cdrom.
- Burn the CD by running the command: cdrecordeasy ~/image.iso
That's it. Much easier than it looked at the beginning, isn't it!? :-)
Have fun with your CDs!
Copyright © 1996-2009 by Dr. Nikolai Bezroukov.
www.softpanorama.org was
created as a service to the UN Sustainable Development Networking Programme (SDNP)
in the author free time.
Submit
comments This document is an industrial compilation designed and created
exclusively for educational use and is placed under the copyright of the
Open Content License(OPL).
Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made
for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
- The statements, views and opinions presented on
this web page are those of the author and are not endorsed by, nor do they necessarily
reflect, the opinions of the author present and former employers, SDNP or any other
organization the author may be associated with.
- We do not warrant the correctness of the information provided or its
fitness for any purpose
- In no way this site is associated with or endorse cybersquatters
using
the term "softpanorama" with other main or country domains (e.g. softpanorama.com) with
bad faith intent to profit from the goodwill belonging to
someone else.
Last modified:
November 13, 2009