First, we're going to use the automounter together with /dev/loop to mount the ISO files on demand. Before we can go any further, ensure that you have the automounter installed:
{{Code|Code= yum -y install autofs}}
Next, create a suitable mount point. In this example, we're using /media/iso-fs
{{Code|Code= mkdir -p /media/iso-fs}}
Now create a file called /media/.iso-fs.map using your favourite editor with the following contents:
{{Text|<pre>Text=#!/bin/bash
DIR_LIST=(/var/hda/files/torrents /home/*/Downloads)
iso=`find ${DIR_LIST[@]} -name $1.iso -type f`
echo "-fstype=iso9660 :$iso"
}}</pre>
This script will act as an executable mount map for the automounter, returning suitable mount point parameters if it finds an ISO file that matches the key passed to it.
...and ensure that this file is executable:
{{Code|Code= chmod u+x /media/.iso-fs.map}}
The final step is to create an entry in the master automount map. Edit /etc/auto.master and add the following line somewhere after the default /net entry:
{{Text|Text= /media/iso-fs /media/.iso-fs.map ro,loop --timeout=5}}
The last parameter is the time in seconds after which a mount point will be automatically unmounted. Now restart the automounter with:
{{Code|Code= service autofs restart}}
If all has gone well, then you should be able to browse any ISO image that you have in your torrents or downloads directories. In my case, I have ubuntu-10.10-desktop-i386.iso in my torrents directory, so I get:
{{Code|Code= bash$ ls /media/iso-fs/ubuntu-10.10-desktop-i386/ autorun.inf dists md5sum.txt preseed usb-creator.exe boot install pics README.diskdefines wubi.exe casper isolinux pool ubuntu}}
You can browse around the directories, copy files etc at leisure, and when you're done the automounter will release the loop device for reuse.