Solaris ZFS Administration Guide

Procedure How to Recreate a ZFS Root Pool and Restore Root Pool Snapshots

In this scenario, assume the following conditions:

All steps below are performed on the local system.

  1. Boot from CD/DVD or the network.

    On a SPARC based system, select one of the following boot methods:


    ok boot net -s
    ok boot cdrom -s
    

    If you don't use -s option, you'll need to exit the installation program.

    On an x86 based system, select the option for booting from the DVD or the network. Then, exit the installation program.

  2. Mount the remote snapshot dataset.

    For example:


    # mount -F nfs remote-system:/rpool/snaps /mnt
    

    If your network services are not configured, you might need to specify the remote-system's IP address.

  3. If the root pool disk is replaced and does not contain a disk label that is usable by ZFS, you will have to relabel the disk.

    For more information about relabeling the disk, go to the following site:

    http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide

  4. Recreate the root pool.

    For example:


    # zpool create -f -o failmode=continue -R /a -m legacy -o cachefile=/etc/zfs/zpool.cache mpool c1t0d0s0
    
  5. Restore the root pool snapshots.

    This step might take some time. For example:


    # cat /mnt/mpool.0311 | zfs receive -Fdu mpool
    

    Using the -u option means that the restored archive is not mounted when the zfs receive operation completes.

  6. (Optional) If you want to modify something in the BE, you will need to explicitly mount them like this:

    1. Mount the BE components. For example:


      # zfs mount mpool/ROOT/zfsnv109BE
      
    2. Mount everything in the pool that is not part of a BE. For example:


      # zfs mount -a mpool
      

    Other BEs are not mounted since they have canmount=noauto, which suppresses mounting when the zfs mount -a operation is done.

  7. Verify that the root pool datasets are restored.

    For example:


    # zfs list
    NAME                               USED  AVAIL  REFER  MOUNTPOINT
    mpool                              9.98G  41.2G  22.5K  /mpool
    mpool@0311                             0      -  22.5K  -
    mpool/ROOT                         7.48G  41.2G    19K  /mpool/ROOT
    mpool/ROOT@0311                        0      -    19K  -
    mpool/ROOT/zfsnv1092BE               85K  41.2G  7.48G  /tmp/.alt.luupdall.2934
    mpool/ROOT/zfsnv1092BE@0311            0      -  7.48G  -
    mpool/ROOT/zfsnv109BE              7.48G  41.2G  7.45G  /
    mpool/ROOT/zfsnv109BE@zfsnv1092BE  28.7M      -  7.48G  -
    mpool/ROOT/zfsnv109BE@0311           58K      -  7.45G  -
    mpool/dump                         2.00G  41.2G  2.00G  -
    mpool/dump@0311                        0      -  2.00G  -
    mpool/swap                          517M  41.7G    16K  -
    mpool/swap@0311                        0      -    16K  -
  8. Set the bootfs property on the root pool BE.

    For example:


    # zpool set bootfs=mpool/ROOT/zfsnv109BE mpool
    
  9. Install the boot blocks on the new disk.

    On a SPARC based system:


    # installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c1t5d0s0
    

    On an x86 based system:


    # installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t5d0s0
    
  10. Reboot the system.


    # init 6