• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

How to recover the OS using ZFS snapshot

July 11, 2012 By Cloud_Devops 2 Comments

Many of them are very  familiar with Solaris OS recovery on UFS root filesystem.Here we are going to see about how to recover Solaris 10 on ZFS root filesystem. Here is assumptions is we are periodically keeping root FS zfs snapshot in NAS location using zfs send feature.This can be achieved easily using small “zfs send” command. 

Note:This procedure will be applicable only if you are using zfs for root and sending the rpool snapshot periodically to NAS location.

First we will see how to recover SPARC based machines.First boot the system via network if you are already have jump-start server or boot if from OS DVD.

SPARC Based Systems:
 1) Boot system into single user mode:
ok boot net -s
or
ok boot cdrom -s

2) Mount the NFS share with the snapshots:

# mount -F nfs nfs-server:/path_to_directory /mnt

3) Recreate the root pool:

# zpool create -f -o failmode=continue -R /a -o cachefile=/etc/zfs/zpool.cache rpool mirror c1t0d0s0 c1t1d0s0
# zpool set autoreplace=on rpool

4) Restore the snapshots:

# cd /mnt
# zfs receive -Fd rpool < hostname.rpool.20120711.zfs
# zfs receive -Fd rpool < hostname.dataset.20120711.zfs

5) Verify snapshot was restored:

# zfs list

6) Create swap and dump volumes:

# zfs create -V 8g rpool/dump
# zfs set refreservation=none rpool/dump
# zfs set checksum=off rpool/dump
# zfs create -V 8g rpool/swap

7) Set pool bootfs property:

# zpool set bootfs=rpool/ROOT/dataset rpool
# zfs set canmount=noauto rpool/ROOT/dataset
# zfs set mountpoint=/ rpool/ROOT/dataset
# zfs set mountpoint=/rpool rpool

8) Install ZFS bootblk:

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

9) Reboot the system:

# umount /mnt
# init 6

Upon bootup, the system may appear to hang after printing the hostname.  The system

is creating the rpool/dump device, which can take several minutes.
10) Delete snapshot:

# zfs list |grep @
# zfs destroy -r rpool@XXXXXXXXX
 X86 Based systems
1.Boot system into single user mode:
This can be done by selecting from grub menu-Failsafe mode or boot from one of the NIC if have jumpstart start server.

2.Mount the NFS share with the snapshots:
May need to configure interface networking before mounting
 # mount -F nfs nfs-server:/path_to_directory /mnt

3.Recreate the root pool:
# zpool create -f -o failmode=continue -R /a -o cachefile=/etc/zfs/zpool.cache rpool  mirror c1t0d0s0 c1t1d0s0
# zpool set autoreplace=on rpool
4.Restore the snapshots:
 # cd /mnt
# zfs receive -Fd rpool < hostname.rpool.20120711.zfs
# zfs receive -Fd rpool < hostname.dataset.20120711.zfs

5.Verify snapshot was restored:

# zfs list

6.Create swap and dump volumes:

 # zfs create -V 8g rpool/dump
# zfs set refreservation=none rpool/dump
# zfs set checksum=off rpool/dump
# zfs create -V 8g rpool/swap

7.Set pool bootfs property:

 # zpool set bootfs=rpool/ROOT/dataset rpool
# zfs set canmount=noauto rpool/ROOT/dataset
# zfs set mountpoint=/ rpool/ROOT/dataset
# zfs set mountpoint=/rpool rpool

8.Install ZFS bootblk:

 # installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t0d0s0
# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0

9.Reboot the system:

 # umount /mnt
# init 6

Upon bootup, the system may appear to hang after printing the hostname.  The system is creating the rpool/dump device, which can take several minutes.


10.Delete snapshot:

# zfs list |grep @
# zfs destroy -r rpool@20120711

Thank you for reading this article.

Please leave a comment if you have any doubt ,i will get back to you as soon as possible.

Filed Under: Solaris 10, ZFS

Reader Interactions

Comments

  1. praveen says

    March 10, 2017 at 8:50 am

    after booting the server in single usermode, how come we can mount the snapshot through nfs?.. I meant in single user mode there won’t be NFS support right?

    Reply
    • Venkat says

      March 22, 2017 at 10:28 pm

      @Praveen – you needs to enable the minimal network in single user mode to make the NAS IP connectivity. Then you can able to connect and mount the NAS share on single user mode.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version