Showing posts with label restore root fs. Show all posts
Showing posts with label restore root fs. Show all posts

Tuesday, 17 February 2009

Restoring the root filesystem on Solaris

Restoring theroot (/) File System

To restore the / (root) file system, boot from the Solaris CD-ROM and then run ufsrestore.

If / (root), /usr, or the /var file system is unusable because of some type of corruption the system will not boot.

The following procedure demonstrates how to restore the / (root) file system which is assumed to be on boot disk c0t0d0s0.

1. Insert the Solaris 8 Software CD 1, and boot the CD-ROM with the single-user mode option.

ok boot cdrom -s

2. Create the new file system structure.

# newfs /dev/rdsk/c0t0d0s0

3. Mount the file system to an empty mount point directory, /a and change to that directory.

# mount /dev/dsk/c0t0d0s0 /a
# cd /a

4. Restore the / (root) file system from its backup tape.

# ufsrestore rf /dev/rmt/0

Note – Remember to always restore a file system starting with the level 0 backup tape and continuing with the next lowest level tape up through the highest level tape.

5. Remove the restoresymtable file.

# rm restoresymtable

6. Install the bootblk in sectors 1–15 of the boot disk. Change to the directory containing the bootblk, and run the installboot command.

# cd /usr/platform/`uname -m`/lib/fs/ufs
# installboot bootblk /dev/rdsk/c0t0d0s0

7. Unmount the new file system.

# cd /
# umount /a

8. Use the fsck command to check the restored file system.

# fsck /dev/rdsk/c0t0d0s0

9. Reboot the system.

# init 6

10. Perform a full backup of the file system. For example:

# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s0

Note – Always back up the newly created file system, as ufsrestore repositions the files and changes the inode allocation.

Restoring the /usr and /var File Systems

To restore the /usr and /var file systems repeat the steps described above, except step 6. This step is required only when restoring the (/) root file system.

To restore a regular file system, (for example, /export/home, or /opt) back to disk, repeat the steps described above, except steps 1, 6, and 9.

Example

# newfs /dev/rdsk/c#t#d#s#
# mount /dev/dsk/c#t#d#s# /mnt
# cd /mnt
# ufsrestore rf /dev/rmt/#
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/rdsk/c#t#d#s#
# ufsdump 0uf /dev/rmt/# /dev/rdsk/c#t#d#s#

courtesy of http://www.kobhi.com/solaris/backup_recovery/solaris_backup_root_restore.htm