Bharat Balegere 's Undocumented Tech Tips

Easily mount iso files as virtual drives in ubuntu

The biggest flaw in Gmount-iso, AcetoneIso ,Furius ISO Mount and mount.sh scripts is that THEY CANNOT MOUNT ISO IMAGES USING THE UDF FORMAT.
I recently download WAIK from microsoft.com and tried mounting it in ubuntu using the following methods, mount.sh(kernel loop module),GmountIso and AcetoneIso.
None of them could mount it correctly.The mount folder contained a single file called readme.txt
This file contained the following message

This disc contains a “UDF” file system and requires an operating system that supports the ISO-13346 “UDF” file system specification.

So I have modified the mount.sh script available at ubuntugeek.com and ubuntuforums.org to mount both iso9660 and udf formats.The trick here is to replace iso9660 with auto.This modification mounts both standard iso9660 and UDF formats.

The modified code is as follows

#!/bin/bash
#
# nautilus-mount-iso
gksudo -u root -k /bin/echo “got r00t?”
sudo mkdir /media/”$*”
if sudo mount -o loop -t auto “$*” /media/”$*”
then
if zenity –question –title “ISO Mounter” –text “$* Successfully Mounted.
Open Volume?”
then
nautilus /media/”$*” –no-desktop
fi
exit 0
else
sudo rmdir /media/”$*”
zenity –error –title “ISO Mounter” –text “Cannot mount $*!”
exit 1
fi

Enter the above code in a text editor and save it as mount.sh in your home folder.

When you replace iso9660 with auto ,then the type of format is automatically detected.
This method does not work with images using the HFS format(used in Macintosh)
To mount HFS image files modify the line like this

if sudo mount -o loop -t hfsplus “$*” /media/”$*”

and save this as mounthfs.sh

So you have 2 scripts to mount iso images.
One to mount udf images and the other to mount the standard iso9660 images.

code for Unmount script

#!/bin/bash
#
for I in “$*”
do
foo=`gksudo -u root -k -m “enter your password for root terminal
access” /bin/echo “got r00t?”`
sudo umount “/media/$I” && zenity –info –text “Successfully unmounted /media/$I/” && sudo rmdir “/media/$I/”
done
done
exit0

Enter the above code in a text editor and save it as unmount.sh in your home folder.

Execute the following commands in the Terminal (Application|Accessories|Terminal) to make it executable

sudo chmod +x /home/username/mount.sh

sudo chmod +x /home/username/mounthfs.sh

sudo chmod +x /home/username/unmount.sh

Now copy mount.sh , mounthfs.sh and unmount.sh to the nautilus scripts folder using the following commands.Make sure you replace username with your uername.

sudo mv /home/username/mount.sh ~/.gnome2/nautilus-scripts/

sudo mv /home/username/mounthfs.sh ~/.gnome2/nautilus-scripts/

sudo mv /home/username/unmount.sh ~/.gnome2/nautilus-scripts/

Thats it.Right click on any iso image click on Scripts|Mount.sh or Mounthfs.sh.Your iso image will be mounted as an virtual drive.To unmount it right click on the iso image and click unmount.

 

Like This Post ?

RSS Digg Twitter StumbleUpon Delicious Technorati Reddit Facebook Mixx Diigo Google Yahoo

One Comment

Trackbacks and Pingbacks

Leave a Comment


Name (required)

Mail (will not be published) (required)

Website

Comment

Spam Protection by WP-SpamFree