9    Administering the Archiving Services

One of the more common tasks of a system administrator is helping users recover lost or corrupted files. To perform that task effectively, you must set up procedures for backing up files at frequent and regular intervals. This chapter describes how you use resident commands and utilities to back up (archive) and restore files and directories.

Design and implement a disaster recovery plan that describes how you intend to restore your entire operating system and user files to normal operations in the event of a catastrophic failure. This chapter does not describe the disaster recovery process, because it is often very specific to site operations and business requirements. However, backup operations are an important component of such a plan.

The following topics are included in this chapter:

9.1    Understanding Backup Tasks

This chapter describes basic backup operations for a system using the UFS file system. You might also need to use other backup and restore utilities if any of the following conditions apply to your local system:

The main tasks comprising backup and restore operations are:

9.2    Backing Up Data and System Files

For basic backup, you can use the dump and restore commands. See dump(8) for full details of all command options that are supported. The operating system also provides graphical and command line tools for archiving and for creating a bootable tape of the standalone system (SAS).

Prevention of data loss is an important part of any backup and recovery strategy. There are many tools for system monitoring that you can configure to help prevent situations that might result in data loss. For example, some systems support environmental monitoring, and there are tools to test and exercise peripherals. There are also the event and error logging systems that you can configure to monitor the system for priority events such as a backup failure. See Chapter 13 for information on using EVM (event management) to set up the event reporting strategy for your system and site. You can also use EVM to report on the success of your backups, ensuring that you do not miss a scheduled backup event.

It is important that all the files on your system, user files and system files, are protected from loss. Back up your entire system, including the system software. Many system files are static; that is, after you install them they remain unchanged. Therefore, you do not need to back up system files as frequently as data files. Incremental backups are also possible, and you might consider implementing them if your data changes significantly in a short period.

Each file system backup is a single process. To ease the backup process, organize your file systems so that dynamic files are on file systems that you back up regularly and static (system or program) files are on file systems that you back up occasionally. You might find that you have dynamic files on file systems that you back up occasionally. If this happens and you need to back them up regularly, just prior to performing a backup, copy the frequently changing files to systems that you back up regularly. This allows you to back up those files without backing up an entire file system. You can also write shell scripts to automate these tasks and use the cron command to automate the schedule. See cron(8) for more information on scheduling tasks.

9.3    Choosing a Backup Schedule

To decide how often to back up each file system, consider the balance between the potential loss of user time and data and the time it takes you to perform backups. Ask yourself the question, "How much information can I afford to lose?" The answer to this question helps you determine your minimum backup interval. On most systems the backup interval is daily, but you can choose any other interval.

It is not necessary to back up all the files in a file system at each backup. Back up only those files that changed since the previous backup; this is called an incremental backup. Using the dump and restore commands, you can perform up to nine levels of incremental backups. For example, while a level 0 dump backs up an entire file system, a level 1 dump backs up only those files changed since the last level 0 dump, and a level 7 dump backs up only those files changed since the last lower level dump.

To integrate incremental backups into your file backup schedule, you need to balance the time and tape space required for backup against the amount of time it could take you to restore the system in the event of a system failure. For example, you could schedule backup levels following the 10-day sequence:

[0 1 2 3 4 5 6 7 8 9]

On the first day you save an entire file system (level 0). On the second day you save changes since the first backup and so on until the eleventh day when you restart the sequence. This makes the amount of time spent and data saved on each backup relatively small each day except the first; however, if a system failure on the tenth day requires that you restore the entire system, you must restore all ten tapes.

Most systems follow some variant of the common Tower of Hanoi backup schedule. Once monthly you make a level 0 dump to tape of all the file systems that you backup regularly. Once weekly, you make a level 1 dump to start a daily sequence of:

[...3 2 5 4 7 6 9 8 9 9 ...]

If you do backups only once a day on the weekdays, you end up with a monthly backup schedule as follows:

[0 1 3 2 5 4 1 3 2 5 4 ...]

This schedule, although slightly complex, requires that you restore at most four tapes at any point in the month if a system failure corrupts files. Of course, doing a level 0 dump daily requires that you restore at most one tape at any point, but requires a large amount of time and tape storage for each backup. On most days in the Tower of Hanoi schedule, you require very little time and tape storage space for the backup.

9.4    Backup Methods

Depending on your needs and your local system configuration, there are several options for backing up data, as follows:

Some tools provide you with additional options when you run them as superuser (root).

9.5    Preparing to Perform a Backup

This section contains information that you might need to prepare for a backup. Also included is a list of utilities that can assist you in preparing for a backup, and a list of prerequisite tasks.

Chapter 6 contains information on the UFS file system. Chapter 5 contains information on using disk and tape devices and on determining which disk and tape devices you want to back up. Also, refer to the information about the cron command in Chapter 3 for information on scheduling regular backups. The following documentation contains other information that you might need to perform a backup:

9.5.1    System Files

Apart from the file system that you specify and the archive files created, the following files are used or created when you create backups:

9.5.2    Related Utilities

The following utilities are useful when performing backups:

9.5.3    Prerequisite Tasks

The following prerequisite tasks apply to all the backup methods:

9.6    Using the dump Command

The dump command copies all designated file systems or individual files and directories changed after a specified date to a file, pipe, magnetic tape, disk, or diskette. Refer to AdvFS Administration for information on copying AdvFS file systems. You must have superuser privileges to use the dump command.

Note

To produce valid backups on a file system, you must back up a file system while it is inactive. It is recommended that you unmount the file system and check it for consistency. As an added precaution, put the system into single-user mode before starting your backup operations. This is not true for AdvFS.

9.6.1    Performing a Full Backup

Set up a schedule for performing a full backup of each file system on your entire system, including all the system software. A conservative schedule for full system backups is to do one with each normal level 0 dump (using Tower of Hanoi, once a month), but you can set any schedule you like within the reliability of your storage media, which is about two years for magnetic tapes. To back up your file system, use the dump command. See dump(8) for a description of the command options that you use to specify the characteristics of the tape device, such as block size, tape storage density, and tape length. Specify the file system with a full pathname when you use the dump command. The dump command can back up only a single file system at a time, but there might be several dump processes simultaneously writing files to different tape devices.

The following list describes the most commonly used options to the dump command:

-integer

Specifies the dump level as an integer (0-9). A dump level of 0 causes a full dump of the specified file system. All other dump levels cause an incremental backup. That is, only files that have changed since the last dump of a lower dump level are backed up. The /etc/dumpdates file contains a record of when the dump command was used on each file system at each dump level. The -u option to the dump command updates the dumpdates file.

-f dump_file

Writes the dump to the device specified by dump_file instead of to the default device, /dev/tape/tape0_d0. If you specify the dump_file as a dash ( - ), the dump command writes to the standard output.

-u

Updates the /etc/dumpdates file with the time of the dump and the dump level for the file system in the backup. You use this file during incremental dumps (by using the dump level option) to determine which files have changed since a particular dump level. You can edit the /etc/dumpdates file to change any record or fields, if necessary. See dump(8), which describes the format of this file.

To back up your entire file system to the default backup device, use the dump command for each file system on your machine. The dump -0u command option causes a level 0 dump and updates the /etc/dumpdates file with the time and date of the backup for each file system. This creates an initial point on which to base all future incremental backups until the next full or level 0 dump. Each file system must be backed up individually.

For example, if you want to perform a level 0 dump of the root, /usr, and /projects file system partitions, follow these steps:

  1. To back up the root file system, load a tape into your tape drive and enter:

    # dump -0u /
    

    After completing the backup, remove the tape from your tape drive.

  2. To back up the /usr file system, load a new tape into your tape drive and enter:

    # dump -0u /usr
    

    After completing the backup, remove the tape from your tape drive.

  3. To back up the /projects file system, load a new tape into your tape drive and enter:

    # dump -0u /projects
    

You can either back up each file system on an individual tape, or you can back up multiple file systems on one tape by specifying the no-rewind device, /dev/ntape/tape0_d0, as the output device. The following examples show the root, /usr, and /projects file systems being backed up on one tape:

# dump -0uf /dev/ntape/tape0_d0 /
# dump -0uf /dev/ntape/tape0_d0 /usr
# dump -0uf /dev/ntape/tape0_d0 /projects

This example might require additional media management to cross-reference dump files with tapes, especially when a single dump file spans media. Exercise care when labeling this type of backup media.

9.6.2    Performing an Incremental Backup

Set up a routine as part of your backup schedule to make it easier to remember which backup to do each day. Include a mechanism for logging your backups and their dump level and for listing the tapes on which they are made. Because of the chance of system corruption, do not keep this information on the local computer system.

After you establish a system for making incremental backups, the procedure is simple. Assume you use the following backup schedule to do a daily backup of /usr:

0 1 9 9 9 1 9 9 9 9 ...
 

On Monday, perform a level 0 dump:

# dump -0u /usr

On Tuesday, perform a level 1 dump:

# dump -1u /usr

The level 1 dump backs up all the files that changed since Monday. On Wednesday through Friday you perform a level 9 dump (which always backs up all the files that have changed since Tuesday's level 1 dump):

# dump -9u /usr

To perform the same level 9 dump to the tape device named /dev/tape/tape1_d0 instead of the default tape device, use the -f option as shown in the following example:

# dump -9uf /dev/tape/tape1_d0 /usr

The argument to the -f option specifies a tape device local to the system from which you are performing the dumps.

9.6.3    Performing a Remote Backup

Some machines in a networked system environment might lack a local tape drive that you can use for making backup tapes. You can use the rdump command to make backups on a remotely located tape device. The rdump command is identical to the dump command except that it requires the -f option to specify the machine name and an attached backup device. See dump(8) for a description of the options to the rdump command.

The rdump command updates the /etc/dumpdates file on the local machine in the same way as does the dump command. The rdump command starts a remote server, /usr/sbin/rmt, on the remote machine to access the storage medium. (This server process is transparent. See rmt(8) for more information.)

To back up the /projects file system from bhost1 onto a tape drive on bhost2 with the attached backup device /dev/rmt0h, enter the following command from bhost1. The name of bhost1 must be defined in the /.rhosts file of bhost2 to allow access.

# rdump -0uf bhost2:/dev/tape/tape0_d0 /projects

9.6.4    Using Backup Scripts

You can automate the backup process by using shell scripts. The cron daemon can execute these shell scripts late in the evening when there is less chance of the dump commands making errors due to a changing system.

Backup shell scripts often perform the following tasks:

Some time during the day, load a tape into the tape drive. At the specified time, the cron daemon runs the backup shell scripts. After the shell procedures are finished, remove the backup tape and archive it.

Backup shell scripts are best used when the dump is small enough to fit on a single tape. You must specify the no-rewind device and the -N option to the dump command to inhibit the tape from automatically going off line when each dump is completed. After the dump command reaches the end of the tape, it takes the tape off line and you must replace the tape.

9.7    Restoring Data

Occasionally, you need to retrieve files from your backup tapes, and possibly need to restore entire file systems at some time. If you have set up a good backup procedure, then restoring files or full file systems is a simple task.

If a serious problem occurs, you might have to restore your entire system. Before restoring, determine what caused the problem with the system.

After determining the cause of the problem, reinstall your system from the initial boot tapes. The installation instructions that came with your system explain this procedure.

After your system is up and running, restore the system to the state it was in just prior to the system crash. If you are using AdvFS, use the vrestore command. Refer to AdvFS Administration for information on restoring the AdvFS file system. If you used the vdump command to back up a UFS file system, you can also use the vrestore command to recover it. However, if you used the dump command you must use the restore command to recover files. Because the dump command saves only a single file system at a time, you must execute the restore command for each file system you want to restore. See restore(8) for information on the command syntax.

9.7.1    Restoring a File System

This section describes a general procedure for restoring a file system, such as after a disk failure or other loss of data. To restore individual files, go to Section 9.7.2.

To restore a file system, create a new file system and restore the files from the dump files by using the following commands:

Refer to the AdvFS Administration guide for information on restoring an AdvFS file system.

If the disk does not have a label, write the label by using the disklabel command before you create the new file system. See disklabel(8).

Writing a label with customized partition table settings might affect the entire disk. Use the following command to write the default disk partition table:

# /sbin/disklabel -rw dsk1

Invoke the editing option of the disklabel command to use the customized partition table settings. Refer to Chapter 6 for more information. You can also use the diskconfig Disk Configuration interface. See diskconfig(8).

The following example shows the commands you use to restore a file system called /usr/projects from a tape:

# disklabel -rw dsk1
# newfs /dev/rdisk/dsk1c
# mount /dev/rdisk/dsk1c /usr/projects
# cd /usr/projects
# restore -Yrf /dev/tape/tape0_d0

9.7.2    Restoring Files Manually

If users lose data files, they ask their system administrator to restore those files. Users might also ask you to restore an earlier version of a file. Whatever the reason for a file restoration, you must determine which tape contains the correct version of the file. Enquire when the file was lost and when it was last modified, you can use your backup log to determine which tape contains the most recent version of the wanted file.

Use the -t option with the restore command to determine whether a file is on the selected tape. The -t option creates a list of files and directories on the tape. For example, to list the contents of the working subdirectory of the /usr file system on a particular backup tape, load the tape and enter:

# restore -t ./working

To create a list of the entire contents of a backup tape, load the backup tape and enter:

# restore -t

Make a listing of each backup tape after you create it. This verifies a successful backup and gives you a place to look up what files are on the tape.

After determining the location of the file, create a new directory for the file. If you restore the file into an existing directory and the file already exists, the restored file overwrites the existing file.

For example, to restore the working/old.file file from a /usr file system backup tape into your current directory, load the backup tape and enter:

# restore -x ./working/old.file

To restore the entire contents of the working subdirectory from the same tape, enter:

# restore -x ./working

If your dump media contains multiple dump images, you need to know the sequence of the dump images in order to restore a file from one of the images. To examine the contents of the first dump image on the media, load the tape and enter:

# restore -ts 1

The -s option followed by the number 1 specifies the first dump image.

For example, to restore the working/old.file file from a /usr file system, which is the third dump image on the backup tape into your current directory, load the backup tape and enter:

# restore -xs 3 ./working/old.file

9.7.3    Restoring Files Interactively

To ease the task of restoring multiple files, use the -i option to the restore command. This option starts an interactive restore session. The interactive mode has commands similar to shell commands.

To begin an interactive restore session, enter:

# restore -i

The system responds with the following prompt:

restore >
 

The following command-line options are available in the interactive restore mode:

ls [ directory ]

Lists files in the current or specified directory. Directory entries end with a slash (/). Entries that are marked for reading begin with an asterisk (*).

cd [ directory ]

Changes the current directory to the directory specified by the directory argument.

pwd

Lists the pathname of the current directory.

add [ files ]

Adds the files in the current directory or the files specified by the files argument to the list of files recovered from the tape. Files are marked with an asterisk (*) if they are identified as "to be read" by the add command. You see this asterisk when you use the ls command to list files.

delete [ files ]

Deletes all the files in the current directory or the files specified by the files argument from the list of files recovered from the tape.

extract

Restores from the tape the files that are marked "to be read" into the current working directory. The extract command prompts you for the logical volume that you want to mount (usually 1), and whether the access modes of the dot (.) current directory are affected; answer yes when you are restoring the entire root directory.

setmodes

Sets owner, access modes, and file creation times for all directories added to the files-to-read list; no files are recovered from the tape. Use this command to clean up files after a restore command is prematurely aborted.

verbose

Toggles verbose mode. In verbose mode, each file name is printed to the standard output. By default, verbose mode is set to off. This is the same as the -v command line option to the restore command.

help

Lists a summary of the interactive commands.

?

Lists a summary of the interactive commands.

what

Lists the tape header information.

quit

Quits the interactive restore session.

xit

Exits from the interactive restore session. The xit command is the same as the quit command.

To interactively restore the ./working/file1 and ./working/file2 files from a backup tape, load the tape and enter:

# restore -i

After you switch to interactive mode, follow these steps to add the files to the list of files that you want to extract:

  1. Change to the working directory:

    restore > cd working
    

  2. At the prompt, enter the file name as follows:

    restore > add file1
    

  3. Enter the name of the second file as follows:

    restore > add file2
    

  4. Extract the files as follows:

    restore > extract
    

  5. You are prompted for the logical volume you want to mount; usually you respond to this prompt with 1 as shown in the following example:

    You have not read any tapes yet.
    Unless you know which volume your file(s) are on you can start
    with the last volume and work towards the first.
     
    Specify next volume #: 1
    

    You are then asked whether the extract affects the access modes of the dot (.) current directory. For this example, reply with n.

    set owner/mode for '.'? [yn] n
    

  6. After the files are extracted, quit the interactive session as follows:

    restore > quit
    

The file1 and file2 files are now in the current directory.

You can automate this procedure in a command file that is read by the -F option to the restore command. For example, the following command file, named restore_file, performs the restore operation shown in the previous example:

cd working
add file1
add file2
extract
1
n
quit

To read and execute this shell script, enter the following command:

# restore -iF restore_file

The result of the procedure in this script is identical to that of the previous interactive restore session.

9.7.4    Restoring Files Remotely

You use the rrestore command to restore files to local directories from a remote tape device. The rrestore command requires the -f option to specify the machine name and its backup device. See rmt(8) for more information and Section 9.7 for a description of the options to the rrestore command.

You must specify the name of the remote system where the backup device is attached, and the name of the backup device on that remote system in the format system:device

To restore the ./working/file1 file onto the local directory on system1 from a backup tape mounted on system2 where the backup device /dev/rmt0h is attached, enter the following command from system1. The name system1 must be in the /.rhosts file of system2 to allow access from system1 to system2.

# rrestore -xf system2:/dev/tape/tape0_d0 ./working/file1

The rrestore command starts a remote server, /usr/sbin/rmt, on the remote system to access the storage medium.

9.7.5    Restoring or Duplicating a System (Root) Disk

In previous versions of the operating system, device names were assigned based on the physical location of the drive, according to the SCSI bus target. In Version 5.0 and higher, device names are assigned logically and stored in a database. They have no relationship to the bus address of the device. The device database must be recovered and possibly updated to successfully restore the root file system or if you want to move the root disk to a disk with larger capacity. You might also need to install devices (such as a tape device) to the device database when you restore the device from tape backup media.

After you reboot the system during the restoration, you might see the following message:

Unable to save existing hardware configuration.
New configuration will be used

This message indicates that the device database is not recoverable and you must restore it.

The following procedure is a generic method for recovering or duplicating (cloning) a root disk. It covers the following possible scenarios:

Note

This procedure does not specifically address recovery methods from network backups and it does not address recovery of an AdvFS file system. See AdvFS Administration.

Depending on your knowledge of your system, you might not need to read all the following sections:

9.7.5.1    Preparing for Recovery or Duplication

Depending on how your system is set up, and your level of system knowledge, you might need the following:

The status of your system must be as described in Table 9-1:

Table 9-1:  Recovery Preparation

Requirement Description
A Full and Recent Backup You need a full backup of all operating system file sets that are on the root volume. This might include root (/), /usr, and /var.
System Configuration

This procedure applies to all configurations where there is a single disk drive used for the root partition which might also contain the /usr and /var file systems. You need a functional disk drive to contain the restored root volume. This disk must have a minimum storage space as defined in the operating system limits for the restored release. The restore device (typically a tape drive) must be local and not a remote backup device.

Logical Storage Manager

If you are using the Logical Storage manager (LSM), refer to the Logical Storage Manager guide for information on recovering the root volume.

User Interface

This procedure requires a console login.

Impact on System Availability

Except on clustered systems, loss of the root disk invariably involves one or more shutdowns and reboots of the system. This procedure is intended to help you restore full operation as quickly as possible.

The time required for duplicating or recovering a disk depends on the disk size.

Privileges You must be a root user with physical access to the system's storage array and backup devices

9.7.5.2    Determining the Restoration Requirements

You might need the following resources to complete the restoration of your root disk. If are very familiar with your system's configuration, or if you have a recovery plan which records all the information you need to perform a recovery, you do not need to read this section. You might need the following items:

9.7.5.3    Applying the Procedure

Some steps in the procedure are dependent on your system's original configuration. Ignore these steps if they do not apply to your configuration. The optional steps are marked [Configuration Dependent].

In the procedure, you always proceed to the next step unless redirected.

  1. Boot the system from the operating system distribution media by using one of the following methods:

  2. [Configuration Dependent] If you are already using the character-cell installation procedure, go to step 3, otherwise complete the following task.

    If your system has a graphics console, the installation defaults to graphical mode. Wait until the installation procedure displays a dialog box titled Installation Welcome.

    Pull down the File menu and select the Exit option to invoke character-cell mode.

  3. Verify the status of the backup device and the target disk (the restored root disk) by using the following command:

    # hwmgr view devices
    

    The hwmgr command displays a list of all devices currently recognized by the system as shown in the following example:

    HWID: Device Name         Mfg      Model            Location
     ------------------------------------------------------------------------
        4: /dev/kevm
       28: /dev/disk/floppy0c          3.5in floppy      fdi0-unit-0
       31: /dev/disk/dsk0c    DEC      RZ26L    (C) DEC  bus-0-targ-0-lun-0
       32: /dev/disk/dsk1c    DEC      RZ26     (C) DEC  bus-0-targ-1-lun-0
       33: /dev/disk/dsk2c    COMPAQ   HB00931B93        bus-0-targ-3-lun-0
       34: /dev/disk/cdrom0c  DEC      RRD45    (C) DEC  bus-0-targ-4-lun-0
       35: /dev/disk/dsk3c    COMPAQ   HB00931B93        bus-0-targ-5-lun-0
       37:                    DEC      TLZ06    (C)DEC   bus-0-targ-6-lun-0
    

    Locate and write down the following data:

  4. Install the backup device by using the following command:

    # dn_setup -install_tape
    

    To verify the installation and determine the device name (such as tape0_d0), repeat the hwmgr command in step 3.

  5. [Configuration Dependent] If the original file system format is unknown, you can now ascertain it and verify that you have a readable backup tape as follows:

    1. Load the backup (dump) media into the device.

    2. Invoke the interactive mode of the restore command, specifying the backup device name that you determined in step 4. For example:

      # restore -i -f /dev/ntape/tape0_d0
      

    3. If the backup is good, a prompt for interactive restoration is displayed. Enter the what command to display the header and record the information.

  6. Create and apply a disk label by using the following information:

    1. The partition plan that you created during recovery planning, including any swap space requirements. (See Section 9.7.5.2.)

    2. The new root device name determined in step 3.

    Specify the a partition and label the drive as a bootable device. For example:

    # disklabel -wr /dev/disk/dsk2a
    

  7. Create your UFS target file systems as follows:

    You must create file systems on the new root drive for each file system that you need to restore. For example, to create the new root and /usr file systems on partitions a and g, use commands similar to the following:

    # newfs /dev/disk/dsk2a
    # newfs /dev/disk/dsk2g
    

  8. Mount the replacement disk on the temporary mount point /mnt according to the type of file system. For example:

    # mount /dev/disk/dsk2a /mnt
    

  9. Use the vrestore or restore command to restore files. For example:

    # cd /mnt
    # vrestore -x device
    

  10. Shut down and halt the system by using the following command:

    # shutdown -h now
    

  11. Boot the system to single-user mode, specifying the restored root drive as the boot device. For example:

    >>> boot dka2 -flags s
    

    If you are using an alternate drive, or if you installed a new drive, you might need to translate the system device name to the appropriate boot device name. In step 3, you used the hwmgr command to determine the device database entry for the new device. For example:

    33: /dev/disk/dsk2c    COMPAQ   HB00931B93    bus-0-targ-3-lun-0
    

    Use the following command to display the devices:

    >>> show device
    

    Map the value of the b/t/l (in this case 0.3.0) to the alternate or new device and identify its boot device name, such as dka300.

  12. If the boot is successful, run the following script to update the device database:

    # /sbin/mountroot
    

    While the dsfmgr command attempts to update the device database, some error or warning messages might be displayed. You can ignore the messages.

  13. [Configuration Dependent] If you installed a new drive for root, or you specified an alternate device, you need to rename devices. Using the device name information that you determined in step 3, rename the devices as follows:

  14. Using the interactive mode of the vrestore command, load the backup media into the restore device and restore the device directories. This step ensures that all appropriate devices, including any custom device drivers are recreated:

  15. Use the dsfmgr command to verify the device databases and device special file names as follows:

    # dsfmgr -v
     
     
    

  16. This is the end of the procedure. Assuming that you have restored all the required file systems, including /usr and (if necessary) /var, you can now shut down the system, redefine the boot device, and reboot the system to multiuser mode as follows:

    # shutdown -h now
    >>> set bootdef_dev dka300
    >>> boot
    

You can verify success by checking the boot process for any error messages relating to devices. If you determine that the procedure is not successful, your only option is to reinstall the operating system from the distribution media and recreate your customized environment.

9.7.5.4    Using Alternative root Disk Duplication Methods

Other methods of restoring or duplicating the root disk depend on whether or not you configured your system in anticipation of such problems. The following methods are available:

9.7.6    Restoring the /usr and /var File System

You might need to restore the root file system as described in Section 9.7.5 before you can restore the /usr file system. If the /var directory is on a file system other than /usr, repeat the steps in this section for restoring the /var file system.

The procedure in this section requires that you have access to the most recent dump files of your /usr file systems. The following steps show how you restore from a level 0 dump of files, by using the text-based (or character cell) interface to perform the task:

  1. Label the disk if required by using the disklabel command as follows:

    # disklabel -rw /dev/disk/dsk0
    

    Note

    The options used with the disklabel command in this procedure will write a default disk partition table to the disk. If the disk you are restoring has a customized partition table, invoke the editing option of the disklabel command or restore the partition table from your protofile label. See Chapter 6 and disklabel(8) for more information.

  2. Create a new file system by using the newfs command. For example:

    # newfs /dev/rdisk/dsk1c
    

  3. If necessary, create mount points by using the mkdir command. For example:

    # mkdir /usr
    

  4. Mount the file system by using the mount command, For example, to mount the file system created in the previous step, enter:

    # mount /dev/disk/dsk1c /usr
    

  5. Restore the file system:

9.8    Using the Command-Line Utilities, tar, pax, and cpio

The tar, pax, and cpio command-line utilities provide a method of quickly creating an archive from the command line or for writing scripts to back up files. The disadvantage is that you might have to type long command strings, and backing up or restoring large volumes of files and directories is not easy when using these interfaces. You might use these utilities make a small archive of files for distribution to other users, such as a program, its sources, and associated documentation.

The following examples demonstrate how you can create or restore typical archive files by using the command-line utilities.

Using tar to Create an Archive

The tar command saves and restores multiple files on a single device such as a disk or tape.

To use the tar to create an archive on tape drive /dev/tape/tape12_d0, enter a command such as the following

# tar cvfb /dev/tape12 -e ./.netscape -C /usr/glenn

The resulting archive contains all files and directories in the /usr/glenn directory, except for file ./.netscape. See tar(1) for more information.

Using pax to Create an Archive

The pax command extracts, writes, and lists members of archive files. It also copies files and directory hierarchies.

To use the pax command to create a archive of the current directory to device /dev/tape/tape0_d0, enter:

# pax -w -f /dev/tape/tape0
 
 

The following command reads the archive a.pax, extracting all files rooted in the /usr directory, relative to the current directory:

# pax -r -s ',^//*usr//*,,' -f a.pax

See pax(1) for more information.

Using cpio to Create an Archive

The cpio command copies files between archive storage and the file system. It is used to save and restore data from traditional format cpio archives.

To use the cpio command to create an archive to tape device /dev/tape/tape12_d0, enter:

# cpio -ov < file-list -O/dev/tape12_d0

See cpio(1) for more information.

9.9    Using dxarchiver

The Archiver, dxarchiver, is a graphical user interface for the command-line utilities described in Section 9.8. Use this interface to:

Because the dxarchiver GUI is a CDE application, you can drag and drop files and directories (folders) to assemble an archive set, without having to type long commands.

It is assumed that you gathered the information Section 9.5.3, and you have loaded or unloaded a tape or other media into the target device as described in the owner's manual. To create an archive, proceed as follows:

  1. Invoke the /usr/bin/X11/dxarchiver GUI from a terminal command line, or open the CDE Application Group: System_Admin. Then open System Admin Subgroup: Daily Admin and click on the Archiver icon.

  2. Select the Archive Type: tar, cpio, or pax. Not all command-line options might be available from the graphical interface.

  3. Select any Archive Options. You can only append to an existing archive, and you cannot further compress an existing archive that was compressed on creation. Specify either an absolute or a relative pathname as the method of storing the directories. (An absolute pathname is the full path, beginning at the root directory such as /usr/users. A relative pathname begins at the current directory, for example dot (.) or users/chan.)

    During future recovery of these files, you can write them to a temporary location only if you specified a relative path during the original archiving process. Otherwise, files are restored to their original locations. (Potentially overwriting the existing version of the file unless you rename it.)

  4. Specify the source, the files, and directories to archive. You can type pathnames or you can open a File Manager view and drag files and directories (CDE folders) to the Source Container box within the Archiver window. If you type pathnames, use the OK button to add them to the container.

  5. After all required files are specified, choose the Archive... option and the Archiver: Archive window is displayed.

  6. Enter a destination path, such as:

    After you choose OK, the destination is displayed under the Destination Container box.

  7. Press Create Archive. A window titled Archiver working is displayed, flashing a green button to indicate that the archive is being written. The files being archived are displayed in the Destination Container.

  8. After the archive is complete, you can optionally print a copy of the files list to keep as a record with the tape.

  9. Choose Cancel to return to the Archiver main window. You can optionally enter the name of the archive file and use the Show Contents... option to verify that the archive was written correctly. The tape or archive file is read and the contents displayed in the Show Contents Window.

To extract an archive, you must specify a destination on a target device such as a disk. If you are not recovering a damaged file system on a complete disk partition, you might consider using a temporary location rather than overwriting existing directories. You can then restore individual files and directories as needed. You can also restore selected files from the archive as follows:

  1. Invoke the /usr/bin/X11/dxarchiver GUI from a terminal command line, or open the CDE Application Group: System_Admin. Then open System Admin Subgroup: Daily Admin and click on the Archiver icon.

  2. Choose Show Contents... to select individual files and directories. The tape or archive file is read and the contents displayed in the Archiver Show Contents window. Select individual files or directories as follows:

  3. Choose the Extract... option to display the Archiver Extract window.

  4. Enter a destination directory. This directory can be the same as the archive, assuming that files can be overwritten. Alternatively, give the path to a temporary location. This path must be to an existing directory, or you must open a terminal and create it with the mkdir command. Alternatively, create a folder by using the New Folder option in CDE File Manager. The destination is displayed under the Destination Container box.

  5. Choose Extract Contents to begin the extraction. A window titled Archiver Working is displayed, flashing a green button to indicate that the archive is being extracted. The files being recovered are displayed in the Destination Container.

  6. After the archive is complete, you can optionally print a copy of the files list, to keep as a record.

  7. Choose Cancel to return to the Archiver main window. Before exiting, use the File Manager or a terminal window to ensure that the files were recovered as expected and that the file contents are not corrupted. This step is strongly recommended before you proceed to remove any archives from tape or other media.

You can now remove the tape or other media as described in the owner's manual for the device, and store the media in a safe location (or in accordance with your site backup policy and procedures).

9.10    Creating a Standalone System Kernel on Tape

You can create a bootable standalone system (SAS) kernel on tape. The SAS kernel has a built-in memory file system (mfs), which contains the minimum commands, files, and directories needed to restore the system image. This is referred to as the miniroot file system. You can also add required file systems to the tape for data or programs that you might need on the recovered system.

To create the SAS kernel, you must use the SysMan Menu Create a Bootable Tape option or the btcreate command-line utility. After you create the kernel, you can restore the customized image by using the btextract utility. You can invoke only a single instance of the btcreate utility. The /usr/run/bttape.pid locking file prevents multiple instances of the utility.

The following sections provide an overview of the bttape interfaces, SysMan Menu task, and the btcreate and btextract command-line utilities.

9.10.1    Tape Device Requirements

If you use QIC tape drives to create bootable tapes, you must use only high-density tapes of 320 or more megabytes. The QIC-24, QIC-120, and QIC-150 format tapes of fixed-512 blocks do not work. Tapes with a variable block size, such as the QIC-320 and QIC-525, work with bootable tape. Using an improperly configured QIC tape drive to create a bootable tape results in an I/O error, a write error, or permission denied error. Therefore, you must take one of the following actions:

A QIC tape created with the btcreate command might fail with the following error message when booted:

failed to send Read to mka... Be sure that the tape is
 write protected before booting.                                    
 

If you are creating a bootable tape with a file system that extends to multiple tapes, the /sbin/dump command displays a message indicating that you must change the tape. If you do not change the tape promptly, warning messages repeat periodically until you change the tape.

The behavior of the open call to a tape device has changed. You can no longer use write mode to open a write-protected tape. An attempt to open the tape fails, returning the following message:

 EACCES (permission denied)                                    
 

If an application is written so that it attempts to open the tape device with O_RDWR permission when the intention is only to read the tape, the open attempt fails. Change any applications or scripts to open the device with O_RDONLY permission. Use the following command to obtain the previous behavior of the open call for applications that cannot be changed:

# sysconfig -r cam_tape open_behaviour=0                                   
 

9.10.2    Using the btcreate Utility

To build a bootable SAS kernel on UFS or AdvFS file systems only, you must use the btcreate utility. The following sections provide an overview of the information you must have to create the SAS kernel on tape.

The btcreate command provides both a noninteractive and interactive user interface. Both require that you have superuser (root) privileges.

9.10.2.1    Gathering Information

To prepare to use the btcreate command, you must have the following information:

The following additional features might be useful in planning your bootable tape layout:

9.10.2.2    Creating the SAS Kernel

To create the SAS kernel, the btcreate command copies the /usr/sys/conf/YOUR_SYSTEM_NAME configuration file to /usr/sys/conf/YOUR_SYSTEM_NAME.BOOTABLE and modifies it as follows:

config    vmunix   root  on md
pseudo-device      memd  38000

These modifications configure a memory file system of 38000 blocks. The memory file system and the disk partition where the miniroot file system reside are equivalent in size.

After modifying the configuration file, the btcreate command executes the doconfig command and moves the bootable kernel to the /usr/sys/bin directory. For information on the command syntax and options, see btcreate(8).

9.10.3    Using the btextract Utility

The btextract command is a shell script that restores file systems from tapes that contain a SAS kernel created by using the btcreate utility. You can perform a default restoration or an advanced restoration of the system.

During a default restoration, you can choose to duplicate the customized system on more than one system of the same hardware platform type. You cannot specify which disk partitions to use for the restore operation. Instead, the btextract command restores file systems using the disk partition information gathered during the btcreate session and all existing information is overwritten. If you are performing an advanced restoration, you can optionally specify which disk partition to use. However you can duplicate the customized system only on a system of the same hardware platform type.

To use the btextract command, place the system in a halt state, initialize the system, then boot from the tape as follows:

>>> init
>>> show dev
>>> boot -fl "nc" MKA500

In this example, the show dev command provides the device name under BOOTDEV and MKA500 is the BOOTDEV.

After the initial boot completes, the shell invokes the btextract utility. If you created a /usr/lib/sabt/sbin/custom_install.sh script during the btcreate session, the btextract command invokes the custom_install.sh script before exiting. You can also create a custom_prerestore answer file to automate the recovery procedure. See btcreate(8) for more information.

After the btextract command completes its task, you must shut down and reboot the system from the restored disk as follows:

# shutdown -h now
>>> boot DKA100

In this example, DKA100 is the BOOTDEV.

For more information and examples, see btextract(8).

9.10.4    Using the SysMan Menu boot_tape Option

The following steps describe the basic process for creating a bootable tape. It assumes that you have gathered the necessary device data as described in Section 9.10.2.1, and the tape device is ready to save.

  1. Invoke the Create a Bootable Tape task from the SysMan Menu, or enter the following command at the prompt:

    # sysman boot_tape
    

  2. A window titled Bootable Tape Creation on hostname is displayed. Complete the fields or choose options as follows:

  3. After completing the required fields, you are ready to create the tape. In the main window for Bootable Tape Creation, click on the OK button to proceed. A message window is displayed to indicate that the task has started. The creation of the tape can take twenty or more minutes, depending on the speed of the devices used.

    If the task cannot be completed, a message is displayed informing you that the error log is located in /var/adm/btcreate.log.

  4. After the tape is successfully written, a message is displayed confirming the success and the location of the log file, /var/adm/btcreate.log.

    Print btextract(8)

    and store it with the tape for future reference.

  5. Use the instructions in Section 9.10.3 and btextract(8) to restore the bootable SAS kernel. Consider running a test recovery to ensure that any future recovery works as intended.