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 » Backups, Commands & Shells

Working with ISO images on Solaris

Submitted by on November 22, 2005 – 4:57 pm 4 Comments

The following two commands will take all data in /home/neal, copy it to the ISO file, and burn the ISO file to a recordable CD.

mkisofs -l -L -r -o /local/mycdromfile2.iso  /home/neal
cdrecord -v /local/mycdromfile2.iso

The resulting ISO image can be mounted directly from hard drive, without having to burn it to a CD. Here’s how:

mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mountpoint

The following script allows you to rip a CD-ROM to your hard drive as an ISO file and mount the file as a virtual CD.

#!/bin/sh
# igor@krazyworks.com
#
# 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

4 Comments »

  • ademuth93 says:

    K Im gonna use either OS for a main OS on my second computer. I need to know hich one is gonna be better for gaming, media, clustering, file server, and web server.
    Wont affect any choice on best answer. But i am aware that linux isnt #1 for gaming

  • Blake says:

    i tried many of them like small free ones but they do not work! I need a free cddvd burner software that can burn iso! If no one works, i have a daemon tools and i created an iso image with it of what i need! Is it possible to put that on a cd?? How??
    and two more questions! Can i find drivers for Solaris 10 for my computer wich is a gericom notebook and 2 is how can i transfer my files to the new os!!!

    The burner softwares i need are for Windows
    I need for windows

  • Ev dog says:

    Well I use Mac OS X 10.6.3 and I find it great but I use VMWare a lot and find Solaris nice but want to know what your favorite Linux Distro BSD “flavor” is or basically any other OS you find cool.

  • toysruslover says:

    I know about `cdrecord`, but the fact that it’s open-source and basically supported by one random guy would make my company leary to adopt it.

    I’m looking for a command-line based application that will allow us to write image files (multi-page tiffs, if that matters) to a DVD Writer driver connected to a Solaris box. Preferably, one made by a company that we could purchase a license agreement from, rather than just download an open-source or freeware package.

    Any advice or suggestions you might have would be appreciated.

Leave a Reply

%d bloggers like this: