< Day Day Up > |
Recipe 11.4. Making a Data CD for General Distribution11.4.1 ProblemYou want to create a data CD that will be readable on Linux and Windows, with non-restrictive file permissions. The disk may contain text files, documents, programs, or graphical images. 11.4.2 SolutionUse mkisofs, mount, and cdrecord. First use mkisofs to package all of the files into a single .iso file, then mount the .iso to verify the filesystem is good. Then write to disk with cdrecord. In this example, the .iso is called data.iso, the CD is named data_disk, and all the files will be copied from the /disk-data directory. The mountpoint for the .iso is /test-iso. Here are the commands: # mkisofs -J -r -v -V data_disk -o data.iso /disk-data # mkdir /test-iso # mount -t iso9660 -o ro,loop data.iso /test-iso # ls /test-iso # umount /test-iso # cdrecord -v -eject dev=0,1,0 data.iso 11.4.3 DiscussionThis recipe shows the root user running all commands, for simplicity, because mount, mkisofs, and cdrecord require root privileges. To allow users to run the mount command, use sudo. To allow users to run mkisofs and cdrecord, create a cdrecord group. Make it own mkisofs and cdrecord, and put users in the cdrecord group. Remember that the 2.6 kernel doesn't need IDE-SCSI, so you can just use the /dev name: # cdrecord dev=/dev/hdc <commands> There's a whole lot of doings packed into these few lines. Let's break them down one at a time. mkisofs takes all of your files and rolls them into one big .iso file. If you've ever downloaded a Linux distribution to burn to CD, it was packaged as an .iso file. This is a common source of confusion for Linux newbies, who don't understand why they have this giant single file, instead of a nice directory tree full of Linux files. Let's look at the mkisofs line in more detail: # mkisofs -J -r -v -V data_disk -o data.iso /disk-data Here are the options:
Mounting the .iso before burning the disc is cheap insurance to make sure you're not creating a coaster. If you see all of your files, it's good to go. If not, the .iso is no good, and it needs to be rebuilt. Here's how to test your .iso: # mkdir /test-iso # mount -t iso9660 -o ro,loop data.iso /test-iso Then look in the /test-iso directory to verify your files. Here are the parts of the mount command:
Now that the .iso is all ship-shape, we can burn it to disc. # cdrecord -v -eject dev=0,1,0 data.iso The options are:
cdrecord automatically writes at the highest speed the drive and disc support. If there are errrors, try specifiying a lower write speed: # cdrecord -v -eject speed=4 dev=0,1,0 data.iso Modern writers have fast write speeds (20X and higher). However, many CD-R/RW discs are limited to much slower speeds. Usually, cdrecord will auto-detect the appropriate write speed. 11.4.4 See Also
|
< Day Day Up > |