mpxio-upgrade revision 789c9c8f354bb5b57979032ba9e62dafc2e0b20f
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# CDDL HEADER START
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# The contents of this file are subject to the terms of the
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley# Common Development and Distribution License (the "License").
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# You may not use this file except in compliance with the License.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# See the License for the specific language governing permissions
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# and limitations under the License.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# When distributing Covered Code, include this CDDL HEADER in each
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# If applicable, add the following below this CDDL HEADER, with the
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# fields enclosed by brackets "[]" replaced with your own identifying
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# information: Portions Copyright [yyyy] [name of copyright owner]
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# CDDL HEADER END
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# Use is subject to license terms.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# Make sure that the essential libraries can be found.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # display recovery instructions - the first call logs to the service
78fda31f2608ca863b1381798e680dd1cab2f209Bob Halley # log and the second call displays on the console.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley cecho "These instructions were also logged to the file $RECOVERFILE\n"
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# root ("/") is already mounted read only by the kernel.
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley# Remount the root read-write.
e4c76dcbd1259d52345106778c5ad4d416f8a84dBob Halley # In single-user maintenance mode, we don't have a writable
e4c76dcbd1259d52345106778c5ad4d416f8a84dBob Halley # root partition, so we _cannot_ use devlinks. Therefore we
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # have to do some dancing - first mount the physical path
4756105b9c20cc9de3ac686a413a0e4d0c1bb372Michael Graff # read-write, then re-run $STMSBOOTUTIL to get the real
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # devlink mapping, and then re-mount the root slice. Of course,
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # if we all used ZFS this wouldn't be such a pain!
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # ZFS root environments should _not_ have an entry for /
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # sanity check for ZFSRoot _and_ / in /etc/vfstab
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley cecho "stmsboot: System has ZFS Root *and* an entry for / in /etc/vfstab\nstmsboot: Please remove the / entry from /etc/vfstab and then run\n# svcadm clear mpxio-upgrade"
4756105b9c20cc9de3ac686a413a0e4d0c1bb372Michael Graff ISPHYS=`echo $special |$AWK '/^\/dev\/dsk/ {print}'`;
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley $MOUNT -o remount,rw $new_special / >/dev/msglog 2>&1
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews [ -n "$otherops" ] && mntopts="${mntopts},${otherops}"
19de822a35b5d9594b1521b55f1c93b9b86964a5Bob Halley RVAL=`$MOUNT -m -F $fstype -o $mntopts $new_special \
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # if we've got active-active paths to our rootvp and
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews # the first path returned by $STMSBOOTUTIL is not the
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # same as the one we booted from, then we need some
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews # handwaving due to restrictions in the ufs module
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley if [ $? -eq 0 ]; then
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews if [ $? -eq 0 ]; then
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews cecho "Error: Unable to remount your root device"
19de822a35b5d9594b1521b55f1c93b9b86964a5Bob Halley cecho "stmsboot: Error: your root slice is invalid"
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews# mount /usr read only
f9658c3c37f21cb6dd46b0e21ebb31443f8daf4bMark Andrews $MOUNT -m -F $cfsbacktype -o ro $new_special $mountp \
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # Must use -o largefiles here to ensure the read-only
b5cad0c59eaf9d813df6bed81f86a0525d802253Bob Halley # mount does not fail as a result of having a large
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # In case of a manual restart of the service, mount
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley $MOUNT -m -F $fstype -o $mntopts $new_special /usr \
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley if [ $ret_val -eq 0 ]; then
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# update system dump configuration
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # Disable device-in-use checking (done in libdiskmgt).
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # Without disabling this check, the configuration of dump device
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley # would fail as the device-in-use code incorrectly concludes that
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # the device is in use and hence prevents configuration of the dump
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley DUMPISZFS=`$AWK -F"=" '/DUMPADM_DEVICE/ {print $2}' /etc/dumpadm.conf|$EGREP zvol`
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley set -- `$DUMPADM -u 2>&1 | $EGREP 'cannot use /dev.* as dump device'`
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley if [ $? -eq 0 ]; then
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley if $DUMPADM -d $newname > /dev/msglog 2> /dev/console; then
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley has been updated."
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley the dump device.\nold \
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley dump device name: $4"
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley # make sure we can get to it, force zfs to load fully
7cc0f69d173a2b67d0fbf03a8ef8926b74739b97Bob Halley cecho "stmsboot: dump on ZFS, no dumpadm update required"
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# Update bootpath for x86 here when we are enabling mpxio on root
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley if [ $? != 0 ]; then
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley cecho "stmsboot: ERROR! Unable to retrieve bootpath property\n"
if [ ! -s $DEVFSADM ]; then
if mpxio_mount_root; then
$STMSBOOTUTIL -u >/dev/msglog 2>&1
if [ $? -eq 0 ]; then
exec < $SAVEDIR/vfstab.new; readvfstab /
if update_dumpconf; then
[ -x $METADEVADM ]; then
$METADEVADM -r >/dev/msglog 2>&1
if [ $usrmounted -eq 1 ]; then