Using dump and restore

While it is possible to use the standard dump and restore utilities as a bare-metal recovery mechanism, this method is significantly more difficult than the make_recovery method. However, it does allow for the use of remote backup devices, making it slightly easier to automate than make_recovery. It does require that you prepare some additional information before disaster strikes, though. At a minimum, the filesystem table should be recorded; a hardcopy of the /etc/fstab file works well in this regard. If logical volumes (LVs) are used, the volume group and LV information should be recorded as well, using the pvdisplay, vgdisplay, and lvdisplay commands, in addition to a listing of the contents of the volume group device directory, as shown next. This information should be updated with each level-0 dump and stored with the archive tapes. This procedure is the most labor intensive of those covered in this chapter and should be used only if no other option is available. For detailed instructions on the use of the dump and restore commands, refer to Chapter 3.

The interesting information displayed by pvdisplay is the VG Name which is used for the volume group and should be kept consistent in all following commands that reference the volume group, though the /dev prefix is not required unless explicitly specified.

# pvdisplay /dev/dsk/c0t6d0
--- Physical volumes ---
PV Name                     /dev/dsk/c0t3d0
VG Name                     /dev/vg00
PV Status                   available
Allocatable                 yes
VGDA                        2
Cur LV                      8
PE Size (Mbytes)            4
Total PE                    511
Free PE                     0
Allocated PE                511
Stale PE                    0
IO Timeout (Seconds)        default

The useful information provided by vgdisplay is the PE Size (MB), which will be used when re-creating the volume group. The default value is 4. The Max LV field, which specifies the maximum number of logical volumes that may be created in this volume group should be noted as well. The default is 255.

# vgdisplay vg00
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      8
Open LV                     8
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               2000
VGDA                        2
PE Size (Mbytes)            4
Total PE                    511
Alloc PE                    511
Free PE                     0
Total PVG                   0

The notable fields returned by lvdisplay are LV Size (MB), Mirror copies, Stripes, Stripe Size (KB), Bad block, and Allocation.

# lvdisplay /dev/vg00/lvol1
--- Logical volumes ---
LV Name                     /dev/vg00/lvol1
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            48
Current LE                  12
Allocated PE                12
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   off
Allocation                  strict/contiguous

And finally, the contents of the volume group directory (the full VG Name path shown by pvdisplay) should be captured. The major and minor device numbers (64 and 0x000000 in the following example) should be recorded and used when re-creating the group device node (described later).

# ls -l /dev/vg00
total 0
crw-r-----   1 root       sys         64 0x000000 Dec 16 14:38 group

A CD-ROM drive, a tape drive, the original operating system installation CD-ROM, and the backup media (in addition to the system itself) are required to proceed with this procedure. If the system does not have either an internal CD-ROM drive or an internal tape drive, an external one should be connected and powered on before starting the restore procedure.

Preparing the System for Recovery

Insert the installation CD-ROM in the drive and power the system on. Press the Escape key or spacebar to halt the boot sequence and bring up the “Boot Administration” menu. Use the command boot scsi. x .0 to boot the machine from the CD, substituting the SCSI target ID of the CD-ROM drive for x. To determine the SCSI ID of the CD-ROM drive on a series 700 machine, type search scsi to locate a list of available SCSI devices. To list the available devices on a series 800 machine, type iomap. The system will begin loading from CD after the boot command is issued.

Command                               Description
-------                               -----------
Auto [boot|search] [on|off]           Display or set auto flag
Boot [pri|alt|scsi.addr] [isl]        Boot from primary, alternate or SCSI
Boot lan[.lan_addr] [install] [isl]   Boot from LAN
Chassis [on|off]                      Enable chassis codes
Diagnostic [on|off]                   Enable/disable diagnostic boot mode
Fastboot [on|off]                     Display or set fast boot flag
Help                                  Display the command menu
Information                           Display system information
LanAddress                            Display LAN station addresses
Monitor [type]                        Select monitor type
Path [pri|alt] [lan.id|SCSI.addr]     Change boot path
Pim [hpmc|toc|lpmc]                   Display PIM info
Search [ipl] [scsi|lan [install]]     Display potential boot devices
Secure [on|off]                       Display or set security code
---------------------------------------------------------------------
BOOT_ADMIN> search scsi

Searching for potential boot device.
This may take several minutes.

To discontinue, press ESCAPE.

Device Path        Device Type
-----------        -----------
scsi.6.0           SEAGATE ST32550N
scsi.2.0           TOSHIBA CD-ROM XM-5401TA

Once the system has loaded, select a language at the prompt. Select a language from the list by entering the associated number. When the main installation menu appears, select “Run a Recovery Shell.” Do not start up networking when prompted.

To create logical volumes, the logical volume manager (LVM) commands must be loaded from CD with the loadfile command:

# loadfile pvcreate vgcreate lvcreate lvlnboot

Create the volume group device nodes. The commands in this example assume that the volume group name is vg00, the major device number is 64, and the minor device number is 0x000000. This information comes from the listing of the volume group directory shown earlier in this chapter.

# mkdir /dev/vg00
# mknod /dev/vg00/group c 64 0x000000

The physical volume must be initialized and defined for the volume manager using pvcreate. The volume group must be created using vgcreate . The commands in this example assume that the system disk is set to SCSI ID 6. Change the t6 value to match the actual target ID of the system disk. The -f option to pvcreate tells it to force the creation of a physical volume, while -B specifies that a bootable volume (i.e., a system disk) should be created using the named device. The first argument shown for vgcreate is the volume group name. This should match the volume group name used on the original system, which was captured with the vgdisplay command shown earlier in this chapter. The second argument is the device to be included in the volume group.

If the PE Size shown by vgdisplay is any value other than 4, the -s option should be used with vgcreate to specify an alternate physical extent size (i.e., -s 8 would indicate a PE Size of 8 MB). If the Max LV value shown by vgdisplay is any value other than 255, the -l option should be used with vgcreate to specify the maximum number of logical volumes (i.e., -l 255 ).

# pvcreate -f -B /dev/rdsk/c0t6d0
# vgcreate vg00 /dev/dsk/c0t6d0

The logical volumes must be defined with lvcreate. The original partition table should be used as a guide to the LV sizes, though keeping the sizes the same is not strictly required. The -L option refers to the LV size in megabytes, noted using lvdisplay. The -n option refers to the volume name, which must match the name used on the original system. The -C option is used to specify a contiguous allocation policy and takes y or n as a value, indicating yes or no. Contiguous allocation, which tells the volume manager to keep all blocks for a given LV together on the surface of the disk, is required for the root and swap partitions; it is shown in the Allocation field of lvdisplay as contiguous. The -r option sets the bad block relocation policy, which must be set to n (no bad block relocation) for the root partition. Bad block relocation is shown by lvdisplay using the Bad Block field and is set to either on or off. The final argument is the name of the volume group that was just created, in this case vg00. If a non-0 number of Mirror Copies was shown by lvdisplay, the -m option should be used to indicate mirroring for the logical volume. Note that mirroring with a strict allocation policy cannot be configured with a single hard disk. The value is the number of mirror copies, which may be 0, 1, or 2; is the default value. Similarly, the Stripes and Stripe Size (KB) fields can be carried over from lvdisplay and specified using the -i and -I options respectively.

# lvcreate -L 64 -n lvol1 -C y -r n vg00    
                  ( / )
# lvcreate -L 128 -n lvol2 -C y vg00        
                  ( swap )
# lvcreate -L 288 -n lvol3 vg00             
                  ( /opt )
# lvcreate -L 512 -n lvol4 vg00             
                  ( /usr 
                  )

The lvlnboot command must be used to identify the boot, root, swap, and dump partitions to the system. Invoke the lvlnboot command with each of the -b, -r, -s, and -d options, respectively, followed by the name of the applicable logical volume. In the following example, we set the root partition with the boot and root flags and the swap partition with the swap and dump flags. This is appropriate for most configurations.

# lvlnboot -b /dev/vg00/lvol1        
                   ( / )
# lvlnboot -r /dev/vg00/lvol1        
                   ( / )
# lvlnboot -s /dev/vg00/lvol2        
                   ( swap )
# lvlnboot -d /dev/vg00/lvol2         
                  ( swap )

Before proceeding, the LVM commands must be removed from the RAM disk to make room for the filesystem creation commands.

# rm /sbin/pvcreate /sbin/vgcreate /sbin/lvcreate /sbin/lvlnboot
# loadfile fs_wrapper /sbin/newfs /sbin/mkfs /sbin/fs/hfs/newfs 
                   /sbin/fs/hfs/mkfs /sbin/mount /sbin/fs/hfs/mount /sbin/lib/mfsconfig.d

Any logical volumes that will be mounted as filesystems must be initialized. Use the newfs command to create filesystems on all of the volumes except for swap, which is accessed randomly by the system and need not be formatted. The -F option is used to indicate the type of filesystem to be created. In this case, an hfs filesystem will be created, though vxfs also may be specified. The -L option indicates that the filesystem should support long filenames. The final argument to newfs is the raw device, in this case, a logical volume, to be formatted.

# newfs -F hfs -L /dev/vg00/rlvol1
# newfs -F hfs -L /dev/vg00/rlvol3
# newfs -F hfs -L /dev/vg00/rlvol4

Create mount points for any filesystems that will be restored from tape. The mkdir command should be used to do this; note that the -p option is not available on the command loaded into the RAM disk.

# mkdir /a
# mkdir /a/root
# mkdir /a/opt
# mkdir /a/usr

Mount the logical volumes using the block devices on the newly created mount points using the mount command.

# mount /dev/vg00/lvol1 /a/root
# mount /dev/vg00/lvol3 /a/opt
# mount /dev/vg00/lvol4 /a/usr

The commands used to create filesystems must now be removed to make room for the commands used to restore data from the dump tape. The rm command available on the RAM disk supports -r for removing only directories, not files. The -f option will mask any problems if it is used here, so avoid it.

# rm /sbin/fs_wrapper /sbin/newfs /sbin/mkfs /sbin/fs/hfs/newfs 
                    /sbin/fs/hfs/mkfs /sbin/mount /sbin/fs/hfs/mount
# rm -r /sbin/lib/mfsconfig.d

Recovering the System

Load the remaining commands from CD:

# loadfile restore mkboot /usr/lib/uxbootlf

Now the actual filesystem data may be restored, one filesystem at a time. When restore is run, it will complain that the lost+found directory already exists. This directory is created by newfs ; the error may be ignored. Data should be restored into the proper directory by using cd to change into the correct logical volume prior to performing the restore for each filesystem.

In the restore commands shown next, the actual tape device number may differ depending upon the SCSI ID of the tape drive (though is not the SCSI ID in this case). To display the nodes created for all tape devices detected by the system at boot time, use ls /dev/rmt* . The following commands assume that the /opt, and /usr partitions were backed up in order and will be restored in the same order.

The r option tells restore to select all files and place them into the current directory. The f option is used to specify the tape device; the letter n at the end of the name tells the tape drive to use nonrewinding mode. For further information about the use of the restore command, refer to Chapter 3.

# cd /a/root
# restore rf /dev/rmt/0mn
# cd /a/opt
# restore rf /dev/rmt/0mn
# cd /a/usr
# restore rf /dev/rmt/0m

The boot block must be installed at the beginning of the system drive. The SCSI target ID used here is the same as the one that was used to create the volume group with the vgcreate command earlier.

# mkboot -l /dev/dsk/c0t6d0

Finally, flush the I/O buffers using sync to ensure that all changes to the filesystems are committed. The system may then be rebooted.

# sync; sync
# reboot

Postinstallation recovery tasks

If the system configuration needs to be modified prior to a full multiuser network boot, it is possible to bring it up in single-user mode to make necessary changes at this time. Press the Escape key or spacebar to halt the boot sequence and boot into Initial System Load (ISL) mode. Type boot scsi.x.0 isl at the “Boot Administration” menu prompt. The system drive SCSI ID should be substituted for x. Then tell the system to boot into single-user mode from the primary disk using hpux -iS disk(;0)/stand/vmunix. This command tells the system to load the kernel, located on the default disk device at /stand/vmunix, to boot to init level S (single-user mode) from the primary system disk.

BOOT_ADMIN> boot scsi.6.0 isl

Booting
ISL Revision A.00.30 OCT 26, 1994
ISL> hpux -iS disk(;0)/stand/vmunix

Boot
: disk(2/0/1.6.0.0.0.0.0;0)/stand/vmunix

The /usr partition should be mounted using mount /usr to enable access to the vi command if its use is required. The /var partition also should be mounted if it is separate from the root partition. At this point, any system files may be modified as necessary. When all required configuration changes have been completed, sync the disks and reboot as before using sync, sync, reboot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.239.148