Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Filesystems

Create and mount ISO image under Solaris

Submitted by on November 19, 2005 – 10:33 pm 7 Comments

1. Disable volume management:

/etc/init.d/volmgt stop

2. Insert CD and create ISO:

dd if=/dev/rdsk/c0t6d0s2 of=/destination_path/image_name.iso bs=1024k

3. After ISO is created, make mountpoint and mount the ISO:

mkdir /destination_path/mountpoint
mount -F hsfs -o ro `lofiadm -a /destination_path/image_name.iso` /destination_path/mountpoint

4. Re-enable volume manager

/etc/init.d/volmgt start

5. Share mounted ISO as CD-ROM to remote systems:

share -F nfs -o ro,anon=0 /destination_path/mountpoint

6. Mount shared ISO image on a remote system:

mkdir /local_mountpoint
mount -o ro server: /destination_path/mountpoint /local_mountpoint

And here’s an example of a Shell script that will interactively rip a CD to ISO, mount and export it for you.

#!/bin/sh
# krazyworks.com
# November 21, 2004
#
# Rip CD-ROM to ISO image, mount, and share

clear

if [ `uname -a | egrep -ic linux` -gt 0 ]
then
        OSTYPE="Linux"
elif [ `uname -a | egrep -ic "sunos|solaris"` -gt 0 ]
then
        OSTYPE="Solaris"
else
        echo ""
        echo "Unsupported OS: this script will only work under Solaris or Linux."
        exit
fi

echo "OS type: $OSTYPE"
echo ""
echo "This script will create an ISO image of the CD-ROM currently in the"
echo "local CD drive on `hostname`. This sceript must be executed as root."
echo "The copy process may take over 10 minutes depending on the speed of"
echo "the CD drive. During the copy process the script will temporarily"
echo "disable the automounter."
echo ""

if [ "$OSTYPE" = "Solaris" ]
then
        echo "Proceed with the copy process? [y/n]: c"
elif [ "$OSTYPE" = "Linux" ]
then
        echo -n "Proceed with the copy process? [y/n]: "
fi
read RESPONSE1
if [ "$RESPONSE1" != "y" ]
then
        exit
fi

#--------------------------------------------
# CREATE ISO IMAGE
#--------------------------------------------

echo ""
if [ "$OSTYPE" = "Solaris" ]
then
        echo "Enter the location for storing ISO images: c"
elif [ "$OSTYPE" = "Linux" ]
then
        echo -n "Enter the location for storing ISO images: "
fi
read ISODIR
if [ ! -d "$ISODIR" ]
then
        echo "Directory not found: $ISODIR"
        exit
fi

echo ""
if [ "$OSTYPE" = "Solaris" ]
then
        echo "Enter CD-ROM title: c"
elif [ "$OSTYPE" = "Linux" ]
then
        echo -n "Enter CD-ROM title: "
fi
read ISONAME

ISONAME=`echo "$ISONAME" | sed 's/ /_/g'`

if [ -f "$ISODIR/$ISONAME.iso" ]
then
        echo ""
        if [ "$OSTYPE" = "Solaris" ]
        then
        echo "Image $ISODIR/$ISONAME.iso already exists. Do you want to delete it? [y/n]: c"
        elif [ "$OSTYPE" = "Linux" ]
        then
                echo -n "Image $ISODIR/$ISONAME.iso already exists. Do you want to delete it? [y/n]: "
        fi
        read RESPONSE4
        if [ "$RESPONSE4" = "y" ]
        then
                if [ `df | fgrep -c "$ISODIR/$ISONAME"` -gt 0 ]
                then
                        unshare $ISODIR/$ISONAME > /dev/null
                        umount $ISODIR/$ISONAME > /dev/null
                        rm $ISODIR/$ISONAME.iso
                fi
        else
                exit
        fi
fi

if [ "$OSTYPE" = "Solaris" ]
then
        echo ""
        echo "Ejecting CD-ROM..."
                eject cdrom
        echo "Stopping volume management..."
                /etc/init.d/volmgt stop
        echo ""
        echo "Insert CD-ROM you wish to copy and press enter when ready...c"
        read RESPONSE3
        echo "Detecting CD..."
        sleep 10
elif [ "$OSTYPE" = "Linux" ]
then
        echo ""
        echo -n "Insert CD-ROM you wish to copy and press enter when ready..."
        read RESPONSE3
        sleep 5
fi

echo ""
echo "Creating ISO image. This process may take several minutes."
echo ""

if [ "$OSTYPE" = "Solaris" ]
then
        dd if=/dev/rdsk/c0t6d0s2 of="$ISODIR/$ISONAME.iso" bs=1024k
elif [ "$OSTYPE" = "Linux" ]
then
        dd if=/dev/cdrom of="$ISODIR/$ISONAME.iso" bs=1024
fi

if [ $? -eq 0 ]
then
        echo ""
        echo "ISO image created: "
        ls -als "$ISODIR/$ISONAME.iso"
else
        echo ""
        echo "ISO could not be created."

        if [ "$OSTYPE" = "Solaris" ]
        then
                echo ""
                echo "Re-enabling volume management..."
                /etc/init.d/volmgt start
        fi
        exit
fi

#--------------------------------------------
# MOUNT & SHARE ISO IMAGE
#--------------------------------------------

echo ""
if [ "$OSTYPE" = "Solaris" ]
then
        echo "Do you wish to mount and export this ISO image? [y/n]: c"
elif [ "$OSTYPE" = "Linux" ]
then
        echo -n "Do you wish to mount and export this ISO image? [y/n]: "
fi
        read RESPONSE5
if [ "$RESPONSE5" != "y" ]
then
        exit
fi

if [ ! -d "$ISODIR/$ISONAME" ]
then
        mkdir "$ISODIR/$ISONAME"
fi

if [ "$OSTYPE" = "Solaris" ]
then
        echo ""
        echo "Re-enabling volume management..."
                /etc/init.d/volmgt start
        sleep 5
        echo "Mounting $ISODIR/$ISONAME.iso $ISODIR/$ISONAME"
        mount -F hsfs -o ro `lofiadm -a $ISODIR/$ISONAME.iso` $ISODIR/$ISONAME
elif [ "$OSTYPE" = "Linux" ]
then
        echo ""
        echo "Mounting $ISODIR/$ISONAME.iso $ISODIR/$ISONAME"
        mount "$ISODIR/$ISONAME.iso" "$ISODIR/$ISONAME" -t iso9660 -o ro,unhide,loop=/dev/loop0 > /dev/null
fi

if [ $? -eq 0 ]
then
        share -F nfs -o ro,anon=0 $ISODIR/$ISONAME > /dev/null
        echo ""
        echo "$ISONAME.iso is mounted under $ISODIR/$ISONAME and shared globally in read-only mode."
        echo ""
        echo "You can mount this image as virtual CD-ROM from a remote system by running:"
        echo "mount -o -ro `hostname`:$ISODIR/$ISONAME /local_mountpoint"
        echo ""
else
        echo ""
        echo "$ISONAME.iso could not be mounted."
        exit
fi
exit

Print Friendly, PDF & Email

7 Comments »

  • israel says:

    excellent!!

    Thks.

  • Jose B says:

    So I torrented the Rosetta stone ISO and I need help running it. I download three different programs but it only opens up a folder with the stuff for it inside. How can I get it to run on my netbook?
    I’ve tried mounting, but it only opens up a folder with data.

  • simply complicated says:

    I just received Redscale film that has an ISO range of 50-200, but how do I adjust the ISO to 50, 80, 100, or 200? There is a cloudy and a sunny setting on my Diana mini, but that is it. Also, no instructions came with my film, so I’m hoping someone here can help me. Thanks in advance!

  • TommyKay says:

    I have never been able to take good night pictures of, the moon for example, and I read that I need to change the ISO to 400. I looked at my Camera to try and figure it out but I don’t really think I did anything. Help would be appreciated! :)

    Thanks!

  • JimT says:

    I have a Nikon Coolpix L100, which unfortunately does not support manual ISO changes. I can only set the camera to a high ISO mode, but no more than that. But if I want to take bright pictures without flash, or change the ISO, is there any way to do so?

  • mr flibble says:

    Every time i come to download iso games i keep it onmy psp and it doesnt appear when i open games in my memory stick i went to the place where i baught the psp the man said that there is a program to let iso games work can i know whats the name of the software.

  • easton j says:

    I am trying to burn a iso image from a downloaded pc game onto a blank dvd. what is a good program to use to do this? and is there anything i should know about it?

Leave a Reply

%d bloggers like this: