Creating a Bootable DVD/CD With ufsdump Backups for Solaris 9 OSRoss Moffatt, February 2007 Contents
OverviewNow 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, The CD/DVD-ROM device is Potential Applications for This Procedure
RequirementsSeveral items are required to create a custom boot CD-ROM for the Solaris 9 Operating System:
Stop Volume Manager If It Is RunningIf 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 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 mkisofsCreate a directory in which to build the ISO image. # mkdir -p /var/crash/build/s0/ufsdumps # cd /var/crash/build Copy # 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 FilesInsert 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 At this point, all CD/DVD build files exist. Back Up the Host by Creating ufsdump ArchivesEmpty out all software backups and package files, including zipped and unzipped patch bundles.
You can remove the passwords for Option 1: Cold Backup Insert Solaris Software Disk 1 of 2 into the CD/DVD drive. If # 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 # mount /dev/dsk/c1t0d0s5 /a # cd /a/build/s0/ufsdumps Dump the boot disk partitions to # 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 Reattach the # 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 ImageType 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 Use the CD/DVD for RecoveryThere 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 Use the following commands, where # 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 Find and insert the Solaris Bootable Backup Disk with Detach the mirror(s). Remove the mirror of For # metadetach d0 d20 For # metadetach d0 d23 For # metadetach d4 d24 Boot from the DVD/CD. Get to the OpenBoot 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 # 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 # 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 # 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 For # metattach d0 d20 For # metattach d3 d23 For # metattach d4 d24 Use Option 3: Recovery of a Non-root File System This procedure is only for non-root ( It is assumed that the disks are OK, partitions are OK, and mirroring is still set up OK. Recovery from Use the following command to unmount the file system, where
# 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
# 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 # 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 # 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 Find and insert the Solaris Bootable Backup Disk with
Boot from the DVD/CD. Get to the OpenBoot
# 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 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 # 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 # 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 # vi /a/etc/shadow Install # 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 # 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 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 # 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 # 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 # 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 Restore the # 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 AuthorRoss 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. |
| |||