Web template
updated by
Christopher Spry
2 May 2014

Guide to cloning a SUN Blade 1000 drive running Solaris 8 on a second drive

1. Introduction
2. Script to backup a drive '0' to to a second identical drive '1' using ufsdump
3. Checking that the cloned disk can boot the computer
4. Mirroring a boot disk to a second disk

1. Introduction

Copying (cloning) one disk to another is discussed at SUN Docs, in the System Administration manual Volume 1. If you use 'dd' on the whole disk, then the boot blocks which are on it will be copied.  You don't need to installboot as a separate step later. If you go the somewhat safer method of repartitioning/ufsdump/ufsrestore, then the boot blocks (which are not a part of the filesystem) must be reinstalled on the new disk.

2. Script to backup a drive '0' to to a second identical drive '1' using ufsdump

There are two scripts to chose from:


# Original Script written by Constantin Ionescu Modified by Carlo Cosolo
# Modified by Peter Baer Galvin Modified by John West Use and distribute
# freely Define variables for use in the script

# ! Important, these must be set correctly !
# The root disk to duplicate (leave off slice numbers and path)

# The empty disk to duplicate it to (leave off slice numbers and path)

#The directory to mount destination partitions on while duplicating

#The file name of this script, to rename it on the destination to avoid
execution SCRIPT=/opt/local/etc/rootcopy

# The slices that should be copied
SLICES="s0 s3 s4 s6 s7"

echo ==================================== echo Disk Copy script started
`date` echo

#Make sure the mount point for duplicate partitions exists if [ ! -d
$MOUNTDIR ]; then mkdir $MOUNTDIR chmod 700 $MOUNTDIR fi

# Partition the duplicate disk, make filesystems, make it bootable
prtvtoc /dev/rdsk/${SRC}s2 > /tmp/vtoc fmthard -s /tmp/vtoc
/dev/rdsk/${DEST}s2 installboot /usr/platform/`uname
-i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0

# Modify the following loop to handle any special cases
for fs in $SLICES do newfs /dev/dsk/${DEST}${fs} < /dev/null mount
/dev/dsk/${DEST}${fs} ${MOUNTDIR}; ufsdump 0f - /dev/dsk/${SRC}${fs}|(cd
${MOUNTDIR} ;ufsrestore rf -); if [ $fs = "s0" ]; then sed
's/${SRC}/${DEST}/g' /etc/vfstab > ${MOUNTDIR}/etc/vfstab; mv

umount ${MOUNTDIR} done

echo echo Disk Copy script ended `date` echo
==================================== echo


# this script must be run in single user mode

# copy table of contents (partition information) from disk0 to disk1
prtvtoc /dev/dsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

# install boot block on disk1 - With other computers alter 'sun4u' accordingly
/usr/sbin/installboot /usr/platform/sun4u/lib/fs/ufs/boot/bootblk /dev/rdsk/c0t1d0s0

# iterate over all slices (except swap & backup) dumping them from disk0
# to disk1
for slice in 0 3 5 6; do

# create new filesystem for current slice
newfs -v ${new_raw}
# make sure filesystem is fine
fsck ${new_raw}
# create a directory for the mount point of the current slice
mkdir ${new_mnt}
# mount current slice
mount ${new_d} ${new_mnt}
# dump filesystem of current slice from disk0 to disk1
ufsdump 0f - ${old_raw} | (cd ${new_mnt}; ufsrestore xf -)
# if slice 0 (system files) then changed vfstab entries from disk0
# to disk1
if [ $slice -eq 0 ]
perl -pi -e 's/c0t0d0/c0t1d0/g' ${new_mnt}/etc/vfstab
# unmount current slice
umount ${new_mnt}
# make sure slice is valid
fsck ${new_raw}
# cleanup directory
rmdir ${new_mnt}

Once this script is run and all has been copied to the other drive, you can boot the other drive via Openboot. No need to swap the drive to T0.

3. Checking that the cloned disk can boot the computer

You can choose which disc to boot from when two discs are installed. It is done from the 'Open Boot Prompt' (OBP) which is kind of equivalent to BIOS on a pc (the code that's in nvram that does power on self tests and loads the OS). See the OBP manuals that are part of the docset (available online at docs.sun.com). You can change open boot variables (such as whether to boot automatically and what disk to boot from) at the OBP or using "eeprom" in solaris (man eeprom for details).
Reboot the system and while the banner is printing before it loads the operating system hold the stop key while pressing 'a' (or if connected via some terminal to the console send a 'break'). Alternately you could use the "eeprom" command above to set "auto-boot?" to false and then reboot. You will have to be connected to the console (serial console or graphics console). Use "probe-scsi-all" to see what all the long paths are to the two disks and then use "devalias" to see/set an alias name (like "disk1" or "diska") to that device, then set "boot-device" to that alias.

4. Mirroring a boot disk to a second disk

'Mirroring' a boot disk to a second disk, is an excellent way to deal rapidly with a failed system disk. It can be combined with a remote backup resource, to provide a good quality backup and recovery process. Disk mirroring is best done with Solstice DiskSuite (SDS) v 4.2.1, which is a part of Solaris 8. In Solaris 9, it is called 'Volume Manager' (login and password: '4u2test').  There is a well written paper at Slacksite, giving details of how to mirror two drives with DiskSuite.

After installing SDS, apply the latest (March 2002) SDS patch (108693-08.zip) from SunSolve. A guide to setting it up is available. See also the 'DiskSuite' information at Sun: 'Solstice DiskSuite 4.2.1 Installation and Product Notes', 'Solstice DiskSuite User's Guide' and 'Solstice DiskSuite Reference'.  Robert Banniza has a script to help with setting it up, that can also be found under Sun's 'BigAdmin Scripts' section.

Veritas' 'Volume Replicator' can also be purchased and used to mirror disks to identical or heterogeneous drives. 'Volume Replicator' is usually used on large disks and arrays, rather than the boot disk.

Disk mirroring

See the Sun Blueprint for mirroring and cloning root disks with Veritas. To see if drives are mirrored run '/usr/sbin/metastat'. To backup a drive install DiskSuite and mirror the drives. Once all synced, unmirror. Mirror a system disk to a second identical one Instead, mirror the disks with Solstice 'Disk Suite', which is included in Solaris 8. Wth the full 'OEM' install, it should be there. Try running 'solstice' from a root prompt. DiskSuite is designed to automatically maintain mirrored drives all the time, so a disk can fail and you will not lose any work. In addition, disk reads will be faster because two disks are feeding the system in tandem.
You can also mirror a disk using DiskSuite, Veritas or a Hardware RAID controller.

Replacing a mirrored disk that has failed.

Be sure to have 2 or more  metadb replicas on both disks (e.g. on c0t0d0s4 c0t0d0s5 c0t1d0s4 c0t1d0s5). Lets say, the second disk fails. Then reboot (you must go to single-user mode, because not more than 50% of your metadb replicas is online) Remove bad metadb replicas by typing:  metadb -df c0t1d0s4 c0t1d0s5. 100% of your replica's is online again, you can reboot again for a normal-functioning system. Replace disk and add metadb replicas again.

> My guess is that I have to boot Solaris from a cd-rom, mount the disk and
> remove the mirror (on the drive that is working of course) and finally boot
> from the original mirror disk.
Good guess. You essentially have to break the mirror by getting the boot disk out of DiskSuite. Detailed help can be found on http://sun.docs.com where you should search using keywords "disksuite mirror failure". Also, here's a nugget of info from the following page http://www.ebsinc.com/solaris/disksuit.html which is entitled "Ten common Solstice Disksuite questions" -
6. How do I remove the boot disk from DiskSuite control?
ok boot cdrom
# fsck /dev/rdsk/c0....
# mount /dev/dsk/c0t3d0s0 /a
Note: this assumes that your boot device is target three on controller zero.
# vi /a/etc/system
comment [*] out entries pertaining to / being a metadevice
# vi /a/etc/vfstab
change metadevice name to physical disk partition for all file systems associated with booting
# mv /a/etc/opt/SUNWmd/etc/mddb.cf /a/etc/opt/SUNWmd/prob.mddb.cf
# umount /a
# fsck /dev/rdsk/c0t3d0s0
# reboot
Make certain that you're booting off c0t3d0s0 (i.e., the side you modified above), and not the other side of the mirror!

Upgrading Solaris with mirrored drives

Solaris CDs will not be able to upgrade mirrored drives running DiskSuite until the mirror has been uninstalled.

Return to the 'home page'

Return to the `Computing index page'

Return to the 'Blade 1000 administration index'