SUMMARY: Help troubleshooting bare-metal restore procedure.

From: Kevin Counts <counts_at_digicat.org>
Date: Mon Mar 01 2004 - 16:41:32 EST
SUMMARY: Help troubleshooting bare-metal restore procedure.

Thank you:
   Anand Chouthai
   Roy Erickson

With help from contributors I identified two things wrong
w/ the procedure I was implementing:

 1. I needed to update /dev,/devices, and /etc/path_to_inst
    so that the replacement FC drive w/ a new WWN 
    was correctly recognized as the root disk (this was on a Sun 280R).

 2. After fixing that it helped me uncover the "lockup". It was because
    I didn't add the "-H" option to bprestore which indicates that
    to rename the hardlink targets as well as the normal
    source files (I thought bprestore had an AI module that figured
    all that out ;-).

 After making these two changes I was able to get the system
 back to a sane state.

 Below are the updated scripts. 

 The first one is the revised script I am using to do the actual
 bare metal restore.

 The second is a script I use to build a recovery image. Certain
 packages and tarballs are needed which aren't included but
 the general idea is there.

 --

 The only quirk I have observed is that /var/run doesn't get
 mounted as swap (the system creates a normal directory).

    mount: mount-point /var/run does not exist.

 Not sure about this one but for now I will live w/ it.

 Thanks again Sun Managers!

 Kevin Counts 

 --

Script #1:

#!/bin/sh
#------------------------------------------------------------------------
# $Id: recover-egate2.sh,v 1.7 2004/03/01 19:36:06 countskm Exp $
#------------------------------------------------------------------------
# Custom script to restore egate2 (run from jumpstart recovery image).
#-------------------------------------------------------------------------

#-------------------------------------------------------------------------
# Create pre-defined vtoc for 36GB FC Drive
#-------------------------------------------------------------------------

/usr/sbin/fmthard -s - /dev/rdsk/c1t0d0s2 <<EOF
       0      2    00          0   8389656   8389655
       1      3    01    8389656   8389656  16779311
       2      5    00          0  71127180  71127179
       3      7    00   16779312  16779312  33558623
       4      0    00   33558624  37516554  71075177
       6      0    00   71075178     26001  71101178
       7      0    00   71101179     26001  71127179
EOF

echo "y" | /usr/sbin/newfs /dev/rdsk/c1t0d0s0
echo "y" | /usr/sbin/newfs /dev/rdsk/c1t0d0s3
echo "y" | /usr/sbin/newfs /dev/rdsk/c1t0d0s4

/usr/sbin/fsck /dev/rdsk/c1t0d0s0
/usr/sbin/fsck /dev/rdsk/c1t0d0s3
/usr/sbin/fsck /dev/rdsk/c1t0d0s4

mount /dev/dsk/c1t0d0s0 /a
mkdir -p /a/var
mkdir -p /a/opt
mount /dev/dsk/c1t0d0s3 /a/var
mount /dev/dsk/c1t0d0s4 /a/opt

#------------------------------------------------------------------------
server=veritas
log=/var/tmp/bprestore.log
rename=/var/tmp/bprestore.rename
filelist=/var/tmp/bprestore.filelist

# extra_opt="-e 2/01/2004 -C egate2"
  extra_opt="-C egate2"

cat <<EOF > ${filelist}
/
!/egate
EOF

cat <<EOF > ${rename}
change / to /a
EOF

cat /dev/null > ${log}

cat <<EOF

--------------------------------------------------------------------
 Running bprestore in foreground.                                   

 View logfile: $log in another login session for status.
 
 (A message will appear in this window when the restore is complete)
--------------------------------------------------------------------

EOF

echo \
/usr/openv/netbackup/bin/bprestore -w                \
                                   -H                \
                                   -S ${server}      \
                                   -L ${log}         \
                                   -R ${rename}      \
                                   ${extra_opt}      \
                                   -f ${filelist}

/usr/openv/netbackup/bin/bprestore -w                \
                                   -H                \
                                   -S ${server}      \
                                   -L ${log}         \
                                   -R ${rename}      \
                                   ${extra_opt}      \
                                   -f ${filelist}


#-------------------------------------------------------------------------
# Make excluded /egate mountpoint
#-------------------------------------------------------------------------
mkdir -p /a/egate

#-------------------------------------------------------------------------
# Unconfigure disksuite mirror
#-------------------------------------------------------------------------
mv /a/etc/lvm/mddb.cf /a/etc/lvm/mddb.cf.bak

sed -e 's!md/!!g'         \
    -e 's!d10!c1t0d0s0!g' \
    -e 's!d20!c1t0d0s1!g' \
    -e 's!d30!c1t0d0s3!g' \
    -e 's!d40!c1t0d0s4!g' \
/a/etc/vfstab > /a/etc/vfstab.tmp

cp /a/etc/vfstab     /a/etc/vfstab.bak
cp /a/etc/vfstab.tmp /a/etc/vfstab

sed -e '/^rootdev/ s/^/*/' \
    -e '/^set md/  s/^/*/' \
/a/etc/system > /a/etc/system.tmp

cp /a/etc/system     /a/etc/system.bak
cp /a/etc/system.tmp /a/etc/system

#-------------------------------------------------------------------------
# Rebuild /dev and /devices and /etc/path_to_inst
# Typically we don't backup /dev so check if its even there.
#-------------------------------------------------------------------------
[ -d /a/dev ] && mv /a/dev /a/dev.bak
                 mv /a/devices  /a/devices.bak

mkdir /a/dev
mkdir /a/devices

cd /dev     ;     find . -depth -print  | cpio -pdm /a/dev
cd /devices ;     find . -depth -print  | cpio -pdm /a/devices
cd

mv /a/etc/path_to_inst \
   /a/etc/path_to_inst.bak

cp /tmp/root/etc/path_to_inst \
   /a/etc/path_to_inst


#-------------------------------------------------------------------------
# Make mount points excluded from backup
#-------------------------------------------------------------------------
mkdir          /a/tmp
chmod 1777     /a/tmp
chown root:sys /a/tmp

#-------------------------------------------------------------------------
# Umount the slices and install the ufs boot block 
#-------------------------------------------------------------------------
umount /a/var
umount /a/opt
umount /a

/usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0

echo "--------------------------------------------------------------------"
echo " Restore complete - type \"reboot -- -r\" to reboot the system."
echo "--------------------------------------------------------------------"

#-------------------------------------------------------------------------
# End.
#-------------------------------------------------------------------------


Script #2:


#!/bin/sh
#-------------------------------------------------------------------------
# Configuring Solaris 8 Boot Image
#-------------------------------------------------------------------------
root=/export/install/SOL8-RECOVER-TEST/Solaris_8/Tools/Boot/
noask=/export/depot/fileset/isconf/plat/sunos/5.8/etc/noask_pkgadd
depot=/export/depot/pkg/sunos/5.8

#-------------------------------------------------------------------------
perl -pi -e '/^root/ && s/NP/<your own hash>/' $root/etc/shadow

exit 0
pkgadd -d ${depot}/SMC/SMCncurs-5.3 -R $root  \
       -n -a ${noask} all

pkgadd -d ${depot}/MCC/MCCssh2-3.2.3 -R $root \
       -n -a ${noask} all

pkgadd -d ${depot}/SMC/SMCbash-2.05 -R $root  \
       -n -a ${noask} all


#-------------------------------------------------------------------------
perl -pi -e ' /^\s*install\)/ and print <<EOF

                recover)
                         cat < /dev/null > /tmp/._recover_startup
                         shift
                         ;;

EOF
' $root/sbin/rcS

#-------------------------------------------------------------------------
perl -pi -e ' m!#/usr/sbin/inetd -s! and print <<EOF

if [ -f /tmp/._recover_startup ] ; then
   /usr/sbin/inetd -s
fi
EOF
' $root/sbin/sysconfig

#-------------------------------------------------------------------------
perl -pi -e ' m!exec /sbin/suninstall! and print <<EOF
if [ -f /tmp/._recover_startup ] ; then
   exec /bin/ksh -o vi
fi

EOF
' $root/sbin/sysconfig

#-------------------------------------------------------------------------
cp -rp tmp_proto/openv $root/.tmp_proto/

ln -s /tmp/openv $root/usr/openv

#-------------------------------------------------------------------------
cat <<EOF >> $root/etc/services
#
# NetBackup services
#
bprd    13720/tcp       bprd
bpcd    13782/tcp       bpcd
vopied  13783/tcp       vopied
bpjava-msvc     13722/tcp       bpjava-msvc
EOF

#-------------------------------------------------------------------------
cat <<EOF >> $root/etc/inetd.conf
#
# netbackup services
#
bpcd    stream  tcp     nowait  root    /usr/openv/netbackup/bin/bpcd bpcd
vopied  stream  tcp     nowait  root    /usr/openv/bin/vopied vopied
bpjava-msvc     stream  tcp     nowait  root    /usr/openv/netbackup/bin/bpjava-msvc bpjava-msvc -transient
EOF
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Mar 1 16:40:53 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:26 EST