O'Reilly logo

Linux Server Hacks by Rob Flickenger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #43. Working with ISOs and CDR/CDRWs

The command line makes working with ISOs a snap

There are a number of graphical CD-ROM utilities for Linux. Most of these are simply front-ends that call command line tools to do the actual work of building ISOs and burning disks. And graphical tools aren't much help if you're working on servers that don't have a console attached, unless you are running X remotely, perhaps over ssh (as in [Hack #70]). With the mkisofs and cdrecord utilities installed, working with ISO images from the command line is very straightforward.

If you've never heard of an ISO, it's slang for an image of an ISO9660 filesystem. The ISO9660 format (along with a couple of common extensions) is the common format of data CD-ROMs.

To make an ISO image to prepare for burning in a CD burner, use mkisofs:

mkisofs -r /home/rob/ > /tmp/rob-home.iso

The -r tells mkisofs to build Rock Ridge extensions into the resulting image file. This means that long filenames and file permissions will be preserved when the disk is mounted on systems that support Rock Ridge. Linux has great support for RR, and using -r generally makes your life much easier when building disks designed to be used with Linux. Anyone can make an ISO of files that they have read access to; you don't have to be root to run mkisofs. But for the rest of the commands in this hack, you'll likely need root privileges.

Note that mkisofs stores the contents of the directories you specify on the command line, not the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required