Creating an Image
If you are working on servers that don't have a console attached, "mkisofs" and "cdrecord" utilities make working with ISO images very easy!
An ISO is a slang for an image of an ISO9660 filesystem, which 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 /path/to/direcory/ > /tmp/directory.iso or $ mkisofs -r -o /tmp/directory.iso /path/to/direcory/ or for DVD video $ mkisofs -dvd-video -r -V VolumeLabel -o /tmp/directory.iso /path/to/direcory/
The option '-r' sets the permissions of all files to be public readable on the CD and enables RockRidge-extensions. Long filenames and file permissions are preserved when mounted on systems that support Rock Ridge.
The '-V' option assigns the volume ID (volume name or label), this is the name that will be used as the mount point.
Note: You may need "root" priviledges for the below steps.
Testing the CD Image
Before burning the CD, make sure to check that the file size is less than 650 MB, the capacity the CD-R media can hold and also check that the iso image is proper by doing a quick test.
The below command will give the size of the iso file:
#du -hs /tmp/directory.iso
To mount the file directory.iso created above on the directory "/mnt/cdrom", give the command:
#mount -t iso9660 -o ro,loop /tmp/directory.iso /mnt/cdrom
Now you can inspect the files under "/mnt/cdrom". To umount the CD-image:
#umount /mnt/cdrom
Burning the CD Image
Find out which SCSI device your CD-writer is attached to:
cdrecord -scanbus
When ready, the below command should burn an ISO to a CDR:
#cdrecord -v speed=2 dev=0,0,0 -data /tmp/directory.iso
You should specify the writing speed of your burner or slower in the "speed=" option. If you need to erase a CDRW before burning the ISO, pass the "blank=" parameter:
#cdrecord -v speed=2 dev=0,0,0 blank=fast -data /tmp/directory.iso
Multi-session CD
If you need to create multi-session CD you must use the option "-multi" for cdrecord as long as you want to add further sessions.
The images for the second and subsequent sessions are a little bit more complicated to generate. Mkisofs must know where the free space on the CD-R begins. That information can be gathered by using the option "-msinfo" on cdrecord.
#mkisofs -R -o /tmp/directory2.iso -C `cdrecord -msinfo dev=0,0,0` -M /dev/cdrom /path/to/directory2/
Then record the iso file using the below command:
#cdrecord -v -eject speed=2 dev=0,0,0 -multi -data /tmp/directory2.iso
For more information, read the file README.multi, which is distributed with cdrecord.
Further Reading: CD Writing HOWTO available at The Linux Documentation Project.
- sandip's blog
- Login or register to post comments
Comments
Use genisoimage in recent distros.
Data can be recorded to cd directly without creating iso files if sufficient disk space does not exist:
# mkisofs -r ./data/ | cdrecord -eject -v speed=24 -
Can be first tested using:
# mkisofs -r ./data/ | cdrecord -dummy -eject -v speed=24 -
I was getting the below error when running mkisofs with the -dvd-video argument passed to it:
Found out that mkisofs is looking for a subdirectory named "VIDEO_TS", So the correct command was:
I had to burn the CD as root giving ATA as the devicename:
Below is what the scanbus looks like: