Edmund A. Hajim  School of Engineering and Applied Sciences

CD and DVD burning with HSEAS Linux Systems

Burning CD has become a lot easier and DVD burning possible (and very easy under the newer versions of Linux).

Previously, we had to set up a set of wrapper scripts and configure sudo access for each user wishing to burn a CD. This technology served us well, but did not adapt to burning DVDs.

But that's OK, because the newer generation of CD/DVD burning tools under Linux are much improved. So what is available?

The GUI Interface to the DVD/CD Burner

Most of our Linux systems with a DVD burning have the software package k3b installed. This GUI interface is similar to Windows packages like Nero and Roxio, and in my opinion, a bit better. It is very easy to use. Simply start k3b while working at the console (running k3b remotely is possible, but not very useful, as you won't be able to insert the DVD/CD media). One caveat - when burning DVDs, select a lower speed; k3b will detect the CD-writing/reading speed, which is not appropriate for DVDs. Note though that a speed of 2 sounds slow, DVD burning at speed 2 is really quite fast, and seems comparable to CD burning speeds of roughly 48+.

k3b gives you the choice of burning data DVD or CD, or Audio CD disks.

Command-line Interface to the DVD/CD Burner

Command-line CD/DVD burning is also possible, and relatively easy now. Previously, one needed to use mkisofs to create an ISO image, and then use cdrecord (which unfortunately needed root privileges to run) to burn the the ISO image to the CD disk.

You can still do that for CDs, although the options used for both programs have changed a bit. More importantly, no root-privilege is needed (if you are working on the console), and thus the systems staff does not need to configure anything on a user-by-user basis (i.e., you can just use the CD/DVD burner).

Supposedly, cdrecord or its wrapper program dvdrecord can be used to write ISO images to DVD media, but I've not had success with that combination, and haven't cared to pursue it.

The preferred method for command-line DVD burning is to use growisofs either as a followup to creating an ISO image with mkisofs, or as a stand-alone, "all-you-need-is-this-one-program" to create and burn an ISO image in one step. My experimentation with growisofs suggests that it is not able to write CDs. Since cdrecord does this task well, I have no inclination to spend time playing with growisofs to see if it can burn CD media.

OK, Enough already - I want to burn a DVD

Not a problem. Use k3b if you can - quick and easy. But I do prefer the simplicity and flexibility of a command-line interface sometimes. Here's how you can burn a DVD using growisofs

Two-step method

Using the two-step method - similar to what we do for burning CDs, we first create an ISO image using mkisofs, and then burn it to DVD using growisofs. Let us assume you wish to burn your home directory to a DVD. It works best if you start at one directory level above the directory you wish to burn.

cd ~/
cd ../
mkisofs -J -R -pad -o /someplace/large/yourname.iso yourname
chmod 0600 /someplace/large/yourname.iso
growisofs -use-the-force-luke=dao -speed=2 -dvd-compat -Z /dev/dvd=/someplace/large/yourname.iso

The value for /someplace/large/ and yourname reference a directory to which you have write access (and which will be large enough to hold the ISO image), and your login name respectively. The first two lines of this ensure you are in the correct place to take this action; this would not work exactly like this if you were burning something other than your home directory. The idea is go to the top-level directory - which you wish to burn - and then move up one level. The chmod command ensures that you and you alone can read the ISO image. If you do not execute this step, anyone can read the contents of the ISO image, and can thus gain access to materials that you may otherwise have marked as private. This is an easy step; don't skip it.

An example of this process (for me) is:

cd ~/
cd ../
mkisofs -J -R -pad -o /var/tmp/gort.iso gort
chmod 0600 /var/tmp/gort.iso gort
growisofs -use-the-force-luke=dao -speed=2 -dvd-compat -Z /dev/dvd=/var/tmp/gort.iso

Note that the reference device /dev/dvd may not work, in which case you need to replace that value with the actual device. Fortunately, this is easy to determine; /dev/dvd is just a symbolic link pointing to the real device,a nd you can find that by doing

/bin/ls -ld /dev/dvd

which will return something like

lrwxrwxrwx 1 root root 3 Sep 19 16:52 /dev/dvd -> hdd

In this instance, the "real" device is hdd, or rather /dev/hdd, and my growisofs command line would be

growisofs -use-the-force-luke=dao -speed=2 -dvd-compat -Z /dev/hdd=/var/tmp/gort.iso

While that looks complicated, it really isn't. Once you determine what you want to dump to the DVD, you only need to figure out a place that is large enough to hold the ISO image (and for which you have write access), and possibly, what the real DVD device is named. Neither of these tasks is rocket science

One final requirement for this method - which applies to burning CDs as well. As the first step in this process, you created an ISO image, which will be slightly larger than the sum of the sizes of the materials you are burning to the DVD. Don't leave it lying around after you've successfully (note successfully) burned the image to a DVD. For example, after burning the DVD in the example above, I'd delete the ISO image from the disk:

/bin/rm -f /var/tmp/gort.iso

Even Easier - the One-step Method

Using growisofs in a single-step method is even easier, and gives you some additional capability. I'll give a couple examples of this, first duplicating the example from our two-step section.

growisofs -use-the-force-luke=dao -dvd-compat -J -R -Z /dev/dvd -speed=2 ~/

It doesn't get much simpler than that. The first two options are not necessary, but result in more reliable burning. Note that the short-hand notation for your home directory ( ~/ ) was used in this example.

You can get a bit fancier; suppose you have research data in 2 locations, but you want to burn them to a single DVD (and they will fit within the 4Gb available on a single-layer DVD). Suppose further that your data are located in the two areas /home/school/bubba/project1 and in /home/ctmri5/bubba/mri-data/2005 . You can put these materials on the same DVD and keep the materials separate on that disk.

growisofs -use-the-force-luke=dao -dvd-compat -J -R -Z /dev/dvd -speed=2 -graft-points /project1=/home/school/bubba/project1 /mri-data-2005=/home/ctmri5/bubba/mri-data/2005

which would leave you with a DVD with two directories project1 and mri-data-2005 in the top-level of that DVD. Please note that the example command line used here is quite long - and that it is one line, not two or more lines.

Burning CDs

This is very similar to the two-step method for burning DVDs. The mkisofs command line remains the same as used for preparing an ISO image for a DVD (but of course you must make sure that the ISO image is small enough to fit on a CD, not more than about 650-680Mb). The cdrecord command line is a bit different:

cdrecord dev=ATA:#,#,# speed=X -sao -pad -v -eject iso_image

To explain... the iso_image is simply the name of the ISO image you've prepared. The value for X is the writing speed of your CD/DVD writer. Most modern CD writers can work at 8 or even 16. Push this number too far, and you can end up with unusable CDs. If you select speed=2 you should be OK, and won't see a huge loss in speed (I think the devices and software negotiate a reasonable speed). The other item is a bit more problematic. This is specifying the device to which you wish to write. If you have a SCSI CDWriter, then you can dispense with the ATA: prefix. The three digits are necessary, but are also easily determined:

cdrecord -scanbus

which should return something like

Using libscg version 'schily-0.8'. scsibus1: 1,0,0 100) 'SAMSUNG ' 'DVD-ROM SD-616E ' 'F501' Removable CD-ROM
1,1,0 101) 'SONY ' 'DVD RW DW-Q120A ' 'PYS2' 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) *

which show us that the DVD-RW on this host is device 1,1,0. Unfortunately, on many systems, cdrecord will not let you perform this query without root privileges.

If you are unable to run this command successfully, you can look at a file we've prepared that has the information:

/bin/cat /usr/local/lib/cd-dvd-info.txt

and if that fails, you can contact problem at problem@seas.rochester.edu.

New: On most of the newer CentOS Linux systems, the CD-RW and DVD-RW devices can be referred to very easily. If you only have one CD/DVD device, then it is likely referred to as "dev=/dev/cdwriter" or "dev=/dev/cdrw", or "dev=/dev/dvdwriter" or "dev=/dev/dvdrw". If you have multiple DVD/CD devices, then you may have to use something like "dev=/dev/cdrw1". You can check to see what is possible on your system via a simple command:

/bin/ls -l /dev/dvd* /dev/cd*
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdrom -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdrom-hdc -> hdc
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdrom-hdd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdrw -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdrw-hdd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdwriter -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/cdwriter-hdd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvd-hdc -> hdc
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvd-hdd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvdrw -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvdrw-hdd -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvdwriter -> hdd
lrwxrwxrwx 1 root root 3 Dec 18 16:13 /dev/dvdwriter-hdd -> hdd

So for some final examples, assuming you've prepared an ISO image named /home/ohm/tmp/bubba.iso

cdrecord dev=ATA:1,0,0 speed=8 -sao -pad -v -eject /home/ohm/tmp/bubba.iso
/bin/rm -f /home/ohm/tmp/bubba.iso


cdrecord dev=/dev/cdwriter speed=8 -sao -pad -v -eject /home/ohm/tmp/bubba.iso
/bin/rm -f /home/ohm/tmp/bubba.iso

Do note that on our older RedHat and Fedora systems, this does not work the same way, as you need root privilges to access the CDRW or DVD-R/RW device. However, those older systems should be either retired or upgraded to newer versions of the OS, so access should not be a problem.

Last modifed: Thursday, 07-Apr-2011 09:25:30 EDT