Friday, August 29, 2008

Mounting ISO and DD Image Files

Occasionally, I'll download an image file and want to see what is on it, or make a few changes to it before burning it to CD.

The image file (dd, iso, etc) can be mounted using the loop device. You will need to know the type of filesystem the image uses.

Most Linux/Unix-based OS's have an application that will help you identify the filesystem type. Debian includes the command /lib/udev/vol_id, SUSE has the same command but in a different location (/sbin/vol_id). If you know how to get this information on a SUN box, please leave a comment for us.

If you don't have a command that will tell you the filesystem type, you can guess. Most images downloaded from the Internet will be iso9660, Windows filesystems are normally ntfs, Linux are commonly ext2, and Macintosh are udf or hfs.

As a last resort, you can work your way down the list of filesystem types listed in the mount man pages.

After you know the filesystem type, you are ready to mount.
Note: replace <_type> with the filesystem type.

To mount the file livebootcd.iso with write enabled:

mount -t <_type> -o loop ./livebootcd.iso /mnt

To mount an image made from a Windows partition in read-only mode:

mount -t ntfs -o loop,ro,umask=0222 ./evidence.dd /mnt

Post provided by Mary M. Chaddock


UX-admin said...

"If you know how to get this information on a SUN box, please leave a comment for us."


fstyp(1M) - determine filesystem type

> su -
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# fstyp /dev/rdsk/c0d0s0

Tobias said...

You can also use file(1) to determine the filesystem type:

foo@bar:~$ file example.iso
example.iso: ISO 9660 CD-ROM filesystem data 'MT410 ' (bootable)

beardy's thoughts, more or less unorganized