The floppy disk, if it's not actually dead, is certainly drawing its last few breaths. The CD-ROM burner and more recently the DVD burner have provided far greater capacity and convenience. I think it's been several years since I last touched a floppy disk.
On Windows, most machines with burners come with burner software, such as Nero, preinstalled. As with with just about everything, burning CD's and DVD's on Linux can be more complex, but at the same time, simpler, depending on the approach you take. The good news is that most distributions these days include user-friendly graphical tools that take the complexity away, but you can still use the underlying commands if you want to - and sometimes that's just faster than clicking on lots of buttons and dialogs.
CD/DVD Formats
The basic format of a CD is ISO9660, otherwise known as "High Sierra", which is quite different from the format of a random access device such as a hard drive, which can be updated at any time. In some respects, a CD is more like a serially-accessed device such as a tape drive.
This means that before the CD-ROM is burned, we need to assemble an image of it - the simplest approach is to create the image as a file on disk. This is done using the mkisofs command. The basic ISO9660 format is usually augmented with either the RockRidge extensions, which allow long filenames and symbolic links for use on *ix systems, or the Joliet extensions developed by Microsoft, which allow long filenames as well as Unicode characters in filenames.
The second step is to burn the image to CD-R or DVD-/+R, and we'll look at that later.
Creating an Image File
So, to create an ISO image of a directory with Rock Ridge extensions is this easy:
[les@loki ~]$ mkisofs -R -o /tmp/image.iso Movies/ INFO: UTF-8 character encoding detected by locale settings. Assuming UTF-8 encoded filenames on source filesystem, use -input-charset to override. 5.20% done, estimate finish Mon Jul 24 17:58:17 2006 [...] 98.64% done, estimate finish Mon Jul 24 17:58:23 2006 Total translation table size: 0 Total rockridge attributes bytes: 753 Total directory bytes: 0 Path table size(bytes): 10 Max brk space used 0 96323 extents written (188 MB) [les@loki ~]$ An interesting capability of Linux is to mount a file as though it is a filesystem. The file /tmp/image.iso actually contains an ISO9660 filesystem, so we can mount it for test purposes using the loop driver:
[root@loki ~]# mount -r -t iso9660 -o loop /tmp/image.iso /media/tmp [root@loki ~]# cd /media/tmp [root@loki tmp]# ls b52crash.mpeg Cap0002.mpg Cap0004.mpg tbirdcrash.mpeg Cap0001.mpg Cap0003.mpg home.xml [root@loki tmp]# and sure enough, all the expected files are there (I'm assuming you already have an empty directory such as /media/tmp to use as a mount point).This technique can be useful when you've downloaded .iso image files for Linux distributions and want to extract some files from the .iso's without having to actually burn them to CD or DVD.
To create an image with Joliet extensions, use a command like:
[les@loki ~]$ mkisofs -J -l -o /tmp/Jimage.iso workspace/ Warning: creating filesystem with (nonstandard) Joliet extensions but without (standard) Rock Ridge extensions. It is highly recommended to add Rock Ridge INFO: UTF-8 character encoding detected by locale settings. Assuming UTF-8 encoded filenames on source filesystem, use -input-charset to override. Total translation table size: 0 Total rockridge attributes bytes: 0 Total directory bytes: 43008 Path table size(bytes): 500 Max brk space used 0 255 extents written (0 MB) [les@loki ~]$ and yes - that was a very small directory - hardly worth burning to CD at all!
Burning a CD
First, you need to know the bus and device numbers for your burner. You can find this out with the cdrecord -scanbus command:
[les@loki Movies]$ cdrecord -scanbus Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jörg Schilling scsidev: 'ATA' devname: 'ATA' scsibus: -2 target: -2 lun: -2 Linux sg driver version: 3.5.27 Using libscg version 'schily-0.8'. cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.83-RH '@(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling'). scsibus1: 1,0,0 100) 'LITE-ON ' 'DVDRW SHM-165P6S' 'MS0K' Removable CD-ROM 1,1,0 101) 'HL-DT-ST' 'CD-RW GCE-8520B ' '1.00' Removable CD-ROM 1,2,0 102) * 1,3,0 103) * 1,4,0 104) * 1,5,0 105) * 1,6,0 106) * 1,7,0 107) * In this example, we can see that device 1,0,0 is a Liteon DVD burner, while device 1,1,0 is an LG CD burner. Don't worry about the references to SCSI - Linux burning programs view burners as though they are SCSI devices. If you are still using a 2.4 series kernel, you will need the ide-scsi module on your kernel command line to provide this fakery, using a command line like this one, taken from a Red Hat 9 system:
kernel /vmlinuz-2.4.20-46.9.legacy ro root=/dev/Volume00/LogVol01 hdc=ide-scsi hdd=ide-scsi So, to burn that image file create above using the Liteon burner, I'd use this command:
[les@loki ~]$ cdrecord -v speed=32 dev=ATA:1,1,0 /tmp/image.iso cdrecord: No write mode specified. cdrecord: Asuming -tao mode. cdrecord: Future versions of cdrecord may have different drive dependent defaults. cdrecord: Continuing in 5 seconds... Cdrecord-Clone 2.01-dvd (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jörg Schilling TOC Type: 1 = CD-ROM scsidev: 'ATA:1,1,0' devname: 'ATA' scsibus: 1 target: 1 lun: 0 Linux sg driver version: 3.5.27 Using libscg version 'schily-0.8'. cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.83-RH '@(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling'). SCSI buffer size: 64512 atapi: -1 Device type : Removable CD-ROM Version : 0 Response Format: 2 Capabilities : Vendor_info : 'HL-DT-ST' Identifikation : 'CD-RW GCE-8520B ' Revision : '1.00' Device seems to be: Generic mmc CD-RW. Current: 0x0009 Profile: 0x000A Profile: 0x0009 (current) Profile: 0x0008 Profile: 0x0002 (current) Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr). Driver flags : MMC-2 SWABAUDIO BURNFREE Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R Drive buf size : 1467136 = 1432 KB FIFO size : 4194304 = 4096 KB Track 01: data 188 MB Total size: 216 MB (21:24.33) = 96325 sectors Lout start: 216 MB (21:26/25) = 96325 sectors Current Secsize: 2048 ATIP info from disk: Indicated writing power: 5 Is not unrestricted Is not erasable Disk sub type: Medium Type A, high Beta category (A+) (3) ATIP start of lead in: -11634 (97:26/66) ATIP start of lead out: 359846 (79:59/71) Disk type: Short strategy type (Phthalocyanine or similar) Manuf. index: 3 Manufacturer: CMC Magnetics Corporation Blocks total: 359846 Blocks current: 359846 Blocks remaining: 263521 cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler cdrecord: Permission denied. WARNING: Cannot set priority using setpriority(). cdrecord: WARNING: This causes a high risk for buffer underruns. Speed set to 5644 KB/s Starting to write CD/DVD at speed 32.0 in real TAO mode for single session. Last chance to quit, starting real write in 9 seconds. Operation starts. Waiting for reader process to fill input buffer ... input buffer ready. trackno=0 BURN-Free is OFF. Performing OPC... Starting new track at sector: 0 Track 01: 0 of 188 MB written. Track 01: 1 of 188 MB written (fifo 96%) [buf 70%] 2.3x. [ ... ] Track 01: 187 of 188 MB written (fifo 100%) [buf 99%] 30.7x. Track 01: 188 of 188 MB written (fifo 100%) [buf 99%] 31.6x. Track 01: Total bytes read/written: 197269504/197269504 (96323 sectors). Writing time: 60.709s Average write speed 23.9x. Min drive buffer fill was 98% Fixating... Fixating time: 15.143s cdrecord: fifo had 3108 puts and 3108 gets. cdrecord: fifo was 0 times empty and 2025 times full, min fill was 90%. [les@loki ~]$ The whole process is quite quick, and if you're doing it a lot you can cut back on the typing by using an alias to specify all the options.
Burning a data CD is a convenient way to back up a few hundred megabytes of data - but what about ripping and burning audio CD's
Audio CD's
There are various utilities for reading and writing audio CD's. One of the most popular is cdrdao, which operates in "disk-at-once" (DAO) mode to read and write CD's. cdrdao is an extremely rich program with lots of options, so we'll focus on the basics which will get you started.
To read an audio CD:
cdrdao read-cd --device 0,1,0 --datafile cd.bin --eject --driver generic-mmc-raw cd.bin.toc (Substitute your own, unique, filenames for the names in italics above, obviously).You will wind up with two files: cd.bin, which contains the raw audio data of the CD and will be several hundred MB in size, and a matching cd.bin.toc, which contains the table of contents. Here's what that file looks like:
CD_DA // Track 1 TRACK AUDIO NO COPY NO PRE_EMPHASIS TWO_CHANNEL_AUDIO FILE "guitar.bin" 0 01:13:16 // Track 2 TRACK AUDIO NO COPY NO PRE_EMPHASIS TWO_CHANNEL_AUDIO FILE "guitar.bin" 01:13:16 03:20:02 START 00:01:74 Now, it doesn't take a rocket scientist to figure out that you can write your own .toc file containing entres copied and pasted from other .toc files, in order to create your own audio CD. You can use sections of .bin files created from CD's or you can use .wav files that you've recorded yourself or perhaps created using Linux music software like Rosegarden and Audacity. To write an audio CD: cdrdao write --device 0,1,0 --speed 8 --eject --driver generic-mmc-raw cd.bin.toc
Burning DVD's
growisofs started its life as a front end fo the mkisofs, intended to allow the appending of data to existing ISO9660 images on random-access media. Somewhere along the way, DVD support was added. The most significant difference from mkisofs is that growisofs does not support the -o option to write the ISO image to an intermediate file - instead, it writes its output direct to the DVD media, So, to burn an entire subdirectory directly to DVD, the command would be:
growisofs -Z /dev/dvd -R -J Movies/ The -Z option specifies an initial session to the specified media. Notice that this command does not burn a video DVD - it just copies files from the Movies directory to a DVD in ISO9660 format, complete with Rock Ridge and Joliet extensions.
The other big difference with growisofs is that it will automatically allow appending data to the DVD in subsequent sessions with the -M device option, like this:
growisofs -M /dev/dvd -R -J Movies2/ There is no need to specify the -C option to create second and subsequent sessions, as with mkisofs.
However, growisofs can burn a DVD from a pre-mastered image:
growisofs -dvd-compat -Z /dev/dvd=/tmp/dvd.iso Burning Video DVD's
A DVD contains video in MPEG-2 format, along with audio in AC3 format.
To assemble a video DVD from a number of mpeg files, you'll need the dvdauthor command. This combines the various mpeg files - known as titles - along with menus, and creates the correct directory structure (two top-level directories called TS_AUDIO and TS_VIDEO) and the files within it. While it is possible to drive dvdauthor from the command line, the options rapidly lead to extremely long command lines. In general, it's only practical to use dvdauthor this way from within scripts, or with some kind of front-end GUI tool.
dvdauthor can also be controlled by an XML configuration file which could be produced by a GUI editing tool or could be created by hand.
Here's an example which stitches together four separate MPEG files and creates a DVD directory structure:
<dvdauthor> <vmgm /> <titleset> <titles> <pgc> <vob file="Cap0001.mpg" /> <vob file="Cap0002.mpg" /> <vob file="Cap0003.mpg" /> <vob file="Cap0004.mpg" /> </pgc> </titles> </titleset> </dvdauthor> To create the DVD structure, us e the command
dvdauthor -o dvd -x home-movie.xml The -o option specifies the output directory, while the -x option specifies the name of the XML configuration file.
To burn this to DVD, you can either use K3b (see below), or you can do it directly from the command line:
growisofs -dvd-compat -Z /dev/dvdwriter -dvd-video dvd/ K3b
K3b is particularly easy to use. It's a project-oriented system - use the File -> New Project submenu to start a new project, which can be a Data CD or DVD, Audio CD, Mixed Mode CD, Video CD or DVD, or a eMovix CD or DVD. Once a project has been started, you can simply drag and drop files into the project window.
Under the covers, K3b uses growisofs and the other commands previously discussed. However, it takes care of a lot of messy options via its Options dialog, including automatic invocation of the various programs required for ripping and burning. It also adds a bit of fun to the process via sound effects - for example, at the end of burning, K3b plays a bugle call.
Installing K3b from source code is quite simple - just download the source code tarball (at time of writing, 0.12.16) and untar it then install it with the following commands:
tar xjvf /path/to/k3b-0.12.16.tar.bz2 cd k3b-0.12.16 ./configure make su -c "make install" If there are any problems, read the INSTALL file and make note of any changes to the procedure. The most likely problem is missing packages on which K3b depends - check the Requirements page at http://k3b.plainblack.com/requirements - and these will probably show up in the ./configure step. Make sure you read the last part of the output from this step to see how K3b is going to be built as you might find some features missing.
K3b can also be downloaded in RPM form from http://k3b.xcyb.org/ or installed using yum or apt on many distributions. Page last updated: 06/Aug/2006 Back to Home Copyright © 1987-2010 Les Bell and Associates Pty Ltd. All rights reserved. webmaster@lesbell.com.au