Subject: Re: Isn't "db>" on boot bad? :P
To: None <port-sparc64@netbsd.org>
From: leam <leam@reuel.net>
List: port-sparc64
Date: 02/11/2003 17:13:25
Andrey Petrov wrote:
> On Mon, Feb 10, 2003 at 09:10:14PM -0500, leam wrote:
>
> Looks like init got corrupted.
>
> What machine is that? if you have ultrasparc2 (not 2e or 2i) processor
> then it's quite possible to be iommu bug which was fixed in -current and
> the bug actually manifested on dump|restore operation. You can try
> pax instead of dump. And you can try to boot into single-user and
> compare init with original.
>
> Andrey
It is a U1, though I'm starting to whine to my wife about the joys of a
dual cpu box. The machine boot off the primary disk, sd0. I'm trying to
make both disks seperate but the same. Except for fstabs, of course.
The reason for the "dump/restore" vice the other options is that I'm
trying to port a script from Solaris to NetBSD. The original script does
an fsck of the to-be-dumped-to partition, mounts it on /mnt, dumps the
twin partition from the live disk, and then umounts it.
This works in Solaris, and I'm hoping to be able to make it work in
NetBSD. I'll go try the single-user mode thing now.
FYI, here's the original script. No laughing, please.
------
#!/bin/sh
## Note that this assumes the filessystems are already created
# and prepared for this work. If not, use format and newfs to do so.
# At some point in times I'll work one this one too.
PATH=/usr/sbin:/usr/bin:/sbin:/bin
## Set the Variables
# Count the input variables
if [ "$#" -ne 2 ]
then
echo "Need \$1 (PRIMARY_DISK) and \$2 (ALTERNATE_DISK)"
echo "$0 c0t1d0 c0t3d0"
exit 1
fi
# Set the primary disk.
PRIDISK=$1
ALTDISK=$2
ls /dev/dsk > /tmp/disk.list.$$
## Make sure the disk to be mirrored to is good.
for i in $PRIDISK $ALTDISK
do
if ( grep "$i" "/tmp/disk.list.$$" >> /dev/null 2>&1 )
then
echo "$i is good." >> /opt/tmp/disk_bu.log
else
echo "$i invalid."
exit 1
fi
done
# Make sure we're not copying onto a mounted disk.
sanityCheck() {
if ( df -k | grep ${ALTDISK}s${SLICE} >> /opt/tmp/disk_bu.log 2>&1 )
then
echo "Are you sure about ${ALTDISK}s${SLICE}? It's mounted."
exit 1
fi
}
# Need to make sure the /etc/vfstab is fixed
editVfstab() {
if [ -f /mnt/etc/vfstab ]
then
echo "/mnt/etc/vfstab exists." >> /opt/tmp/disk_bu.log.$$ 2>&1
sed s/$PRIDISK/$ALTDISK/g /etc/vfstab > /opt/tmp/new.vfstab
cp /opt/tmp/new.vfstab /mnt/etc/vfstab
fi
}
# fsck the slices before they're written to.
fsckSlice() {
count=0
while [ $count -lt 2 ]
do
fsck -F ufs -y $1 >> /opt/tmp/fsck.log.$$ 2>&1
count=`expr $count + 1`
done
}
installBoot() {
if [ -x /usr/sbin/installboot -a -f /usr/platform/`uname
-m`/lib/fs/ufs/bootblk ]
then
echo "Installing the boot block." >> /opt/tmp/disk_bu.log 2>&1
/usr/sbin/installboot /usr/platform/`uname -m`/lib/fs/ufs/bootblk
/dev/rdsk/${ALTDISK}s0
fi
}
### Main
installBoot
# The slice loop.
#hide() {
for i in `grep "^/dev/dsk" /etc/vfstab | awk '{ print $1 }'`
do
PRISLICE=`basename $i`
SLICE=`echo $PRISLICE | sed 's/c.*s//'`
#echo "\$PRISLICE is $PRISLICE, and \$SLICE is $SLICE"
echo "I will now fsckSlice /dev/rdsk/${ALTDISK}s${SLICE}" >>
/opt/tmp/disk_bu.log
2>&1
if ( df -k | grep /dev/dsk/${ALTDISK}s${SLICE} >> /dev/null 2>&1 )
then
echo "Whoa there! /dev/dsk/${ALTDISK}s${SLICE} is mounted!"
df -k | grep /dev/dsk/${ALTDISK}s${SLICE}
exit 1
fi
fsckSlice /dev/rdsk/${ALTDISK}s${SLICE}
## Do the ufsdump work
sanityCheck
if ( mount /dev/dsk/${ALTDISK}s${SLICE} /mnt >>
/opt/tmp/disk_bu.log 2>&1 )
then
ufsdump 0uf - /dev/rdsk/${PRIDISK}s${SLICE} | ( cd /mnt;
ufsrestore rvf - )
editVfstab
umount /mnt
fi
done
### Clean up
sync; sync; sync
rm /tmp/disk.list.$$
#rm /opt/tmp/fsck.log.$$