Mounting an ISO on Linux

June 3rd, 2009

For a few reasons now, I’ve had ISOs (basically a one file archive of the contents of a CD; see wikipedia for more details.) on my machine that I wanted to use without burning them to a CD. For instance, I have a few versions of RHEL that I wanted to grab packages from or, more recently, the need to install the beta builds of Satellite 5.3.

The cool part is that it can be mounted the same way a local disk or a network share is. If you’re not familiar with the term, mounting is where you take a file source (local partition, shared network directory, or in this case an ISO file) and assign it a directory on your local machine. Whenever you access that directory, it will use the underlying file source you’ve specified. So rather than making a big distinction between the physical location of your files (for instance, C: v. D: v. Network Share or whatever it’s called), you can just work with files and directories and not really care where they are physically located.

The same mount executable is used for all of the above scenarios. The particular flags for mounting an ISO are as follows:

mount -o loop <file.iso> <mount-point>

The argument “file.iso” should be pretty self-explanatory, it’s simply the ISO you’re mounting. The mount point is a directory you’ve created ahead of time. So to mount the Satellite 5.3 beta image I brought home with me from Raleigh, it was as simple as:

mkdir /mnt/sat530
mount -o loop Satellite-5.3.0-re20090529.0-i386.iso /mnt/sat530

Once I hopped over to the /mnt/sat530 directory I was able to navigate around the files just like if they were normal files on my filesystem. Sweet.

Comments are closed.