Mirroring system disks

Right now jumpstart fails to create mirrored system on our thumpers (see according Case ID). Thus it is required to create the mirror after the install. Please look at this script and correct it accordingly - THIS SCRIPT IS CURRENTLY UNTESTED:

## $Id$
## mirror_system_disk.sh
## Made by Carsten Aulbert
## Login   <carsten@miya>
## Started on  Fri Mar 21 13:01:16 2008 Carsten Aulbert
## Last update Fri Mar 21 13:01:16 2008 Carsten Aulbert

# system & mirror disk



echo "Starting mirror process" > $LOGFILE
# show current layout
echo -e "p\np\nq\nq\n" | format -d $SYSTEMDISK | tee -a $LOGFILE
echo -e "p\np\nq\nq\n" | format -d $MIRRORDISK | tee -a $LOGFILE

# add seventh partition (no magic performed)
echo -e "p\n7\n\n\n$CYLSTART\n32130b\np\nlabel\ny\nq\nq\n" | format -d $SYSTEMDISK | tee -a $LOGFILE
echo -e "p\n7\n\n\n$CYLSTART\n32130b\np\nlabel\ny\nq\nq\n" | format -d $MIRRORDISK | tee -a $LOGFILE

# more output
prtvtoc /dev/dsk/${SYSTEMDISK}s2 | tee -a $LOGFILE
prtvtoc /dev/dsk/${SYSTEMDISK}s2 | fmthard -i -s - /dev/rdsk/${MIRRORDISK}s2 | tee -a $LOGFILE

# do it
prtvtoc /dev/dsk/${SYSTEMDISK}s2 | fmthard -s - /dev/rdsk/${MIRRORDISK}s2 | tee -a $LOGFILE

# init metadb
metadb -a -f ${SYSTEMDISK}s7 ${MIRRORDISK}s7
metadb | tee -a $LOGFILE

# work on swap
swap -l | tee -a $LOGFILE
swap -d /dev/dsk/${SYSTEMDISK}${SWAPSLICE} | tee -a $LOGFILE
swap -l | tee -a $LOGFILE

metainit d20 1 1 ${SYSTEMDISK}${SWAPSLICE} | tee -a $LOGFILE
metainit d21 1 1 ${MIRRORDISK}${SWAPSLICE} | tee -a $LOGFILE
metastat                                   | tee -a $LOGFILE
metainit d2 -m d20 d21                     | tee -a $LOGFILE
metastat                                   | tee -a $LOGFILE

swap -a /dev/md/dsk/d2 | tee -a $LOGFILE
swap -l | tee -a $LOGFILE

# now /
metainit -f d10 1 1 ${SYSTEMDISK}${ROOTSLICE} | tee -a $LOGFILE
metainit -f d11 1 1 ${MIRRORDISK}${ROOTSLICE} | tee -a $LOGFILE
metainit d1 -m d10 | tee -a $LOGFILE
metaroot d1 | tee -a $LOGFILE
cat /etc/vfstab | tee -a $LOGFILE

# and /var
metainit -f d30 1 1 ${SYSTEMDISK}${VARSLICE} | tee -a $LOGFILE
metainit -f d31 1 1 ${MIRRORDISK}${VARSLICE} | tee -a $LOGFILE
metainit d3 -m d30 | tee -a $LOGFILE
metattach d3 d31 | tee -a $LOGFILE

# user's TODO
cat <<EOF
Please change the following:
(1) In /etc/vfstab, swap should now refer to /dev/md/dsk/d2
(2) Also in /etc/vfstab, alter the /var line to use /dev/md/dsk/d3
    (this should mimick the / line)
Then reboot and run 
metattach d1 d11
to add the other system mirror. Watch progress with


-- CarstenAulbert - 18 Jun 2008

This topic: ATLAS > WebHome > X4500 > X4500-system_disk_mirror
Topic revision: 18 Jun 2008, CarstenAulbert
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback