Linux/ISO

Mount ISO
Mount ISO: mount -o loop disk1.iso /mnt/disk

Reference:

[http://www.cyberciti.biz/tips/how-to-mount-iso-image-under-linux.html How to:

Mount an ISO image under Linux]

mkisofs
Original mkisofs utility - http://www.andante.org/mkisofs.html
 * The mkisofs tool is used for premastering iso9660 filesystems which are used on CDROMs. The output of mkisofs can then be sent to a CDROM writer with a utility such as cdrecord.
 * Note: I no longer maintain mkisofs. The information on this page was current in March 1999 and has not been updated since then.

mkisofs is now part of the cdrtools package.

cdrtools - http://cdrecord.berlios.de/old/private/cdrecord.html
 * Cdrtools - Highly portable CD/DVD/BluRay command line recording software
 * Cdrtools is a set of command line programs that allows to record CD/DVD/BluRay media.

mkisofs rpm: Name       : mkisofs                      Relocations: (not relocatable) Version    : 2.01                              Vendor: CentOS Release    : 10.7.el5                      Build Date: Wed 11 Mar 2009

11:36:00 AM MDT Install Date: Sat 23 Oct 2010 05:10:54 PM MDT     Build Host:

chamkaur.karan.org Group      : Applications/System           Source RPM:

cdrtools-2.01-10.7.el5.src.rpm Size       : 1615431                          License: GPL Signature  : DSA/SHA1, Tue 17 Mar 2009 05:35:57 AM MDT, Key ID

a8a447dce8562897 Packager   : Karanbir Singh  URL        : http://cdrecord.berlios.de/old/private/cdrecord.html Summary    : Creates an image of an ISO9660 filesystem. Description : The mkisofs program is used as a pre-mastering program; i.e., it generates the ISO9660 filesystem. Mkisofs takes a snapshot of a given directory tree and generates a binary image of the tree which will correspond to an ISO9660 filesystem when written to a block device. Mkisofs is used for writing CD-ROMs, and includes support for creating bootable El Torito CD-ROMs.

Install the mkisofs package if you need a program for writing CD-ROMs.

mkisofs notes
mkisofs - create an hybrid ISO9660/JOLIET/HFS filesystem with optional Rock

Ridge attributes.

mkisofs is effectively a pre-mastering program to generate an

ISO9660/JOLIET/HFS hybrid filesystem.

References:
 * [http://www.granneman.com/techinfo/linux/burningcds/makeanisoimage.htm Make

an ISO Image :: Scott Granneman]
 * ISO, CDR, and CDRW in Linux

cdrtools
cdrtools - http://cdrecord.berlios.de/old/private/cdrecord.html
 * Cdrtools - Highly portable CD/DVD/BluRay command line recording software
 * Cdrtools is a set of command line programs that allows to record CD/DVD/BluRay media.

The suite includes the following programs:


 * cdrecord - A CD/DVD/BD recording program
 * readcd - A program to read CD/DVD/BD media with CD-clone features
 * cdda2wav - The most evolved CD-audio extraction program with paranoia support
 * mkisofs - A program to create hybrid ISO9660/JOLIET/HFS filesystes with optional Rock Ridge attributes
 * isodebug - A program to print mkisofs debug information from media
 * isodump - A program to dump ISO-9660 media
 * isoinfo - A program to analyse/verify ISO/9660/Joliet/Rock-Ridge Filesystems
 * isovfy - A program to verify the ISO-9660 structures
 * rscsi - A Remote SCSI enabling daemon

Labels
The ISOs are read only in Linux. To change the ISO label, use Magic ISO.

Create ISO
Output: mkisofs -o [file].iso

Rock Ridge extention: -R  # files owned by current user -r  # files own by root

Joliet: -J

Volume ID
-V volid Specifies the volume ID (volume name or label) to be written into the master block. There is space on the disc for 32 characters of information. This parameter can also be set in the file .mkisofsrc with VOLI=id. If specified in both places, the command line version is used. Note that if you assign a volume ID,  this is the name that will be used as the mount point used by the Solaris volume management system and the name that is assigned to the disc on a Microsoft Win32 or Apple Mac platform.

Examples
EXAMPLES

To create a vanilla ISO-9660 filesystem image in the file cd.iso, where the directory cd_dir will become the root directory if the CD, call:

% mkisofs -o cd.iso cd_dir

To create a CD with Rock Ridge  extensions  of  the  source  directory cd_dir:

% mkisofs -o cd.iso -R cd_dir

To create  a  CD  with  Rock  Ridge extensions of the source directory cd_dir where all files have at least read permission and all files are owned by root, call:

% mkisofs -o cd.iso -r cd_dir

To write a tar archive directly to a CD that will later contain a sim- ple iso9660 filesystem with the tar archive call:

% star -c. | mkisofs -stream-media-size 333000 | \ cdrecord dev=b,t,l -dao tsize=333000s -

To create a HFS hybrid CD with the Joliet and Rock Ridge extensions of the source directory cd_dir:

% mkisofs -o cd.iso -R -J -hfs cd_dir

To create  a  HFS hybrid CD from the source directory cd_dir that con- tains Netatalk Apple/Unix files:

% mkisofs -o cd.iso --netatalk cd_dir

To create a HFS hybrid CD from the source directory cd_dir, giving all files CREATOR and TYPES based on just their filename extensions listed in the file "mapping".:

% mkisofs -o cd.iso -map mapping cd_dir

To create a CD with the ’Apple Extensions to ISO9660’, from the source directories cd_dir and another_dir. Files in all the known Apple/Unix format are decoded and any other files are given CREATOR and TYPE based on their magic number given in the file "magic":

% mkisofs -o cd.iso -apple -magic magic -probe \ cd_dir another_dir

The following example puts different files on the CD that all have the name README, but have different contents when seen as a  ISO9660/Rock- Ridge, Joliet or HFS CD.

Current directory contains:

% ls -F README.hfs    README.joliet  README.unix    cd_dir/

The following command puts the contents of the directory cd_dir on the CD along with the three README files - but only one will be seen  from each of the three filesystems:

% mkisofs -o cd.iso -hfs -J -r -graft-points \ -hide README.hfs -hide README.joliet \ -hide-joliet README.hfs -hide-joliet README.unix \ -hide-hfs README.joliet -hide-hfs README.unix \ README=README.hfs README=README.joliet \ README=README.unix cd_dir

i.e. the  file README.hfs will be seen as README on the HFS CD and the other two README files will be hidden. Similarly for  the  Joliet  and ISO9660/RockRidge CD.

There are probably all sorts of strange results possible with combina- tions of the hide options ...

Source: man mkisofs

ISO 9660
http://en.wikipedia.org/wiki/ISO_9660

Extensions
There are common extensions to ISO 9660 to deal with the limitations. Rock Ridge supports the preservation of POSIX (Unix-style) permissions and longer ASCII-coded names; Joliet supports names stored in Unicode, thus allowing almost any character to be used, even from non-Latin scripts; El Torito enables CDs to be bootable on PCs; Apple ISO 9660 Extensions adds support for Mac-OS-specific file characteristics such as Resource forks, file backup date and more.

ISO 13490 is basically ISO 9660 with multisession support.

For operating systems which do not support any extensions, a name translation file TRANS.TBL must be used. It should be located in each directory, including the root directory. This is now obsolete, since few such operating systems are in use today.


 * Rock Ridge - Standard
 * Joliet - Microsoft
 * El Torito - Bootable CDs
 * Apple ISO 9660 - Apple
 * ISO 13490 - multisession support

Source: http://en.wikipedia.org/wiki/ISO_9660

Modes
The smallest entity in the CD format is called a frame, and holds 24 bytes. Data in a CD-ROM is organized in frames and sectors. A CD-ROM sector contains 98 frames, and holds 2352 bytes.

CD-ROM Mode 1, usually used for computer data, divides the 2352 byte data area defined by the Red Book standards into 12 bytes of synchronization information, 4 bytes of header data, 2048 bytes of user data and 288 bytes of error correction and detection codes. These codes help prevent the data from becoming corrupted after readout. Executable data is particularly error intolerant and read errors would lead to arbitrary results.

CD-ROM Mode 2 Form 1, usually used for computer data, has the same user data and error correction as Mode 1, but with a slightly different layout. Its use is not recommended for compatibility reasons. [2]

CD-ROM Mode 2 Form 2, intended to be used for error-tolerant data such as audio and video, divides the 2352 bytes into 12 bytes of synchronization information, 4 bytes of header data and 2336 bytes of user data. Mode 2 provides 14% more user data space than Mode 1 by omitting error correction, since a read error in audio or video will only cause a small flaw which may not even be detectable by humans. Video CDs are classified as Mode 2 Form 2.

Source: http://en.wikipedia.org/wiki/ISO_9660

Rock Ridge extensions
http://en.wikipedia.org/wiki/Rock_Ridge

The Rock Ridge Interchange Protocol (RRIP, IEEE P1282) is an extension to the ISO 9660 volume format, commonly used on CDROM and DVD media, which adds POSIX file system semantics. The availability of these extension properties allows for better integration with Unix and Unix-like operating systems.

RRIP was developed by Andrew Young of Young Minds, Inc. in the early 1990s. The standard takes its name from the fictional town Rock Ridge in Mel Brooks' film Blazing Saddles.

The RRIP extensions are, briefly:


 * Longer file names (up to 255 bytes) and fewer restrictions on allowed characters (support for lowercase, etc.)
 * UNIX-style file modes, user ids and group ids, and file timestamps
 * Support for Symbolic links and device files
 * Deeper directory hierarchy (more than 8 levels)
 * Efficient storage of sparse files

NOTE: Rock Ridge is the standard. Joliet is not.

Joliet
Microsoft based extension

http://en.wikipedia.org/wiki/Joliet_%28file_system%29

El Torito
Bootable CDs

http://en.wikipedia.org/wiki/El_Torito_%28CD-ROM_standard%29

Universal Disk Format (UDF)
http://en.wikipedia.org/wiki/Universal_Disk_Format

Universal Disk Format (UDF) is an implementation of the specification known as ISO/IEC 13346 and ECMA-167 and is an open vendor-neutral file system for computer data storage for a broad range of media. In practice, it has been most widely used for DVDs and newer optical disc formats, supplanting ISO 9660. Due to its design, it is very well suited for incremental updates on both recordable or (re)writable optical media. UDF is developed and maintained by the Optical Storage Technology Association (OSTA).

Versions:
 * Many DVD players do not support any UDF revision other than version 1.02
 * 1.02
 * 1.50
 * 2.00
 * 2.01
 * 2.50
 * 2.60

mkisofs udf: -udf  Include  UDF  support  in the generated filesystem image. UDF support is currently in alpha status and for this reason, it is not possible to create UDF only images. UDF data structures are currently  coupled  to              the Joliet structures, so there are many pitfalls with the current implementation. There is no UID/GID sup- port, there is no POSIX permission support, there is no support for symlinks. Note that  UDF  wastes  the space from  sector ~20 to sector 256 at the beginning of the disk in addition to the spcae needed for real UDF data structures.

"I have read into this, the only way to successfully make a UDF CD is to first make a loopback image, format that as UDF, put your files on it, then burn the image.

Essentially, it is not ready yet to flip a switch with mkisofs and cdrecord like you can with joilet or iso9660. "

rpm: udftools - Linux UDF Filesystem userspace utilities.
 * mkudffs

isoinfo is unable to read udf discs: $ isoinfo -i udf.iso -d CD-ROM is NOT in ISO 9660 format

blkid just reports: $ blkid udf.iso udf.iso: TYPE="udf"

file just reports: $ file udf.iso udf.iso: data

rpm: dvd+rw-tools - Toolchain to master DVD+RW/+R media
 * growisofs

To create DVD UDF File: dd if=/dev/zero of=file.iso bs=1024 count=4589800 mkudffs file.iso mkdir /mnt/loop mount -o loop -t udf file.iso /mnt/loop cp big_file /mnt/loop umount /mnt/loop

Articles

 * HELIOS - “mkisofs” – the ultimate UDF disk image backup utility - http://www.helios.de/viewart.html?id=1000-en
 * Dvdbackup - ArchWiki - http://wiki.archlinux.org/index.php/Dvdbackup
 * How to Write Data to removable media - http://www.ing.iac.es/~cfg/services/cd.html
 * CD-Writing HOWTO V1.4 - http://solar.physics.montana.edu/sol_phys/help/cd_writer.html

Linux Options - Value to large
Error: mkisofs: Value too large for defined data type. File XXX is too large - ignoring

source: mkisofs: Value too large for defined data type - http://www.karakas-online.de/forum/viewtopic.php?t=9693

The problem here is the ISO 9660 specification, which reserves only 32 bits for the file size. Rolling Eyes

There are 2 ways to solve this problem:

SOLUTION #1: Make a UDF-formatted loopback file, copy the files in it, then use growisofs to write the file directly to the burner device:

dd if=/dev/zero of=file.iso bs=1024 count=4589800 mkudffs file.iso mkdir /mnt/loop mount -o loop -t udf file.iso /mnt/loop cp big_file /mnt/loop umount /mnt/loop growisofs -speed 4 -Z /dev/dvd=file.iso

This has the advantage that you can have more than one files written on the DVD.

See http://forums.gentoo.org/viewtopic-t-288827.html

HOWEVER, I don't have mkudffs...Sad

So forget this one...

SOLUTION #2: Write only the one huge file onto the DVD with:

growisofs -dvd-compat -Z /dev/dvd=backup.tgz

However, now you cannot mount the DVD, since there is no filesystem! You have to access it like a tape device:

tar -tzf /dev/dvd

See http://geekpit.blogspot.com/2007/02/creating-large-2gb-dvd-backups-under.html

HOWEVER, this does not work for me: Sad

kernel: scsi1: ERROR on channel 0, id 0, lun 0, CDB: Request Sense 00 00 00 40 00 kernel: Info fld=0x10, Current sd0b:00: sense key Medium Error kernel: Additional sense indicates Unrecovered read error kernel: I/O error: dev 0b:00, sector 64 kernel: scsi1: ERROR on channel 0, id 0, lun 0, CDB: Request Sense 00 00 00 40 00 kernel: Info fld=0x11, Current sd0b:00: sense key Medium Error kernel: Additional sense indicates Unrecovered read error kernel: I/O error: dev 0b:00, sector 68

Thus, my only option is to reduce the file size to less than 2GB... Sad

Regards, Chris Karakas www.karakas-online.de

ISO Info
isoinfo:
 * "devdump, isoinfo,  isovfy,  isodump - Utility programs for dumping and verifying iso9660 images."

isoinfo -i [iso] -d

Creating Bootable ISO
Install mkisofs: yum install mkisofs

bootable notes
[http://www.cyberciti.biz/tips/how-to-mount-iso-image-under-linux.html How to:

Mount an ISO image under Linux]

"richard, to edit bootable ISO mount it as it’s described here, copy it’s

contents to some directory, edit files you need and generate new ISO by

command:"

mkisofs -o /tmp/new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat

-no-emul-boot \ -boot-load-size 4 -boot-info-table -J -R -V “new iso name”.

[http://www.yolinux.com/TUTORIALS/LinuxTutorialRecoveryAndBootDisk.html Linux

Tutorial - Linux Recovery and Boot Disk Creation]:

mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4

-boot-info-table -o grub.iso iso

Hacking Red Hat Kickstart: cd /RH80/ONE_CD mkisofs -r -T -J \ -V "My Custom Installation CD" \ -b images/boot.img \ -c images/boot.cat \ -o /RH80/mydist.iso \ /RH80/ONE_CD

[http://isg.ee.ethz.ch/tools/realmen/det/autosetup_w2k3.en.html Real Men Don't

Click -- Automated Server Setup 2003]: mkisofs -o w2k3-isg.iso -N -d -l -no-iso-translate -relaxed-filenames -V W2P_ISG -boot-load-seg 0x7c0 -b boot.bin -c boot.cat -no-emul-boot nrmsvol_en

[http://www.g-loaded.eu/2007/04/25/how-to-create-a-windows-bootable-cd-with-mk

isofs/ How to create a Windows bootable CD with mkisofs]:

mkisofs \ -b cdboot/msboot.img -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 \ -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames \ -V "WINSP" \ -o ../winsp.iso.

everytime I placed the msboot.img outside the win files directory and used -b

../msboot.img, mkisofs complained with the following pesky error message: mkisofs: Uh oh, I cant find the boot image '../msboot.img' !

Burning ISO
See Linux/CD Burning

Extract El Torito Bootable Image
Use the geteltorito perl script, part of the cdrkit.

cdrtools and cdrkit
[http://cdrecord.berlios.de/private/cdrecord.html Cdrtools - Highly portable

CD/DVD/BluRay command line recording software]
 * Warning: users on Linux distributions please

read this information on

bugs and license problems.

cdrkit - portable command-line CD/DVD recorder

software
 * Releases: http://cdrkit.org/releases/

cdrkit - Wikipedia
 * cdrkit is a collection of computer programs for CD and DVD authoring that

work on Unix-like systems. License issues in recent cdrtools versions

prompted Debian cdrtools maintainers to fork cdrtools (mkisofs) into cdrkit.

[http://somelinuxstuff.blogspot.com/2007/08/extract-el-torito-boot-image-from-

iso.html Good stuff.: Extract an El Torito boot image from an ISO file under

linux] geteltorito win2k3ent.iso win2k3ent.img

[http://www.sourcefiles.org/CD_Writing/Tools/geteltorito.pl geteltorito.pl: a

bootimage extractor] (online source)

[http://packages.debian.org/unstable/otherosfs/genisoimage Debian -- Details

of package genisoimage in sid] To install geteltorito perl script: wget http://cdrkit.org/releases/cdrkit-1.1.9.tar.gz tar -zvxf cdrkit-1.1.9.tar.gz cd cdrkit-1.1.9/3rd-party sudo cp geteltorito.1 /usr/share/man/man1/ sudo mkdir /usr/share/doc/geteltorito sudo cp geteltorito/README.geteltorito /usr/share/doc/geteltorito/README sudo cp geteltorito/geteltorito.pl /usr/local/bin/geteltorito sudo chmod +x /usr/local/bin/geteltorito
 * geteltorito - extract an El Torito boot image from a CD image

keywords
iso mkiso mkisofs mkfsiso mkfs.iso