BigAdmin System Administration Portal
Community-Submitted Article
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

Creating a Bootable DVD/CD With ufsdump Backups for Solaris 9 OS

Ross Moffatt, February 2007


Contents

Overview

Now that servers are being ordered and delivered without tape drives -- and instead only having DVD-ROM drives -- this procedure was developed for system recovery.

In this example I am using a system with the following disks and file systems:

/dev/md/dsk/d0         4.8G   129M   4.6G     3%    /
/dev/md/dsk/d3         4.8G   191M   4.6G     4%    /usr
/dev/md/dsk/d4         4.8G   1.1G   3.7G    23%    /var
/dev/md/dsk/d6          37G   3.2G    33G     9%    /opt
/dev/md/dsk/d5         8.2G   3.5G   4.6G    44%    /var/crash

Mirrors are as follows:

Mirror          Mirror A        Device A    Mirror B        Device B
/dev/md/dsk/d0  /dev/md/dsk/d10 c1t0d0s0    /dev/md/dsk/d20 c1t1d0s0
/dev/md/dsk/d3  /dev/md/dsk/d13 c1t0d0s3    /dev/md/dsk/d23 c1t1d0s3
/dev/md/dsk/d4  /dev/md/dsk/d14 c1t0d0s4    /dev/md/dsk/d24 c1t1d0s4
/dev/md/dsk/d6  /dev/md/dsk/d16 c1t0d0s6    /dev/md/dsk/d26 c1t1d0s6
/dev/md/dsk/d5  /dev/md/dsk/d15 c1t0d0s5    /dev/md/dsk/d25 c1t1d0s5

Solaris Volume Manager meta-databases are on slice 7 of each disk, that is, c0t0d0s7 and c1t0d0s7.

The CD/DVD-ROM device is /dev/dsk/c0t0d0s0.


Potential Applications for This Procedure
  • To create a backup CD/DVD, enabling you to restore to a known point
  • To create a system copy CD/DVD, enabling you to make a duplicate installation of a system
  • To create a bare-metal recovery CD/DVD that makes the host bootable, so another backup method can be used
  • To create a backup CD/DVD for use in extremely hostile/secure environments, where file transfers to and from the host are disabled

Requirements

Several items are required to create a custom boot CD-ROM for the Solaris 9 Operating System:

  • The Solaris 9 OS software 1 of 2 and 2 of 2 media (I used the 9/05 edition)
  • A SPARC technology-based server or workstation running Solaris 9 OS
  • A file system with approximately 400 Mbytes plus double the size of the ufsdump archives you want to put on the disk, to which temporary and image files can be written
  • A /var/crash file system, which is usually empty but is set up to capture crash dumps of the server
  • A CD/DVD burner with appropriate software, which needs up to 8 Gbytes of space (if a dual-layer DVD is used) for the DVD ISO file
  • A blank CD-ROM or DVD-ROM

Stop Volume Manager If It Is Running

If volume manager is running, then it may automount the CD-ROM upon insertion. This prevents the CD-ROM from being manually mounted, and prevents the dd commands later from working.

To see if volume manager is running, type this:

# ps -ef | grep vold

To stop volume manager, use this:

# /etc/init.d/volmgt stop

Set Up the build Directory and Copy mkisofs

Create a directory in which to build the ISO image.

# mkdir -p /var/crash/build/s0/ufsdumps
# cd /var/crash/build

Copy mkisofs into this directory if SUNWmkcd isn't loaded. Insert Solaris Software Disk 2 of 2 into the CD drive.

# mount -o ro -F hsfs /dev/dsk/c0t0d0s0 /cdrom
# bzcat /cdrom/Solaris_9/Product/SUNWmkcd/archive/none.bz2 | cpio -C 512 -idum
# umount /cdrom

Create the ISO Build Files

Insert Solaris Software Disk 1 of 2 into the CD drive.

# mount -o ro -F hsfs /dev/dsk/c0t0d0s0 /cdrom
# cd /cdrom
# find . -print | cpio -pudm /var/crash/build/s0

# cd /var/crash/build
# dd if=/dev/dsk/c0t0d0s1 of=./s1
# dd if=/dev/dsk/c0t0d0s2 of=./s2
# dd if=/dev/dsk/c0t0d0s3 of=./s3
# dd if=/dev/dsk/c0t0d0s4 of=./s4
# dd if=/dev/dsk/c0t0d0s5 of=./s5

If space is a problem for a CD, there are a lot of files that can be deleted. (If you are burning to a DVD, you should not require this step.)

# cd /var/crash/build/s0/
# rm .install_config
# cd Solaris_9
# rm -rf ./Docs
# rm -rf ./Misc
# rm -rf ./Patches
# rm -rf ./Product
# cd Tools

Delete everything except the boot symbolic link.

At this point, all CD/DVD build files exist.


Back Up the Host by Creating ufsdump Archives

Empty out all software backups and package files, including zipped and unzipped patch bundles. You can remove the passwords for root so the recovered system is easy to get into anywhere. You can also copy these files temporarily into /var/crash. If you are going to use a dual-layer DVD, you need to make the compressed root, usr, opt, and var ufsdumps under a combined size of about 8 Gbytes.

Option 1: Cold Backup

Insert Solaris Software Disk 1 of 2 into the CD/DVD drive.

If /var/crash is mirrored, split the mirror.

# metadetach d5 d25

Reboot the host, and interrupt the boot.

# init 0

Boot the CD in single-user mode.

# boot cdrom -s

Mount the file system that has /var/crash.

# mount /dev/dsk/c1t0d0s5 /a
# cd /a/build/s0/ufsdumps

Dump the boot disk partitions to ufsdumps.

# ufsdump 0f - /dev/dsk/c1t0d0s0 | compress > ./root_ufs.Z
# ufsdump 0f - /dev/dsk/c1t0d0s3 | compress > ./usr_ufs.Z
# ufsdump 0f - /dev/dsk/c1t0d0s4 | compress > ./var_ufs.Z
# ufsdump 0f - /dev/dsk/c1t0d0s6 | compress > ./opt_ufs.Z

Reboot the host.

# init 6

Log in as root.

Reattach the /var/crash mirror, if it was split.

# metattach d5 d25

Option 2: Hot Backup

# cd /var/crash/build/s0/ufsdumps
# ufsdump 0f - /dev/md/rdsk/d0 | compress > ./root_ufs.Z
# ufsdump 0f - /dev/md/rdsk/d3 | compress > ./usr_ufs.Z
# ufsdump 0f - /dev/md/rdsk/d4 | compress > ./var_ufs.Z
# ufsdump 0f - /dev/md/rdsk/d6 | compress > ./opt_ufs.Z

Create the ISO Image

Type the following:

# cd /var/crash/build/s0/ufsdumps
# echo "Solaris Bootable Backup Disk" > Version.txt
# hostname >> Version.txt
# date >> Version.txt

# cd /var/crash/build
# ./mkisofs -R -d -L -l -sparc-boot s1,s2,s3,s4,s5 -o sol9boot.iso ./s0

Now copy this sol9boot.iso image to another location, and burn it to the CD or DVD as a disk image.


Use the CD/DVD for Recovery

There are several options for using the CD/DVD for recovery.

Option 1: Recovery of One File (Or Just a Few Files) From ufsdumps on the DVD/CD

Find the Solaris Bootable Backup Disk and insert it into the DVD/CD drive.

Restore the required files by changing to the restore directory, mounting the DVD/CD, and restoring the files. I used the ufsrestore command to put ufsrestore into interactive mode. See the ufsrestore man page for more information on selecting files to restore.

Use the following commands, where <restore directory> and <archive> are selected according to which file system is to be restored.

# cd <restore directory>
# mount -o ro -F hsfs /dev/dsk/c0t0d0s0 /cdrom
# zcat /cdrom/ufsdumps/<archive> | ufsrestore if -
<restore directory>	<archive>
/			root_ufs.Z
/var			var_ufs.Z
/usr			usr_ufs.Z
/opt			opt_ufs.Z

Option 2: Full Recovery of the /, /usr, or /var File System

This procedure is only for /, /usr, and /var, as these file systems cannot be unmounted, even when the host is shut down to the single-user state and the required commands are on /usr.

Find and insert the Solaris Bootable Backup Disk with /, /var, and /usr archives.

Detach the mirror(s). Remove the mirror of /, and/or /usr, and/or /var, depending on which one(s) you need to recover.

For /, use the following:

# metadetach d0 d20

For /usr, use the following:

# metadetach d0 d23

For /var, use the following:

# metadetach d4 d24

Boot from the DVD/CD.

Get to the OpenBoot ok prompt.

Shut down the host and interrupt the boot process.

# init 0

boot cdrom -s
INIT: SINGLE USER MODE

Make this environment more friendly.

# stty erase ^H
# TERM=vt100;export TERM

Use these commands if you need to restore the / file system:

# newfs /dev/rdsk/c1t0d0s0
# mount /dev/dsk/c1t0d0s0 /a
# cd /a
# zcat /cdrom/ufsdumps/root_ufs.Z | ufsrestore rf -
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk  /dev/rdsk/c1t0d0s0
# /usr/sbin/drvconfig -r /a/devices -p /a/etc/path_to_inst
# cd /devices
# /usr/bin/find . -print | cpio -pduVm /a/devices
....................................................
0 blocks
# /usr/sbin/disks -r /a
# /usr/sbin/devlinks -r /a
# cd /
# umount /a
# fsck /dev/rdsk/c1t0d0s0

Use these commands if you need to restore the /usr file system:

# newfs /dev/rdsk/c1t0d0s3
# mount /dev/dsk/c1t0d0s3 /a
# cd /a
# zcat /cdrom/ufsdumps/usr_ufs.Z | ufsrestore rf -
# cd ..
# umount /a
# fsck /dev/rdsk/c1t0d0s3

Use these commands if you need to restore the /var file system:

# newfs /dev/rdsk/c1t0d0s4
# mount /dev/dsk/c1t0d0s4 /a
# cd /a
# zcat /cdrom/ufsdumps/var_ufs.Z | ufsrestore rf -
# cd ..
# umount -a
# fsck /dev/rdsk/c1t0d0s4

Reboot the host.

# cd /
# init 6

Reattach the mirror of /, and/or /usr, and/or /var, depending on which one(s) you need to recover.

For /, use the following:

# metattach d0 d20

For /usr, use the following:

# metattach d3 d23

For /var, use the following:

# metattach d4 d24

Use metastat to check that the mirror attached properly.

Option 3: Recovery of a Non-root File System

This procedure is only for non-root (/, /usr, or /var) file systems that are backed up.

It is assumed that the disks are OK, partitions are OK, and mirroring is still set up OK.

Recovery from ufsdump on DVD/CD: Find the ufsdump DVD/CD (this is either the bootable DVD or the CD with the /opt archive), and insert it into the CD drive.

Use the following command to unmount the file system, where <mount point> is selected on the file system that is to be restored.

#  unmount <mount point>
<filesystem>	<mount point>
d6		/opt

You may need to reboot the host to single-user mode to unmount a file system.

# init s

The system will come up with the non-root file systems unmounted.

Use the following command to format the file system, where <filesystem> is selected on the file system that is to be restored.

# newfs /dev/md/rdsk/<filesystem>
<filesystem>	<mount point>
d6		/opt

Restore the file system. To do this, use the following commands to change to the restore directory and restore the backup, where <restore dir> and <archive> are selected on the file system that is to be restored.

# cd <restore dir>
# mount -o ro -F hsfs /dev/dsk/c0t0d0s0 /cdrom
# zcat /cdrom/ufsdumps/<archive> | ufsrestore rf -
<restore dir>	<archive>
/opt		opt_ufs.Z

Check the restored file system using the following commands, where <mount point> and <filesystem> are selected on the file system that is to be restored.

# cd /
# unmount <mount point>
# fsck /dev/md/rdsk/<filesystem>
<filesystem>	<mount point>
d6		/opt

Reboot the host and check that all is OK.

# init 6

Option 4: Recovery of Boot Disks

Follow this procedure if both boot disks fail. This procedure covers replacing the failed boot disks with disks of the same size. This example doesn't cover replacing the failed disks with larger disks, using a number of smaller disks, or redesigning the system to use a different number of disk slices.

This section refers to a Solaris OS managed mirror on the internal hot swap disks c1t0d0 and c1t1d0.

Find and insert the Solaris Bootable Backup Disk with /, /var and /usr archives.

Boot from the DVD/CD.

Get to the OpenBoot ok prompt.

# init 0

{3} ok boot cdrom -s
Resetting ...

<edited>
INIT: SINGLE USER MODE

Make this environment more friendly:

# stty erase ^H
# TERM=vt100;export TERM

If the disks have failed physically, replace them.

Partition the boot disk:

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@1c,600000/scsi@2/sd@0,0

Specify disk (enter its number): 0
selecting c1t0d0

Use the format utility to set up the partition table as it previously was on your system.

Create the boot disk file systems:

# newfs /dev/rdsk/c1t0d0s0
# newfs /dev/rdsk/c1t0d0s3
# newfs /dev/rdsk/c1t0d0s4
# newfs /dev/rdsk/c1t0d0s5
# newfs /dev/rdsk/c1t0d0s6

Restore boot disk file systems from ufsdumps on the DVD/CD:

# mount /dev/dsk/c1t0d0s0 /a
# cd /a
# zcat /cdrom/ufsdumps/root_ufs.Z | ufsrestore rf -

# mount /dev/dsk/c1t0d0s3 /a/usr
# cd /a/usr
# zcat /cdrom/ufsdumps/usr_ufs.Z | ufsrestore rf -

# mount /dev/dsk/c1t0d0s4 /a/var
# cd /a/var
# zcat /cdrom/ufsdumps/var_ufs.Z | ufsrestore rf -

# mount /dev/dsk/c1t0d0s5 /a/var/crash
# cd /a/var/crash
# mkdir <hostname>

If necessary, change the host identity as follows.

Hostname:

Change file entry to the new hostname.

# vi /a/etc/inet/hosts

Change file entry to the new hostname.

# vi /a/etc/nodename

Change file entry to the new hostname, where <interface> is the name of the primary interface for this system, that is, hostname.bge0.

# vi /a/etc/hostname.<interface>

Change both columns to the new hostname.

# vi /a/etc/net/ticlts/hosts

Change both columns to the new hostname.

# vi /a/etc/net/ticots/hosts

Change both columns to the new hostname.

# vi /a/etc/net/ticotsord/hosts

IP address:

Change the IP address.

# vi /a/etc/inet/hosts

Add new netmask.

# vi /a/etc/inet/netmasks

Specify the new gateway for this subnet.

# vi /a/etc/defaultrouter

DNS resolver:

Change the DNS resolvers and the DNS domain.

# vi /a/etc/resolv.conf

Time server:

Change the time servers.

# vi /a/etc/inet/ntp.conf

Change the passwords for root, if required or if you don't know what they are.

Change the password field to FbzXO4ipjrbAU. This will set the password to sun123.

# vi /a/etc/shadow

Install boot block:

# cd /a/etc
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk  /dev/rdsk/c1t0d0s0
# /usr/sbin/drvconfig -r /a/devices -p /a/etc/path_to_inst
# cd /devices
# /usr/bin/find . -print | cpio -pduVm /a/devices
....................................................
0 blocks

# /usr/sbin/disks -r /a
# /usr/sbin/devlinks -r /a

Edit vfstab and system:

# vi vfstab

Change this:

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/md/dsk/d1       -       -       swap    -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      -
/dev/md/dsk/d3       /dev/md/rdsk/d3      /usr    ufs     1       no      -
/dev/md/dsk/d4       /dev/md/rdsk/d4      /var    ufs     1       no      -
/dev/md/dsk/d6       /dev/md/rdsk/d6      /opt    ufs     2       yes     nosuid
/dev/md/dsk/d5       /dev/md/rdsk/d5      /var/crash      ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

To this:

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0  /dev/rdsk/c1t0d0s0 /       ufs     1       no      -
/dev/dsk/c1t0d0s3  /dev/rdsk/c1t0d0s3      /usr    ufs     1       no      -
/dev/dsk/c1t0d0s4  /dev/rdsk/c1t0d0s4      /var    ufs     1       no      -
/dev/dsk/c1t0d0s6  /dev/rdsk/c1t0d0s6      /opt    ufs     2       yes     nosuid
/dev/dsk/c1t0d0s5  /dev/rdsk/c1t0d0s5      /var/crash      ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

Save the file:

# vi system

Delete the following line completely (do not just comment it out):

rootdev:/pseudo/md@0:0,0,blk
# cd /
# init 6

Log on as root.

Set up partitions on the mirror disk:

# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

Mirror the boot disks with Solstice DiskSuite.

Create the state database replicas:

# metadb -a -f -c 3 /dev/dsk/c1t0d0s7
# metadb -a -c 3 /dev/dsk/c1t1d0s7

Check that the database replicas have been created:

# metadb -i

Create the submirrors for the / (root) file system:

# metainit -f d10 1 1 c1t0d0s0
d10: Concat/Stripe is setup
# metainit -f d20 1 1 c1t1d0s0
d20: Concat/Stripe is setup
# metainit d0 -m d10
d0: Mirror is setup

Update the root to be the mirror. Reboot immediately after the metaroot command to prevent the file systems from being corrupted.

# metaroot d0
# init 6

console login: root

# metainit -f d11 1 1 c1t0d0s1
d11: Concat/Stripe is setup
# metainit -f d21 1 1 c1t1d0s1
d21: Concat/Stripe is setup
# metainit d1 -m d11
d1: Mirror is setup

# metainit -f d13 1 1 c1t0d0s3
d13: Concat/Stripe is setup
# metainit -f d23 1 1 c1t1d0s3
d23: Concat/Stripe is setup
# metainit d3 -m d13
d3: Mirror is setup

# metainit -f d14 1 1 c1t0d0s4
d14: Concat/Stripe is setup
# metainit -f d24 1 1 c1t1d0s4
d24: Concat/Stripe is setup
# metainit d4 -m d14
d4: Mirror is setup

# metainit -f d15 1 1 c1t0d0s5
d15: Concat/Stripe is setup
# metainit -f d25 1 1 c1t1d0s5
d25: Concat/Stripe is setup
# metainit d5 -m d15
d5: Mirror is setup

# metainit -f d16 1 1 c1t0d0s6
d16: Concat/Stripe is setup
# metainit -f d26 1 1 c1t1d0s6
d26: Concat/Stripe is setup
# metainit d6 -m d16
d6: Mirror is setup

Update /etc/vfstab:

# vi /etc/vfstab

Change this:

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      -
/dev/dsk/c1t0d0s3       /dev/rdsk/c1t0d0s3      /usr    ufs     1       no      -
/dev/dsk/c1t0d0s4       /dev/rdsk/c1t0d0s4      /var    ufs     1       no      -
/dev/dsk/c1t0d0s6       /dev/rdsk/c1t0d0s6      /opt    ufs     2       yes     nosuid
/dev/dsk/c1t0d0s5       /dev/rdsk/c1t0d0s5      /var/crash      ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

To this:

#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/md/dsk/d1       -       -       swap    -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      -
/dev/md/dsk/d3       /dev/md/rdsk/d3      /usr    ufs     1       no      -
/dev/md/dsk/d4       /dev/md/rdsk/d4      /var    ufs     1       no      -
/dev/md/dsk/d6       /dev/md/rdsk/d6      /opt    ufs     2       yes     nosuid
/dev/md/dsk/d5       /dev/md/rdsk/d5      /var/crash      ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

Save the file:

init 6

Attach the mirrors:

# metattach d0 d20
d0: submirror d20 is attached
# metattach d1 d21
d1: submirror d21 is attached
# metattach d3 d23
d3: submirror d23 is attached
# metattach d4 d24
d4: submirror d24 is attached
# metattach d5 d25
d5: submirror d25 is attached
# metattach d6 d26
d6: submirror d26 is attached

Use metastat to check status of mirrors:

# metastat

Restore the /opt file system. Put the DVD/CD in the drive containing the usr ufsdump.

# cd /opt
# mount -o ro -F hsfs /dev/dsk/c0t0d0s0 /cdrom
# zcat /cdrom/ufsdumps/opt_ufs.Z | ufsrestore rf -

Reboot the host:

# init 6

About the Author

Ross Moffatt has been a UNIX System Administrator for more than 10 years, and can be contacted at ross.stuff@telstra.com.


Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin
  
 
Solaris Vintage Patches