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:
An overview of the steps and options involved in creating a backup (Section 9.1)
A discussion on the main tasks involved in creating a backup (Section 9.2)
Information on how to set up a backup schedule (Section 9.3)
A discussion on the methods of creating a backup (Section 9.4)
Information that enables you to prepare for a backup, such as references to other documents that you may need to read, system files created, related utilities, and prerequisite tasks (Section 9.5)
A discussion on the use of the
dump
command
to perform a backup (Section 9.6)
A discussion on the use of the
restore
command to recover data from a backup (Section 9.7)
A description of the commands that enable you to archive individual files and directories, rather than complete file systems (Section 9.8)
A discussion on the use of
dxarchiver,
a graphical user interface for archiving files and directories (Section 9.9)
Information on creating a bootable tape, which is a bootable backup of the root file system and key system files that may be useful for disaster recovery (Section 9.10)
9.1 Understanding Backup Tasks
This chapter describes basic backup operations for a system using the UFS file system. You also may need to use other backup and restore utilities if any of the following conditions apply to your local system:
If you are using the Advanced File System (AdvFS) file system exclusively, or if you are using AdvFS domains on some of the disks attached to your system, see the AdvFS Administration manual. Using the AdvFS file system provides you with more backup features, such as the ability to clone domains. One of the disadvantages of the UFS file system is that you must prevent access to a UFS file system during a backup. If a user accesses a file while a backup is in process, the backup may not record changes in the file. To ensure a completely accurate back up of a UFS file system, you may need to take a disk off line or shut the system down to single user mode. If you are unable to schedule system shut downs, consider using the AdvFS file system.
If you are using the Logical Storage Manager (LSM), see the Logical Storage Manager manual. Using features of LSM such as mirroring volumes, you may be able to overcome some of the backup limitations of UFS. For example, you can take an instant, accurate snapshot of a UFS file system by mirroring the file system on a different disk. Then you can break the mirror at any time to create an archive, with only a brief pause in system operations. Using LSM requires spare disk capacity and may be unsuitable for small systems with few disks.
If you want to back up and restore a root volume to a different system, consider using configuration cloning. This feature is described in the Installation Guide Advanced Topics. Configuration cloning enables you to recreate a customized operating system on another processor in the event of a disaster, or to recreate an environment on one or more systems.
This chapter describes only those backup and archiving utilities that are provided in the base operating system when installed.
The Associated Products CD-ROM may include additional backup applications (which may require additional licenses). See the Installation Guide for information. See the documentation that comes with your backup application for information on using third-party products.
The main tasks comprising backup and restore operations are:
Creating your data recovery and disaster recovery plans
Backing up data, which consists of the following:
Choosing a backup schedule
Creating small archives by using the
pax,
tar,
and
cpio
commands or the associated graphical
user interface,
dxarchiver
Performing a full UFS backup using the
dump
utility
Performing an incremental backup
Performing a remote backup
Using backup tools
Restoring data, specifically:
Restoring files from small archives
Restoring a file system from a dump
Restoring a dumped file system on a new partition
Restoring files
Restoring files interactively
Performing remote restorations
Restoring standalone systems from bootable tape
9.2 Backing Up Data and System Files
For basic backup, you can use the
dump
and
restore
commands.
See
dump(8)
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 may 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 the Event Manager to set up the event reporting strategy for your system and site. You can use the Event Manager 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 may 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 may 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 write shell
scripts to automate these tasks and use the
cron
command
to automate the schedule.
See
cron(8)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:
You can run the following command line interfaces from a terminal:
dump,
rdump,
restore, and
rrestore
tar,
pax, and
cpio
Use these to create quick file archives or to create scripts that you
run with the
cron
scheduler.
The bootable tape feature,
bttape, is a SysMan
Menu application that you can invoke from the command line, the SysMan
Menu, or from CDE.
Depending on how you invoke it, it either runs the command
line interface or a graphical user interface that is appropriate to your windowing
environment.
(See
Chapter 1
for more information.) The commands
are
btcreate
and
btextract.
Use the bootable tape feature to create a bootable tape for recovery and to back up critical system data and customized system files. This feature also enables you to use any terminal and a number of windowing environments, and is therefore recommended for remote operations.
From the CDE folder Application Manager - System Admin,
open the Storage Management folder and click on the Bootable Tape icon.
This
action invokes the graphical user interface to the
bttape
utility.
From CDE, open the Application Manager pop-up menu from the front panel and open the Desktop_Tools folder to use the following utilities:
Archive - For quick archiving of files and folders, such as when archiving projects or user accounts. The related interfaces, Archive List Contents and Archive Unpack, enable you to manage these archives. These are simple graphical interfaces with minimal options.
From the CDE Application Manager - System Admin folder, open the DailyAdmin folder to use the Archiver utility. The Archiver is a graphical user interface to the command line tools that enables you to select archive type and options such as compression. This interface allows you to drag and drop entire file systems or directories (folders) into the backup set.
Some tools provide you with additional options when you run
them as superuser (root).
9.5 Preparing to Perform a Backup
The following sections contain information that you may 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.
The
Hardware Management
manual contains information on using disk and tape
devices and on determining which disk and tape devices you want to back up.
Also, see the information about the
cron
command in
Chapter 3
for information on scheduling regular backups.
The following sections contain other information that you may need to perform
a backup:
9.5.1 Related Documentation
Additional documentation on using the backup utilities is available
in
manuals,
reference pages, and
online help.
9.5.1.1 Manuals
These manuals also provide useful information for archival services.
The AdvFS Administration and Logical Storage Manager manuals contain information on the AdvFS file system and LSM storage management features.
The owner's manual for any peripherals used (such as tape drives) contain important information. These documents provide you with information on storage volume, media type, compression densities, and general operating instructions for a device.
Each utility has its own reference page that describes how to invoke the utility and the available options for that utility.
The following reference pages provide information on the basic utilities for dumping file systems to tape and restoring them back to disk:
These reference pages provide information on the basic utilities for creating and manipulating archive files:
The following reference pages provide information on the bootable tape interfaces:
The following reference pages provide information on creating
cron
entries for backup scripts that execute at specific dates and
times.
The
mcutil(1)9.5.1.3 Online Help
Both the Archiver and Bootable Tape graphical user interfaces provide
online help that describes your options and defines what data you can enter
into the data fields in each window.
9.5.2 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:
The
dump
and
restore
commands create or use the following files:
/etc/dumpdatesContains a list of file systems that were backed up, the date that each file system was backed up, and the backup level
/tmp/rstdir*Lists directories stored on the default tape
/tmp/rstmode*Records the owner, permission mode, and timestamps for stored directories
./restoresymtabHolds information
required during incremental restore or
rrestore
operations
The bootable tape feature creates or uses the following files:
/var/adm/btcreate.logProvides
a log of the
btcreate
process
/usr/lib/sabt/sbin/custom_install.shSpecifies which files are added to the miniroot
/usr/lib/sabt/etc/addlistA data file that specifies which files and directories are added to the miniroot file system that is created on the bootable tape
/usr/lib/sabt/etc/fslistA data file that specifies which file systems are backed up
/usr/run/bttape.pidA lock
file that prevents multiple instances of the
btcreate
utility
The following utilities are useful when performing backups:
The SysMan Station provides a graphical view of the storage devices available on the system. Use this interface to help you identify disk and tape devices and find their device names.
The CDE Application Manager
Desktop_Tools folder provides a Disk Usage tool that runs the
du
command and returns statistics on disk usage.
Use the Folder Size
option to examine the size (in blocks) of any directory, such as
/usr/users.
Command line utilities
du
and
df
provide the same data.
DailyAdmin folder provides the System Information interfaces, a graphical view of system resources such as file space usage. You can set this monitor to flash a visual warning when your preset file space limits are exceeded. You can also use the SysMan Station to monitor file systems as described in Chapter 1.
Provides a way of monitoring file system limits and alerts you of problems or can automatically start backups and cleanup of file systems.
dsfmgr
and
hwmgrThe command line interfaces dsfmgr and hwmgr enable you to query the system for information about devices, such as device names and disk partition size.
You can get information from the Disk Configuration GUI, which you can
invoke from CDE Application Manager - Configuration folder, or from the SysMan
Menu.
This interface provides size information in megabytes, bytes, and blocks.
(The disklabel command provides a command line disk configuration interface).
9.5.4 Prerequisite Tasks
The following prerequisite tasks apply to all the backup methods:
Become familiar with using the interfaces and the sources of information about the commands. Ensure that this information is available to you when the system is down. Often, you must perform recovery operations in single-user mode, and reference pages may not be available.
Ensure that all the required products or utilities are installed and configured (if necessary). The simplest way to do this is to see the reference page for information on invoking the tool, and run a test by invoking command line interfaces with null input, or by starting up the graphical user interfaces.
Verify that the tape hardware is installed and configured.
If you are unsure, you can use the
/usr/field/tapex
tape
exerciser and see the hardware documentation for other test features.
See
also the hardware information tools listed in
Section 9.5.3.
Examine the size of the directories that you want to back up. For example, you can use the following commands:
# df /usr
Filesystem 512-blocks Used Available Capacity Mounted on /devices/disk/dsk0g 1498886 688192 660804 52% /usr
# du -s -x /usr/users 1835 /usr/users
You can use the graphical or command line tools listed in Section 9.5.3.
Obtain sufficient quantities of the correct media, ensuring that there is enough storage volume for the files that you intend to back up. This also applies if archiving to disk or any other writeable media, such as WORM drives or magneto-optical diskette drives.
Identify the files or directories that you intend to work with, and choose appropriate names for the archives. You may need some temporary scratch disk space if assembling different directories into a single volume before archiving (although you can do this directly to the archive from the command line or by adding directories to existing archives). See the documentation for the backup utility that you choose to use. Some tools provide default file names and locations. For example, the bootable tape interface prompts you for the following file names. (You can accept the default or provide another file name):
/usr/lib/sabt/etc/fslistA data file that specifies which files and directories are added (appended) to the miniroot
/usr/lib/sabt/etc/addlistA data file that specifies which file systems are backed up
The Archiver requires the following:
One or more source files or directories.
In CDE, directories
are identified as folders, and you can drag and drop them into the Archiver
window from File View windows instead of entering long pathnames such as
/usr/lib/sabt/sbin.
A destination file, such as
/usr/backups
for a tar file on disk, or the device name for a tape device, such as
/dev/tape/tape0_d0.
(You do not need to supply an extension or
suffix for the archive file name.
The utilities listed in
Section 9.5.3
can assist you in finding the required device information, particularly if
more than one tape drive is attached to a system.)
The archive name (for example,
/usr/archives/userfiles_990802.Z
or
/dev/tape/tape0_d0
for a tape archive)
if you are restoring (that is, unpacking) an archive.
The device name for the device or devices that you want to access, and any associated device special file. For example, the following are valid device names and device special files:
| Device name | Device Special File | Description |
dsk0a |
/dev/disk/dsk0a |
Partition a of disk number 0 |
disk1b |
/dev/rdisk/dsk1b |
Partition b of raw disk 1 |
tape0c |
/dev/tape/tape0c |
Default density rewind tape (with compression) |
tape0_d0 |
/dev/ntape/tape0_d0 |
Nonrewind tape device 0. The _d0 suffix specifies the density |
Device names are located in the
/dev
directory
under the
/disk,
/rdisk,
/tape, or
/ntape
subdirectories.
Also, you
can use the graphical or command line tools listed in
Section 9.5.3
to locate devices and match them with their device names.
Note
Tape devices often support different densities and compression options that enable you to put more information into a single archive. See
for information on tape density options, and how you select them by specifying different device names. tz(7)
Full backups may require that you shut down the system.
You
can back up the system while in either multiuser mode or single-user mode.
However, backups performed on file systems actively being modified may corrupt
the backup data.
The
dump
command operates by verifying
the inodes of the files you want to back up.
The inodes contain data such
as table entries and other statistics.
If you use the
dump
command to back up files in a file system, an inode is attached to each file.
If the system or user activity changes a file after the inode data is recorded,
but before the file is backed up, it may corrupt the backup.
To shut down the system, unmount a file system, and verify the integrity of a file system:
Shut down the system
by using the SysMan Menu General Tasks option, or with the
/usr/sbin/shutdown
command.
For example, to shut down the system in 5 minutes and
give users periodic warning messages, enter:
# /usr/sbin/shutdown +5 'System going down to perform backups'
See Chapter 2 for more information on shutting down the system.
Use the
umount
command with the
-a
option to unmount the file systems that you want to back up:
# /sbin/umount -a
The root file system remains mounted.
Use the
fsck
command to ensure the integrity
of the file system.
For example, use the following command to verify a file system on the c partition (the whole disk):
# /sbin/fsck -o /dev/disk/dsk0c
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.
See the
AdvFS Administration
manual 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 examine 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)dump
command.
The
dump
command can back up only a
single file system at a time, but there may be several
dump
processes simultaneously writing files to different tape devices.
The following list describes the most commonly used options to the
dump
command:
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.
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 (-dump
command writes to the standard
output.
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)
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:
To back up the root file system:
Load a tape into your tape drive.
Enter:
# dump -0u /
Remove the tape from your tape drive after completing the backup.
To back up the
/usr
file system:
Load a new tape into your tape drive.
Enter:
# dump -0u /usr
Remove the tape from your tape drive after completing the backup.
To back up the
/projects
file system:
Load a new tape into your tape drive.
Enter:
# dump -0u /projects
Remove the tape from your tape drive after completing the backup.
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 may 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, 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 may 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)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)
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
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
from a changing system.
Backup shell scripts often perform the following tasks:
Determine the dump level
Warn the system of the dump
Make a listing of tape contents
Notify the operator upon completion
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 going off line automatically 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 may 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.
See the
AdvFS Administration
manual for information
on restoring the AdvFS file system.
If you used the
vdump
command to back up a UFS file system, you can 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)9.7.1 Restoring a File System
A general procedure for restoring a file system, such as after a disk failure or other loss of data, is described here. 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:
newfsCreates a new UFS file
system.
See
newfs(8)
mountMounts the file system,
making it available for general use.
See
mount(8)
cdChanges your current working
directory.
See
cd(1)
restoreRestores archived files
from a backup media to a disk.
See
restore(8)
See the AdvFS Administration manual 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 may 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.
See
Chapter 6
for more information.
You can use the 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 also may 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. Inquire 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.
pwdLists 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.
extractRestores 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.
setmodesSets 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.
verboseToggles 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.
helpLists a summary of the interactive commands.
?Lists a summary of the interactive commands.
whatLists the tape header information.
quitQuits the interactive restore session.
xitExits 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:
Change to the
working
directory:
restore > cd working
Enter the file name at the prompt:
restore > add file1
Enter the name of the second file as follows:
restore > add file2
Extract the files as follows:
restore > extract
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
Quit the interactive session after the files are extracted:
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)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. Also, you may 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 may 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:
The disk and the root partition are not damaged but you want to replace it with a different disk, possibly a different model with larger capacity.
The disk drive on which the root partition is located is damaged and you must:
Install a new disk drive, possibly of a different type and capacity
Choose an alternate disk drive that is installed and available for use
The root (/), and possibly the
/usr
or
/var
file systems are corrupt, but
the disk drive on which they are located is fully functional.
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 for more information.
Depending on your knowledge of your system, you may not need to read all the following sections:
How you prepare for a recovery in Section 9.7.5.1
The requirements for recovery in Section 9.7.5.2
The recovery (or duplication) procedure in Section 9.7.5.3
Alternate procedures in Section 9.7.5.3
9.7.5.1 Preparing for Recovery or Duplication
Depending on how your system is set up, and your level of system knowledge, you may need the following:
A replacement root disk drive. This procedure assumes that if the original root disk is unusable, you have either installed a new replacement disk, or you have decided to use an alternate disk that is already installed in your system. Install the drive as described in the owner's manual for the drive. The operating system automatically detects the drive.
There are steps in the procedure that assist you in identifying the new or alternate drive.
Verify that your system's firmware is current. You can obtain information and download kits from the Firmware Updates web page at the following URL:
http://ftp.digital.com/pub/DEC/Alpha/firmware
(You can also go to the web site at http://www.hp.com and select the Support option to search for information.)
Information about console commands.
You use Alpha System
Reference Manual (SRM) console commands at the system console prompt (>>>) to perform some tasks.
These commands are documented in the
owner's manual for your AlphaServer system.
If you cannot find the printed document, look for a printable file on a CD-ROM supplied with the system. If the CD-ROM is unavailable, you can find the documentation at the Alpha Systems Technology web page at the following URL:
http://www.compaq.com/alphaserver/technology/index.html
The procedure instructions are typical for newer processors. If your system is older, you must see the owner's manual and Installation Guide for your version of the operating system to obtain the actual commands and procedures.
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 may 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 may
contain the
|
| Logical Storage Manager | If you are using the Logical Storage manager (LSM), see the Logical Storage Manager manual for information on recovering the root volume. |
| User Interface | This procedure requires a console login. |
| Affect 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 may need the following resources to complete the restoration of your root disk. If you 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 may need the following items:
Distribution Media for the Operating System
You use the installation shell to restore the root disk.
The installation
shell is a compact version of the operating system from which you can execute
commands, such as
mount.
The shell is packaged with the
operating system software as part of the distribution kit.
Your local site may provide a Remote Installation Service (RIS) server from which you can boot your system across the network. If RIS services are available in place of CD-ROM media, follow your site-specific procedures and see the Installation Guide.
CD-ROM Drive Name or Network Device Name
To restore the root volume, you boot your system from a CD-ROM drive or a network device. You may need to see the owner's manual for your system to find the correct commands. Typically, you determine the CD-ROM device name at the console prompt as follows:
>>> show device | grep -E 'RR|CD' dka400.4.0.5.0 DKA400 RRD47 1206
You typically determine the network device name as follows:
>>> show config | more
After you
enter the preceding command, the complete system configuration is displayed
one page at a time.
Scroll down to the section headed
Slot Option
and locate the network device.
Network devices are typically named
ew*
or
ei*, where
*
is a letter.
For example:
11 DE500-BA Network Con ewa0.0.0.0.11.0 08-00-99-1Z-67-BB
For information on booting your system from a RIS server, see the Installation Guide Advanced Topics manual. For a full discussion of the System Reference Manual (SRM) console device naming conventions, see the owner's information for your system.
Boot Device Name
Determine the default boot device name as follows:
>>> show bootdef_dev bootdef_dev dka0.0.0.5.0
In
this example the default boot device is
dka0.
Note
If you are using Fibre Channel, the name of the boot device is as you defined it during configuration of the storage devices.
If the current root device is usable and you are restoring to the same device, you use the device name later in the restore procedure. If you intend to install a new disk or use an alternate, you must specify the name of the disk. You determine the alternate by translating its b/t/l into the boot device name during the restore procedure.
Backup Media and the Restore Device
Depending on what file systems were on your original root disk, you
may need full and current backup tapes for the root (/),
/usr
and
/var
file systems.
In cases where you are duplicating (cloning) a disk, such as to increase the disk space available by using a disk with larger capacity, you can opt to back up directly from the source disk to the target disk.
Disk Label for the Target Disk
If the original drive is usable, you can choose to restore the root file system to the same drive. If the drive is damaged, you must select an alternate drive or install a new drive. The alternate or new drive must have enough storage capacity to hold the restored file systems and it must be partitioned to hold the restored file systems.
If the original root drive held custom partitions, restore the custom disk label or at least plan to select partitions that can adequately contain the restored file systems (and possibly allow for future expansion of those file systems). Depending on what data is stored on the original disk, you may need to plan for the following partitions:
The 256MB
a
partition to hold the root
(/) file system.
If the
/usr
file system is on the root
drive and you also need to restore it, you need a partition at least large
enough to contain the restored file system.
(Consider expansion requirements,
if appropriate.)
If the
/var
file system is on the root
drive and you also need to restore it, you need a partition at least large
enough to contain the restored file system unless it is included in
/usr
on the original root drive.
If primary or tertiary swap partitions were on the original root drive, you must recreate these partitions on the replacement drive.
You can restore other file systems as required, or restore them to different
devices and then remount them by updating the
/etc/fstab
file after the restoration is complete.
See
disklabel(8)
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.
Boot the system from the operating system distribution media by using one of the following methods:
Insert the distribution CD-ROM that contains the operating system version that you want to restore and boot the operating system specifying the CD-ROM reader device name that you determined previously. For example:
>>> boot dka400
Boot from your local RIS server. For example:
>>> boot ewa0
[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
Exit
to invoke
character-cell mode.
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:
The device name for the target disk.
This is important if you installed a new replacement disk.
The device
name is the entry under the
Device Name
column, such as
/dev/disk/dsk2.
Ignore the partition suffix (c).
If there is no entry for a newly installed target disk, you cannot proceed. You must shut down the system, verify the disk's physical installation, and restart the recovery procedure.
The device name for the backup device.
The device name appears in the
Device Name
column.
For example, if you are restoring the root disk from the default tape device
TLZ06
the
Device Name
column must contain a device
special file name such as
/dev/ntape/tape0.
There may be no device special file name in the
Device Name
column for the backup device, as shown in the preceding example.
In this case, go to step
4
to install the tape
device.
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.
[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:
Load the backup (dump) media into the device.
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
If the backup is good, a prompt for interactive restoration
is displayed.
Enter the
what
command to display the header
and record the information.
Create and apply a disk label by using the following information:
The partition plan that you created during recovery planning, including any swap space requirements. (See Section 9.7.5.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
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
Mount the
replacement disk on the temporary mount point
/mnt
according
to the type of file system.
For example:
# mount /dev/disk/dsk2a /mnt
Use the
vrestore
or
restore
command to restore files.
For example:
# cd /mnt # vrestore -x device
Shut down and halt the system by using the following command:
# shutdown -h now
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 may 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.
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 may
be displayed.
You can ignore the messages.
[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:
If you remove the old root disk and replace
it with a new device, use the
dsfmgr
command with the
-m
option to move the device names.
For example:
# dsfmgr -m dsk20 0
If the old root disk is still connected to the system, use
the
dsfmgr
command with the
-e
option to
exchange the device names.
For example:
# dsfmgr -e dsk20 0
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: