https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doc...

How to Backup and Restore the Solaris 10 ZFS Root Pool [ID 1020257.1] Modified 25-MAY-2011 Type HOWTO Migrated ID 254988 Status PUBLISHED

Applies to:
Solaris SPARC Operating System - Version: 10 3/05 and later [Release: 10.0 and later ] All Platforms

Goal
How to backup / restore Solaris ZFS root pool ? The following procedure can be used to backup and restore a ZFS root pool (rpool) using the tools that are provided in Solaris 10 and above. It is advised that the reader becomes comfortable with this procedure and attempts a restore before deploying this into production environments.

Solution
Pre-Requisites

1. Advisory patches At the time of writing, the reader is advised to install Kernel Feature Patch 139555-08 (SPARC(R)) or 139556-08 (x86) to address the following issue: CR #6794452 Synopsis: zfs receive cannot restore rpool Without this patch it may not be possible to restore a recursively sent root pool, ie: streams created with the -R switch to zfs send. 2. Recovery Media You should use at least the same release of Solaris 10 that you are trying to restore from, ie: if the root pool backup streams were from Solaris 10 10/08 then you must boot from at least a Solaris 10 10/08 media in order to perform the restore. This is because ZFS pools and filesystems have version numbers that can be upgraded by updating to a more recent release of Solaris 10 or by installing the kernel feature patch associated with that release, eg: Solaris 10 10/08 (SPARC) ships with kernel feature patch 137137-09 which allows zpool version 10 functionality. In order to understand a ZFS pool at version 10, the system must boot from a kernel at 137137-09 or later. As such booting from a Solaris 10 5/08 DVD would not have sufficient knowledge to restore a version 10 pool. Definitions In this procedure, it is assumed the root pool will be called 'rpool' as is the given standard during installation. It will also refer to a simple number of filesystems: rpool rpool/ROOT rpool/ROOT/s10u7 rpool/export rpool/export/home This may need to be adjusted depending upon the filesystems that were created as part of the Solaris installation. Furthermore it does not take into account any Live Upgrade created boot environments or cloned filesystems. The decision has been made to send each filesystem individually, where possible in case just one filesystem needs to be restored from a stream file. Backing up a Solaris ZFS root pool Take a copy of the properties that are set in the rpool and all filesystems, plus volumes that are associated with it: # # # # # # # # zpool get all rpool zfs get all rpool zfs get all rpool/ROOT zfs get all rpool/ROOT/s10u7 zfs get all rpool/export zfs get all rpool/export/home zfs get all rpool/dump zfs get all rpool/swap

(repeat for all ZFS filesystems) Save this data for reference in case it is required later on. Now snapshot the rpool with a suitable snapshot name:

1 of 3

27/5/2011 12:10 PM

By default a zvol will be created using an 8KB block size.home. # zpool create -fo altroot=/var/tmp/rpool -o cachefile=/etc/zfs/zpool.export. To do this run the following zpool commands: # zpool set bootfs=rpool/ROOT/s10u7 rpool # Makes rpool/ROOT/s10u7 the bootable dataset Set the failmode property of the rpool to continue. not an entire disk (USE the cXtYdZs syntax and NOT cXtYdZ which would use the entire disk and EFI label) In this example. made up from zvol's. Change the controller and target numbers accordingly. their snapshots do not need to be included in the backup. so they should be destroyed thus: # zfs destroy rpool/swap@backup # zfs destroy rpool/dump@backup Then for each filesystem. it may be necessary to tell ZFS to use a temporary location for the mountpoint.dump -v rpool/export@backup > /backup/rpool. Once the dump files are available. a boot block must be installed.s10u7.export.dump /backup/rpool. so it's important to set this correctly: 2 of 3 27/5/2011 12:10 PM . where slice 0 is using the entire capacity of the disk. then a possible location would be /dev/rmt/0n. This differs to "data" zfs pools which use wait by default. restore the filesystems that make up the root pool. Pre-Requisites A root pool at the time of writing must: Live on a disk with an SMI disk label Be composed of a single slice. In this example /backup is an NFS mounted filesystem from a suitably capacious server: # # # # # zfs send zfs send zfs send zfs send zfs send -v rpool@backup > /backup/rpool.dump -v rpool/export/home@backup > /backup/rpool. Restoring a Solaris ZFS root pool If it is necessary to rebuild/restore a root pool. so pick one of the following according to the platform being restored: # installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c3t1d0s0 # installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t1d0s0 (SPARC) (x86) Once the boot block has been installed. Depending upon whether the booted root filesystem is writable.ROOT. however in this example the dump files are made available by mounting up the backup filesystem from an NFS server.com/CSP/main/article?cmd=show&type=NOT&doc.ROOT.oracle. In order to restore the root pool. For the swap device we must ensure that the blocksize matches that of the pagesize for the system. To recreate the dump and swap volumes run the following commands. It is important to restore these in the correct hierarchical order: # # # # # zfs receive -Fd zfs receive -Fd zfs receive -Fd zfs receive -Fd zfs receive -Fd rpool < rpool < rpool < rpool < rpool < /backup/rpool. selecting the swap zvol for the appropriate platform: # zfs create -V 1g -o volblocksize=128k rpool/dump # zfs create -V 1g -o volblocksize=8k rpool/swap # zfs create -V 1g -o volblocksize=4k rpool/swap (SPARC) (x86) (adjust the size of the dump and swap volumes according to the configuration of the system being restored).ROOT. it is then necessary to set the bootable dataset/filesystem within this rpool. rpool/export/home as well as rpool/dump and rpool/swap (volumes). disk c3t1d0s0 contains an SMI label.export. # zfs snapshot -r rpool@backup This will create a recursive snapshot of all descendants. locate the known good copies of the zfs streams that were created in the Backing Up section of this document and make sure these are readily available.dump These dump files can then be archived onto non-volatile storage for safe keeping. Now to make the disk ZFS bootable.dump /backup/rpool. but remember an rpool will also have a dump and swap device.home.dump -vR rpool/ROOT/s10u7@backup > /backup/rpool.s10u7. If these exist on tape. send the data to a backup file/location.dump /backup/rpool.export..dump This will restore the filesystems. Make sure that there is sufficient capacity in your backup location as "zfs send" does not understand when the destination becomes full (eg: a multi-volume tape). however care needs to be taken when creating the dump and swap volumes.dump /backup/rpool.cache -m legacy rpool c3t1d0s0 Ensure the dump files are available for reading. Because swap and dump are zvols (volumes).ROOT.dump -v rpool/ROOT@backup > /backup/rpool. eg: magnetic tape. On a SPARC(R) based system this is typically 8KB and for x86/x64 systems this is 4KB.. If Kernel Feature Patch 139555/139556-08 is installed you can use the flags '-Fdu' to ensure that the filesystems are not mounted.https://support. including rpool/export. The dump device needs to be created with a blocksize of 128Kb as we want to maximise the throughput when saving a crash dump. first boot from a Solaris 10 DVD or network (jumpstart) into single user mode.

ZFS. All rights reserved. snapshot To discuss this information further with Oracle experts and industry peers. # zfs set canmount=noauto rpool/ROOT/s10u7 # .com/CSP/main/article?cmd=show&type=NOT&doc. root pool.. we encourage you to review. Related Products Sun Microsystems > Operating Systems > Solaris Operating System > Solaris SPARC Operating System Keywords RESTORE. set it appropriately Temporarily disable the canmount property for the following filesystems. RPOOL..https://support. if not set: # zfs get canmount rpool/ROOT/s10u7 # Check that canmount is set to noauto and if not . ZPOOL Back to top Copyright (c) 2007. 2010. # zpool set failmode=continue rpool Check to see if canmount is set to noauto. zfs.... ROOT POOL.oracle. Legal Notices and Terms of Use | Privacy Statement 3 of 3 27/5/2011 12:10 PM . rpool. restore. Oracle. join or start a discussion in the My Oracle Support Community.. to prevent these from mounting when it comes to setting the mountpoint property: # zfs set canmount=noauto rpool # zfs set canmount=noauto rpool/export Set the mountpoint properties for the various filesystems: # zfs set mountpoint=/ rpool/ROOT/s10u7 # zfs set mountpoint=/rpool rpool # zfs set backup. Oracle Solaris System Administration Community.