Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

Burning CD and DVD on Linux

News Recommended Links Recommended Articles CD creation with Nautilus CD-based distributions Humor Etc

Gnome's Nautilus permits burning CD. With Nautilus, it is as simple as drag and drop:

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

Old News

[Nov 5, 2009] cdrecord will not burn DVD ISO's

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.

[Nov 5, 2009] SDBBurning DVDs with SuSE Linux - openSUSE

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

 

[Nov 5, 2009] Ripping, Mounting, and Burning CDs at Command Prompt - SUSE Wiki

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.

[Nov 5, 2009] Burning .iso On Suse - openSUSE Forums

Or, if you prefer CLI:

for CD-ISO:

wodim your.iso

for DVD-ISO:

growisofs -Z /dev/dvdrw=your.iso

regards,
Paul

[Nov 21, 2008] K9Copy helps make DVD backups easy

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.

[Feb 3, 2008] ISO Master 1.3.1 by Andrew Smith

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.

[Dec 19, 2007] Asunder 1.0  by Andrew Smith

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.

[Dec 19, 2007] freshmeat.net Project details for ISO Master

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.

BigAdmin Feature Article Linux How-To Burning CDs and Validating ISO Images Bob Netherton, November, 2004

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.

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.

[Apr 23,  2003] Burning CDs on Linux Carla Schroder (dworks@bratgrrl.com) Principal, Tux Computing

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:

And, a few terms related to file formats:

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:

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:

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

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:

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

Official Magma Homepage

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.

FreeOS.com: Linux and the laser

(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."

Linux Gazette: Easy Addition of an IDE CD-Writer to a Linux/Redhat PC (Sep 23, 2000, 18:14 UTC) (1082 reads) (4 talkbacks) (Posted by john)

"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."

MachineOfTheMonth: Burning cd-roms under Linux (Aug 12, 2000, 22:50 UTC) (1808 reads) (3 talkbacks) (Posted by john)


"Burning cd-roms under linux is just as easy as it is under Windows, probably easier."

MachineOfTheMonth: CD recording under linux and what you should know

(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."

Recommended Links


In case of broken links please try to use Google search. If you find the page please notify us about new location
Google     

Recommended Articles

 lf227, Applications Writing CDs with Linux

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:
 

  1. cdrecord: this is the program that actually communicates with your CD writer.
  2. mkisofs: you need it for making data CDs. It is used to generate a file system image for the CD called ISO image.
  3. 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:

  1. You have to select the data/music you want to burn on CD
  2. 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.
  3. 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.
  4. 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:
 

 

(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:


Let's now look what you have to do if you want to burn a CD with music from various places:
 

 

(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.
 

 


If you want to copy data from your hard disk :
 

 

 

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:
 

  1. 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.
  2. Run the command: mkisofseasy ~/image.iso ~/cdrom
    This will create an ISO image of all the files in the directory ~/cdrom.
  3. 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:

Last modified: November 13, 2009