cropped-UnixEd-Blog-Header-2-2.jpg

Recovering Root (/) on an x86-Based Solaris 10 System

This procedure describes how to recover the root file system on an x86-based Solaris 10 system from a ufsdump recovery tape (or file).

1. Replace and partition the disk if it has failed.
    Because the system cannot be booted from the boot disk, boot from the DVD or CD-ROM.

2. The system begins its boot process from the Solaris miniroot on DVD (or CD-ROM). The following list of boot choices is displayed:

  1. Solaris Interactive (default)
  2. Custom JumpStart
  3. Solaris Interactive Text (Desktop Session)
  4. Solaris Interactive Text (Console Session)
  5. Apply driver updates
  6. Single user shell
    Enter the number of your choice:

3. Select boot choice 6, the single user shell. If an instance of Solaris is found on the disk, the system asks if you want to mount it on /a.  Answer n to avoid mounting an existing root file system.

4. Re-create the failed file system by issuing the newfs command:
   # newfs /dev/rdsk/<disk-partition-name>
Where:
<disk-partition-name> is the name of the raw disk partition that contains the corrupted root file system.

5. Check the new file system by using fsck:
   # fsck /dev/rdsk/<disk-partiton-name>

6. Mount the new file system on a temporary mount point:
   # mount /dev/dsk/<disk-partition-name> /mnt

7. Change to the /mnt directory:
   # cd /mnt

8. If using a tape, write-protect the tapes so that you don’t accidentally overwrite them.

9. Load the tape and issue the following command:
# ufsrestore rf /dev/rmt/0

The entire contents of the tape are restored to the file system. All permissions, ownerships, and dates remain as they were when the last incremental tape was created.

10. Verify that the file system is restored:
   # ls

11. Remove the restoresymtable file that is created and used by ufsrestore to checkpoint the restoration:
   # rm restoresymtable

12. Install the GRUB stage1 and stage2 programs on the Solaris partition. The installgrub command installs the GRUB stage1 program in sector 0 and the GRUB stage2 program beginning at sector 50. These sectors are within the reserved first cylinder  f the partition. Depending on the nature of the damage, they may not require reinstallation.

To install the stage1 and stage2 programs found in the miniroot from the Solaris DVD (or CDROM), use the following command:
   # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/<disk-partition-name>

13. Change to the root (/) directory:
   # cd /

14. Unmount the newly created file system:
   # umount /mnt

 15. Check the new file system with fsck:
   # fsck /dev/rdsk/<disk-partition-name>
The restored file system is checked for consistency.

 16. Perform a full backup of the file system:
#
ufsdump ouf /dev/rmt/0 dev/rdsk/<disk-partition-name>

Note: You should always create a new backup of the newly created file system.  ufsrestore re-positions the files and changes the inode allocation.

If you have separate filesystems for /usr, /var, or /opt- repeat the steps (except for step 12)  for each of the filesystems.

17. Reboot the system, but first eject the DVD (or CD-ROM) to prevent the system from booting to it again:
    # init 6