mksysb Backups w/ NIM

NIM is great for backing up systems and pushing out packages, but there isn’t a included system for managing mksysb images.  I’ve got a little script that runs on the NIM server and either does a mksysb on all the clients registered or you can specify certain clients.  It also keeps X number of old mksysb images and purges the remaining ones.  It’s needs a little cosmetic work, but you can use it as a basis for your own system.

get_mksysb

Now, since you have NIM working, you really should run a mksysb backup to tape so you have bootable media to get your NIM server back up.  I have two of them, which happen to also be my TSM servers, that I also backup to eachother.  Since you can’t have your NIM master be a client on another NIM server, I have a little script that generates a mksysb on disk (plus any extra VGs) and uses scp to copy the images to the other server. It’s stupid simple, and could use come cosmetics, but it works:

#!/bin/ksh
# Usage: mksysb.ksh dest_hostname [ extra_vg ... ]

hostname=`hostname`
dest_host=$1

shift

scp_file() {
        /usr/bin/scp $1 $dest_host:/export/mksysb/$hostname/

}


/usr/bin/mksysb -e -i -X /shared/mksysb.$hostname

if [ $? -eq 0 ]
then
        scp_file /shared/mksysb.$hostname 
else
        echo "mksysb backup failed!"
        exit 1
fi

if [ $? -eq 0 ]
then
        rm /shared/mksysb.$hostname
fi

while [ "$1" != "" ]
do
        savevg -f /shared/$1.savevg $1
        if [ $? -eq 0 ]
        then
                scp_file /shared/$1.savevg
                rm /shared/$1.savevg
        else
                echo "savevg of $1 failed!"
                exit 1
        fi
        shift
done

If you need to restore this mksysb, you just have to register it as a NIM object, then register the client on the NIM master and do the restore as normal.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*