Remember when creating CDs, the root of the CD is relative to the created directory; in this case, cdimage. Once you have your files in this directory, you are ready to create the iso9660 image using the mkisofs command. To create the basic image, use the following command:
mkisofs -r -o cdimage.iso cdimage
The -r option ensures the image contains additional file description data by way of the Rock Ridge protocol, preserving the original file name and setting permissions optimally for CD-ROMs such that read/execute permissions become global, write permissions are cleared, and special mode bits are also cleared since they do not apply on CD-ROMs. The -o option designates the output file (cdimage.iso). The last value is the directory in which the files are located.
Many commercially manufactured Linux CDs, such as Red Hat, are bootable. This isn't difficult to do using the “El Torito” standard. Most newer BIOSes today support the bootable CD feature, and most bootable CDs for the PC are based on El Torito. El Torito makes your CD appear as a floppy, and thus your BIOS can boot it.
If you want a bootable CD, you'll need a 1.44MB boot image intended for a boot floppy. In our distribution example, we could use the boot image used for installation. For distribution_b, the name of the boot image is boot.img. The process by which we make a CD bootable takes place in the creation of the iso9660 image (International Organization for Standardization specification for compact disk read-only memory). Thus, before we create our image, we need to create a directory inside of cdimage to hold the boot image; a directory called boot would work fine. So, we place the image boot.img into cdimage/boot and create the iso9660 image by executing the following command:
mkisofs -r -b boot/boot.img -c boot/boot.cat -o\ cdimage.iso cdimage
Here we have two new options, both of which are used to make the CD bootable. The -b option is followed by the name of the boot image to be booted. Note that the file is relative to the root of the CD. The -c option is followed by the name of the boot catalog required by El Torito; this file is automatically created by mkisofs. Only the more recent versions of mkisofs allow for the automatic creation of the boot catalog; older versions require you to create it yourself.
Before actually burning the CD, take a look at your image layout by mounting it. This is done using a loopback device, so this must be supported in the kernel. The following command will mount your image:
mount -r -t iso9660 -o loop cdimage.iso /mnt
Once you've created your image, bootable or not, you are ready for the final process of burning it onto the CD using either cdrecord or cdwrite. Take the following into consideration before you start:
Make sure the computer isn't experiencing any excessive vibrations.
Make sure the image is on a local hard drive.
Make sure the load on your system isn't too high.
Keeping these three things in mind will help prevent errors during the write process. The CD writer can be put through a test process that won't actually write, but will simulate the entire process. This is done by adding the -dummy option for cdrecord and the -y option for cdwrite. Now all that is left is inserting a blank CD and executing the command that matches your choice of writer.
cdrecord -eject -v -isosize speed=2 dev=0,0\ cdimage.iso cdwrite -ev --device /dev/??? -s 2 cdimage.isoThe first two options for both utilities are eject and verbose. Thus, the CD will eject after the burning process is finished, and the program will run in verbose mode. The option -isosize for cdrecord limits the size of the CD to the size of the iso9660 image. The options speed=2 and -s 2 indicate the speed at which to write to the CD; in this case, the 2 means at 2x. Finally, the options --device, dev=0,0 and /dev/??? set the target device, where /dev/??? should be your CD-R (i.e., /dev/scd0) and 0,0 stands for the SCSI ID and bus in that order.
If all worked out well, congratulations. You now have a full-fledged, iso9660 CD. You can make a CD with other formats just as well. The utility mkhybrid, included with mkisofs, can make images of Joliet and HFS format. It is also possible to make a CD with the EXT2 file system format. Have fun burning!
Alex Withers has been using Linux since 1.1.59. He is currently studying computer science at Gonzaga University and can be reached at firstname.lastname@example.org.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Back to Backups
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Google's Abacus Project: It's All about Trust
- Secure Desktops with Qubes: Introduction
- Seeing Red and Getting Sleep
- Fancy Tricks for Changing Numeric Base
- Secure Desktops with Qubes: Installation
- Linux Mint 18
- Working with Command Arguments
- CentOS 6.8 Released
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide