Writing CD-Roms On Linux Workstations
Command-line tools exist on the Linux operating system to:
- create CD-Rom file system images (ISO images) from individual files (the mkisofs command), and
- write these ISO images to CD-R and/or CD-RW media (the cdrecord command).
The instructions below detail how to create a CD-R or CD-RW copy of a fictitious user joeuser's home directory. However, these techniques can be used to back up any single directory (and all its children), either from afs or from a local disk.
How Do I Save A Copy Of My UNIX Account On CD?
- Find the size of your account:
/usr/afsws/bin/fs lq ~
- Purchase one CD-R or CD-RW disc for every 650 MB of data. You may want to purchase a second CD-R disc, in case there are problems with the first disc you create.
- Find out how much free space is available in /tmp:
df -k /tmp
- If the space available in /tmp is more than the amount that you need you may proceed. If not, either wait, or send mail to lab@cs.wisc.edu to report the problem.
- Create an image of your home directory with the
mkisofs command (note that this should be one line):
mkisofs -A Application-Description -J -r -V USERNAME -o /tmp/USERNAME.iso PATH_TO_DIRECTORY
for example:
mkisofs -A joeuser_cs_account_spring_99 -J -r -V joeuser -o /tmp/joeuser.iso ~joeuser
mkisofs has several options. Here are the options we have tested, and a short explanation of each:
- -A Application_id
- Specifies a text string that will be written into the volume header. There is room for 128 characters. We recomend putting your name and the date of the archive, for example
joeuser_cs_account_spring_98
- -f
- causes symbolic links to be "followed" and replaced by the contents of the file. Without the
-f flag, the symbolic link will be preserved, but the contents of the actual file will not be archived if it is not in your directory. Using the -f flag can cause problems with links that point to common areas like .cxoffice and .crossover, use with caution.
- -J
- uses the Joliet extensions, so that long file names are visible on Windows NT and Windows 95/98 systems.
- -r
- Use the Rock Ridge extensions and change all file ownerships and modes to be more useful: * The uid and gid are set to zero, because they are usually only useful on the original computer system, and not useful on the computer where the CD is mounted. * All the file read bits are set to true, so that files and directories are globally readable when the CD is mounted on a new system. * If any execute bit is set for a file, set all of the execute bits, so that executables are globally executable when the CD is mounted on a new system. * If any search bit is set for a directory, set all of the search bits, so that directories are globally searchable on the CD. * All write bits are cleared, because the CD-Rom will be mounted read-only in any case.
- -V
- Volume-name: Specifies a volume name for the CD. We recommend your username.
- -o /tmp/USERNAME.iso
- specifies the output file (cd image file). Use your username instead of USERNAME.
- path_to_directory
- specifies the directory to archive (your home directory)
- for more information on the options and flags of the mkisofs command type man mkisofs Wait for this command to complete. This is the most time consuming step of the process, and takes approx. 20 minutes for a 70MB directory
- Place the CD-R or CD-RW media in the CD-RW drive.
- Use the
cdrecord command to write the iso image to the CD-R or CD-RW media.
cdrecord PATH_TO_ISO
For example, if you followed the suggestion above and used
mkisofs to create the iso in
/tmp/joeuser.iso, the command would be:
cdrecord /tmp/joeuser.iso
There are many other options to cdrecord. For more information, please see the cdrecord man page by typing
man cdrecord. With some CD/DVD writers, the
-dao (disk-at-once) option may be required.
Test the CD:
If you just burned the disk, make sure that the disc drive has been opened at least once. Afterward, close the drive with the disc in it and follow these instructions:
% mount /media/cdrecorder
% ls -l /media/cdrecorder
% umount /media/cdrecorder
If the mount fails or the
ls command doesn't return the contents you expect, there may be a problem with the either the disk, the ISO image, or the writing process.
- Remove the iso image you created with mkisofs, for example:
rm /tmp/joeuser.iso
How Do I Burn An ISO Image To A CD-R Or CD-RW Disk
- Place the iso image in the /tmp directory. For example, if you wanted the first Red Hat linux 7.1 iso from our mirror site, you would type:
cp /p/mirror/pub/mirrors/linux/redhat/7.1/en/iso/i386/seawolf-i386-disc1.iso /tmp/redhat1.iso
Specifically, we have found that iso images cannot be burned from afs reliably, due to the CD-RW drive's requirement of immediate access to data.
- Place the CD-R or CD-RW media in the CD-RW drive.
- Use the
cdrecord command to write the iso image to the media. The speed that you specify is a function of both the maximum speed of the drive and the maximum speed of the media. For CD-R media, you should be able to specify a speed of 8. For CD-RW, you may not be able to specify a speed in excess of 4:
cdrecord PATH_TO_ISO
For example, if you followed the suggestion above and copied the iso image to /tmp/redhat1.iso, the command would be:
cdrecord /tmp/redhat1.iso
- With some CD writers, the
-dao (disk-at-once) option may be required. After the cdrecord command completes (which will take several minutes), remove the iso image from /tmp. For example:
rm /tmp/redhat1.iso
How Do I Burn An ISO Image To A DVD-R Or DVD-RW Disk
- Place the iso image on the local disk (if it's larger than 1GB, it won't fit in /tmp). Maybe copy it to /scratch, if /scratch is available on your system.
cp some-file /scratch/dvd-image.iso
Specifically, we have found that iso images cannot be burned from afs reliably, due to the DVD-RW drive's requirement of immediate access to data.
- Place the DVD-R or DVD-RW media in the DVD-R drive.
- Use the
cdrecord command to write the iso image to the media, as in:
cdrecord PATH_TO_ISO
For example, if you followed the suggestion above and copied the iso image to
/tmp/dvd-image.iso, the command would be:
cdrecord /scratch/dvd-image.iso
- With some DVD writers, the
-dao (disk-at-once) option may be required. After the cdrecord command completes (which will take several minutes), remove the iso image from the local disk. For example:
rm /scratch/dvd-image.iso
Or Use the Gnome Desktop (Nautilus)
Gnome desktop users have a CD recording facility built into the Nautilus File Manager. Insert your CD/DVD disk into the media recorder on the computer, and an icon for an unrecorded disk will appear on your desktop. Opening the icon will bring up a
CD/DVD Creator window. Drag the folders/files you want to record into the
CD/DVD Creator window, and click
Write to Disk under the
File menu.
More documentation is available under the
Help tab on the
CD/DVD Creator window.