Friday, November 27, 2009

Creating iso image using mkisofs

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO. The name "ISO" is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660.

mkisofs is effectively a pre-mastering program to generate the iso9660 filesystem - it takes a snapshot of a given directory tree, and generates a binary image which will correspond to an iso9660 filesystem when written to a block device.

Here is an example of mkisofs usage ..

mkisofs -r -J -l -d -allow-multidot -allow-leading-dots -hide-rr-moved -disable-deep-relocation -V "EPM-1.1-LINUX-x86_64" -o epm-linux-x86_64.iso Disk1/

where
-r, -rational-rock Generate rationalized Rock Ridge directory information
-J, -joliet Generate Joliet directory information
-l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names
-d, -omit-period Omit trailing periods from filenames (violates ISO9660)
-allow-multidot Allow more than one dot in filenames (e.g. .tar.gz) (violates ISO9660)
-allow-leading-dots Allow ISO9660 filenames to start with '.' (violates ISO9660)
-hide-rr-moved Rename RR_MOVED to .rr_moved in Rock Ridge tree
-D, -disable-deep-relocation
Disable deep directory relocation (violates ISO9660)
-V ID, -volid ID Set Volume ID
-o FILE, -output FILE Set output file name


How to mount an ISO image under linux?
mount -o loop -t iso9660 iso-name.iso /mountpoint