System Administration Guide: Devices and File Systems

ProcedureHow to Restore a UFS root (/) and /usr File System

  1. Become superuser or assume an equivalent role.

  2. Add a new system disk to the system where the root (/) and /usr file systems will be restored.

    For a detailed description about adding a system disk, refer to SPARC: How to Connect a System Disk and Boot or x86: How to Connect a System Disk.

  3. Mount the new file system on a temporary mount point.


    # mount /dev/dsk/device-name /mnt
    
  4. Change to the /mnt directory.


    # cd /mnt
    
  5. (Optional) Write-protect the tapes for safety.

  6. Create the links for the tape device.


    # tapes
    
  7. Restore the root (/) file system.


    # ufsrestore rvf /dev/rmt/n
    

    The dump level 0 tape is restored.

  8. Remove the tape and load the next level tape in the drive.

    Always restore tapes starting with dump level 0 and continuing from the lowest to highest dump level.

  9. Continue restoring as needed.


    # ufsrestore rvf /dev/rmt/n
    

    The next level tape is restored.

  10. Repeat Step 8 and Step 9 for each additional tape.

  11. Verify that the file system has been restored.


    # ls
    
  12. Remove the restoresymtable file.


    # rm restoresymtable
    

    The restoresymtable file that is created and used by the ufsrestore command to check-point the restore is removed.

  13. Change to the root (/) directory.


    # cd /
    
  14. Unmount the newly created file system.


    # umount /mnt
    
  15. Check the new file system.


    # fsck /dev/rdsk/device-name
    

    The restored file system is checked for consistency.

  16. Create the boot blocks on the root partition.

    On a SPARC system:


    # installboot  /usr/platform/`uname-i`/lib/fs/ufs/bootblk 
    /dev/rdsk/device-name
    

    For more information, see the installboot(1M) man page.

    For an example of using the installboot command on a SPARC based system, see Example 26–6.

    On an x86 system:


    # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/cwtxdysz
    

    For more information, see installgrub(1M).

    For an example of using the installgrub command on an x86 based system, see Example 26–7.

  17. Insert a new tape in the tape drive.

  18. Back up the new file system.


    # ufsdump 0uf /dev/rmt/n /dev/rdsk/device-name
    

    A dump level 0 backup is performed. Always immediately do a full backup of a newly created file system because the ufsrestore command repositions the files and changes the inode allocation.

  19. Repeat steps 5 through 16 for the /usr file system, if necessary.

  20. Reboot the system.


    # init 6
    

    The system is rebooted.


Example 26–6 SPARC: Restoring a UFS root (/) File System

This example shows how to restore the root (/) file system on a SPARC system. This example assumes that the system is booted from a local Solaris DVD or from the network.


# mount /dev/dsk/c0t3d0s0 /mnt
# cd /mnt
# tapes
# ufsrestore rvf /dev/rmt/0
# ls
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/rdsk/c0t3d0s0
# installboot /usr/platform/sun4u/lib/fs/ufs/bootblk
/dev/rdsk/c0t3d0s0
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0
# init 6


Example 26–7 x86: Restoring a UFS root (/) File System

This example shows how to restore the root (/) file system on an x86 system. This example assumes that the system is booted from a GRUB failsafe boot session, local Solaris DVD, or from the network.


# mount /dev/dsk/c0t3d0s0 /mnt
# cd /mnt
# tapes
# ufsrestore rvf /dev/rmt/0
# ls
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/rdsk/c0t3d0s0
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t3d0s0
stage1 written to partition 0 sector 0 (abs 2016)
stage2 written to to partition 0, 227 sectors starting 50 (abs 2066)
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0
# init 6