Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Friday, March 14, 2008

Recovery from rm * from the Root (/) Directory in AIX 4 and 5

This document describes how to recover after running the rm command in the root directory and applies to AIX Versions 4 and 5.

Summary of the recovery procedure

Deleting the files in the root directory will delete the following links:
bin -> /usr/bin
lib -> /usr/lib
u -> /home
unix -> /usr/lib/boot/unix_up ( or unix_mp )
In the root directory, removing the bin directory link disables the korn shell needed for login. The recovery will boot in service mode and rebuild the links.

NOTE: The following procedure describes how to boot the machine into maintenance mode, access the rootvg volume group and start a shell prior to mounting the file systems.
1. For booting the system into Service mode, please refer to Kernel fax, "Booting in Service Mode" for specific machine type.

2. With bootable media of the same version and level as the system, boot the system.
The bootable media can be any one of the following:
o Bootable CD-ROM
o Bootable Install Tape
Follow the prompts to the Welcome to Base OS menu.

3. Choose Start Maintenance Mode for System Recovery (Option 3).
The next screen prompts the Maintenance menu.
a. Choose Access a Root Volume Group (Option 1).
b. Choose 0 continue and Select Volume Group by number.
At this stage the console should display information about rootvg and also display a menu with two options.
c. Choose Access this volume group and start a shell before mounting the file systems (Option
NOTE: If there are errors from the preceding option, do not continue with the rest of this procedure. Correct the problem causing the error. If you need assistance in correcting the problem causing the error, contact one of the following:
o local branch office
o your point of sale
o your AIX support center
If no errors occur, proceed with the following steps.

4. Mount the root file system. Enter:

5. fsck -y /dev/hd4
NOTE: When running the preceding command with -y, yes will be answered automatically.
mount /dev/hd4 /mnt

6. Rebuild the missing links. Enter:
cd /mntln -s /usr/bin binln -s /usr/lib/boot/unix_up unix OR ln -s /usr/lib/boot/unix_mp unixln -s /usr/lib libln -s /home u

7. Enter:
cd /
umount /dev/hd4
reboot the server
8. This should allow the machine to reboot in normal mode so logging in is possible. Depending on what else was in the root directory, files may have to be restored from a backup tape at this point.

No comments: