A mirrored ZFS storage pool can be quickly cloned as a backup pool by using the zpool split command.
You can use the zpool split command to detach one or more disks from a mirrored ZFS storage pool to create a new pool with the detached disk or disks. The new pool will have identical contents to the original mirrored ZFS storage pool.
By default, a zpool split operation on a mirrored pool detaches the last disk for the newly created pool. After the split operation, you then import the new pool. For example:
# zpool status tank pool: tank state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c1t0d0 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 errors: No known data errors # zpool split tank tank2 # zpool import tank2 # zpool status tank tank2 pool: tank state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 c1t0d0 ONLINE 0 0 0 errors: No known data errors pool: tank2 state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tank2 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 errors: No known data errors
You can identify which disk should be used for the newly created pool by specifying it with the zpool split command. For example:
# zpool split tank tank2 c1t0d0
Before the actual split operation occurs, data in memory is flushed to the mirrored disks. After the data is flushed, the disk is detached from the pool and given a new pool GUID. A new pool GUID is generated so that the pool can be imported on the same system on which it was split.
If the pool to be split has non-default file system mount points, and the new pool is created on the same system, then you must use the zpool split –R option to identify an alternate root directory for the new pool so that any existing mount points do not conflict. For example:
# zpool split -R /tank2 tank tank2
If you don't use the zpool split –R option, and you can see that mount points conflict when you attempt to import the new pool, import the new pool with the –R option. If the new pool is created on a different system, then specifying an alternate root directory is not necessary unless mount point conflicts occur.
Review the following considerations before using the zpool split feature:
This feature is not available for a RAID-Z configuration or a non-redundant pool of multiple disks.
Data and application operations should be quiesced before attempting a zpool split operation.
A pool cannot be split if resilvering is in process.
Splitting a mirrored pool is optimal when the pool contains two to three disks, where the last disk in the original pool is used for the newly created pool. Then, you can use the zpool attach command to re-create your original mirrored storage pool or convert your newly created pool into a mirrored storage pool. No method currently exists to create a new mirrored pool from an existing mirrored pool in one zpool split operation because the new (split) pool is non-redundant
If the existing pool is a three-way mirror, then the new pool will contain one disk after the split operation. If the existing pool is a two-way mirror of two disks, then the outcome is two non-redundant pools of two disks. You must attach two additional disks to convert the non-redundant pools to mirrored pools.
A good way to keep your data redundant during a split operation is to split a mirrored storage pool that contains three disks so that the original pool contains two mirrored disks after the split operation.
Confirm that your hardware is configured correctly before splitting a mirrored pool. For related information about confirming your hardware's cache flush settings, see General System Practices.
In the following example, a mirrored storage pool called mothership, with three disks is split. The two resulting pools are the mirrored pool mothership, with two disks and the new pool, luna, with one disk. Each pool has identical content.
The pool luna could be imported on another system for backup purposes. After the backup is complete, the pool luna could be destroyed and the disk reattached to the mothership. Then, the process could be repeated.
# zpool status mothership pool: mothership state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM mothership ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c0t5000C500335F95E3d0 ONLINE 0 0 0 c0t5000C500335BD117d0 ONLINE 0 0 0 c0t5000C500335F907Fd0 ONLINE 0 0 0 errors: No known data errors # zpool split mothership luna # zpool import luna # zpool status mothership luna pool: luna state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM luna ONLINE 0 0 0 c0t5000C500335F907Fd0 ONLINE 0 0 0 errors: No known data errors pool: mothership state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM mothership ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c0t5000C500335F95E3d0 ONLINE 0 0 0 c0t5000C500335BD117d0 ONLINE 0 0 0 errors: No known data errors