Wednesday, January 09, 2008

Mount and Unmout ISO images without burning them

taken from other site, i've combain two article, please read til the end of Capter


HOWTO: Nautilus Script to mount .iso files

I recently found a nautilus shell script on an older post to the forum that could mount .iso files, but it couldn't handle spaces in filenames or mount more than one file at once. After some struggle I've come up with these scripts which handle multiple concurrent mounts and filenames with spaces. You'll want to save these under ~/.gnome2/nautilus-scripts/ and make them executable:

Mount:
Code:
#!/bin/bash
#
# nautilus-mount-iso

gksudo -u root -k /bin/echo "got r00t?"

sudo mkdir /media/"$*"

if sudo mount -o loop -t iso9660 "$*" /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
Unmount:
Code:
#!/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 "$I" && zenity --info --text "Successfully unmounted /media/$I/" && sudo rmdir "/media/$I/"
done
done
exit0
To use either one just right click on the .iso file and use scripts -> mount. Hope someone finds this useful. Does anyone know if there's a way to make nautilus just unmount by right clicking on the volume icon on the desktop and selecting unmount volume?
__________________

Last edited by animacide : December 22nd, 2005 at 07:59 AM. Reason: Improved mounting script
Reply With Quote

Mount and Unmout ISO images without burning them

Posted by admin on December 22nd, 2006 EMail This Post

Some times you want to use iSO images without burning them.If you don't want to waste your CD's/DVD's here is the simple possible solutions using these tips you can mount and unmount ISO images without burning them.

I know two possible solutions

1) Using Nautilus Scripts

2) Using kernel loop module

Now we will see each one in detailed

Using Nautilus Scripts

I am taking this tip from here first you need to download two scripts for mount iso images download from here for unmount iso images download from here

Once you have these two scripts you need to change the permissions using the following commands

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

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

Now you need to copy them nautilus scripts

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

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

That's it now you are ready for mounting and unmounting your ISO images.

Example

Mount ISO Image

Now i have one ISO image if you want to mount you need to right click and select scripts —> mount-iso

Now it will prompt for root password and click ok

You can see the Mounter notification like the following

Here is the Successfully mounted message if you want to open this one click ok

This shows you available contents in mounted ISO image

Unmount ISO Image

Now i have one ISO image if you want to mount you need to right click and select scripts—>unmount-iso

Here is the Successfully Unmounted message

Using loop Kernel Module

First you need to make the directory to put the ISO into using the following command

sudo mkdir /media/isoimage

Now you need to add the loop module to your kernel.

What kernel loop module does?

I want to give brief introduction to kernel loop module.Using the module loop it is possible to mount a filesystem file. squashfs is a "loop" with (de)compression (Compressed Loopback Device) and it is possible to mount a compressed filesystem like a block device and seamlessly decompress its data while accessing it.

Use the following command to load loop module

sudo modprobe loop

Mount ISO Image

If you want to mount you need to use the following command

sudo mount debianetch.iso /media/isoimage/ -t iso9660 -o loop

In the above command you can replace debianetch.iso to your own iso image.

Now you should have your iso file mounted, and accessible from your desktop.

Unmount ISO Image

Unmount ISO Image Using the following command

sudo umount /media/isoimage