• No results found

Performing system recovery of a RedHat or CentOS Linux client

Before you begin

Perform the steps in Reconstructing the partition table on page 124 and Preparing the target recovery client on page 125.

Procedure

1. Start the recovery target client from the install media (first CD/DVD):

l On Red Hat or CentOS 4 or 5, type linux rescue at the command prompt. l On Red Hat or CentOS 6.0 or later, select Rescue installed system.

2. Follow the onscreen instructions.

Be sure to enable networking by providing IP address, network mask, default gateway, and DNS server values when prompted. You can use a temporary hostname and IP, or the original information from the machine that you are restoring.

3. Allow the installer to search for installations and mount the /mnt/sysimage file system as read-write.

This is the target of the restore, and is also referred to as the recovery destination disk.

Note

You cannot restore the root file system directly to /mnt/sysimage because there is currently no method to restrict the restore operation to only the local partition without traversing network mount points. Therefore, a restore directly to /mnt/sysimage

might copy files from all the partitions, and /mnt/sysimage could fill up before all required files were restored.

4. Ensure that the following directories are all present in the LD_LIBRARY_PATH

system variable: l /lib l /lib64 l /usr/lib l /usr/lib64 l /mnt/sysimage/lib l /mnt/sysimage/lib64 l /mnt/sysimage/usr/local/avamar/lib

If any directories are missing from LD_LIBRARY_PATH, add them.

5. Create a temporary /tmp/avtar.cmd flag file with a UNIX text editor. For example:

cd /tmp vi avtar.cmd

--bindir=/mnt/sysimage/usr/local/avamar/bin --vardir=/mnt/sysimage/usr/local/avamar/var --sysdir=/mnt/sysimage/usr/local/avamar/etc --server=Avamar_server --account=/domain/client --id=username --ap=password --target=. where:

l Avamar_server is the Avamar server IP address or fully qualified hostname as

defined in DNS.

l /domain/client is the full location of the original Linux client on the Avamar server. l username and password are the login credentials for a user account with sufficient

role and privileges to perform the restore.

6. Restore most of the directories that originally existed under root (/):

NOTICE

Do not restore files located on file systems other than the root file system at this time. These directories and files are restored later in this procedure.

a. Create a temporary restore directory under the client /mnt/sysimage directory and change directory to it by typing commands similar to the following examples:

mkdir /mnt/sysimage/restore cd /mnt/sysimage/restore

b. Restore the contents of the root file system from the backup by typing the following command on a single command line:

/mnt/sysimage/usr/local/avamar/bin/avtar.bin -x --flagfile=/tmp/ avtar.cmd --labelnumber=n [--exclude=./boot --exclude=./home] /

where n is the label number of the backup to use for the system state recovery. Use --exclude=path options to exclude paths that were identified as separate mount points. These directories and files are separately restored later in this procedure.

The first two --exclude options in the previous command are included as an example. You must replace the values with options appropriate to the system that you are restoring. You must specify exclude options relative to the root of the original backup. For example, --exclude=./boot instead of --exclude=/boot.

c. For each directory that was restored, delete the original directory from /mnt/ sysimage, and move the restored directory from the /mnt/sysimage/ restore directory to /mnt/sysimage by typing commands similar to the following examples:

rm -rf /mnt/sysimage/etc

mv /mnt/sysimage/restore/etc /mnt/sysimage/etc

d. Repeat the previous step for each directory that successfully restored to /mnt/ sysimage/restore.

7. Restore individual files in the root (/) directory:

a. Change directory to /mnt/sysimage/restore by typing the following command:

cd /mnt/sysimage/restore

b. Restore the individual files in the root (/) directory by typing the following commands:

mv ./* /mnt/sysimage mv ./.* /mnt/sysimage

8. Restore other mount points:

a. Check that file systems are mounted as expected by typing df -h on the

command line.

b. Compare the output to the expected set of mounted file systems. If there are discrepancies, mount the devices onto the appropriate mount points. c. Change directory to each mount point by typing a command similar to the

following example:

cd /mnt/sysimage/home

d. Create a temporary restore directory, then change directory to it by typing commands similar to the following examples:

mkdir ./restore cd ./restore

e. Restore the contents of the mount point by typing the following command:

/mnt/sysimage/usr/local/avamar/bin/avtar.bin -x --flagfile=/tmp/ avtar.cmd --labelnumber=n /home

where n is the label number of the backup to use for the restore, and /home is an example mount point.

f. Return to the mount point directory, and delete all files except for the restore directory by typing commands similar to the following examples:

alias ls=/usr/bin/ls

cd /mnt/sysimage/home; rm -rf `ls --hide restore` rm -rf ./.*

g. Change directory to the restore directory, then move the contents into the appropriate place in the mount point by typing the following command:

cd ./restore;mv `ls -A ./` ..

h. Remove the restore directory by typing the following commands:

cd ..

rmdir restore

i. Repeat steps d through i for each remaining mount point. 9. Perform final system checks:

a. Inspect /mnt/sysimage/etc/fstab, and verify that there are valid statements for each file system to be mounted on the new system.

There are three ways that devices might be listed in the fstab file: device path, volume label, and Universally Unique Identifier (UUID).

You can determine this information about the file systems by typing /mnt/

sysimage/lib/udev/vol_id device_path, where device_path is the /dev path to the device.

If that program is not present on the system, type /mnt/sysimage/sbin/blkid device_path.

If you had to manually re-create partitions during the minimal system install, the device UUIDs might have changed. Update the device UUIDs in /mnt/

sysimage/etc/fstab. If some volumes are missing expected labels, set the label by typing /mnt/sysimage/sbin/e2label device_path label.

b. Re-examine the fstab carefully.

The restored system does not boot properly if the fstab entries do not exactly match the storage device configuration, and the rescue system on the install media has difficulty discovering which file systems to mount to /mnt/sysimage.

Note

If you saved a reference copy of the fstab file when you were preparing the target client for recovery, then you may be able to find the disk information in that file. For systems with few manual modifications to the restored fstab file, it might be possible to use the reference fstab file instead of the restored copy of the file. c. Verify that no more files are present in /mnt/sysimage/restore by typing the

following command:

ls -al /mnt/sysimage/restore

d. If the directory is empty, remove it by typing the following command:

rmdir /mnt/sysimage/restore

e. If the command fails because the directory is not empty, then there might be directories that you failed to move in when you restored most of the directories in root (/). If this is the case, then move the directories to the proper restore

locations.

10.Exit the command shell and reboot the system by typing exit.

If you are rebooting a Red Hat or CentOS 6 system, a menu appears. 11.Select reboot, then OK and press Enter.

The system restarts.

12.Eject the install media and boot normally. 13.Confirm correct client operation.