#!/bin/ksh -p # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License, Version 1.0 only # (the "License"). You may not use this file except in compliance # with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # zfs-replicate # # Replicate a filesystem and its associated snapshots from one pool to another. # Takes care of handling incremental snapshots, stopping affected services, # unmounting the source, creating a final migration snapshot, migrating that # one, re-mounting the new filesystem onto the old mountpoint, restarting the # affected services, pattern matching to select snapshots, remote replication # etc. # # # Comments, suggestios, bugreports please to: # Constantin Gonzalez # # Version: 0.7, 20080813, Brushed up code, comments here and there. # Version: 0.6, 20080813, Applied Mike Hallock's remote patch. # Version: 0.5, 20080813, Applied Mike Hallock's pattern patch. # Version: 0.4, 20070816, More cleanups to make it blog-ready. # Version: 0.3, 20070421, Code cleanups. # Version: 0.2, 20070409, "Works on my system" certified. # Version: 0.1, 20070327, Initial experimental hack. # # Acknowledgements: # Thanks to Mike Hallock of uiuc.edu for the pattern and remote patches. # Thanks to Tim Foster for lots of good feedback. Visit blogs.sun.com/timf # Thanks to Chris Gerhard for a similar script. Visit blogs.sun.com/chrisg # # Default values option_n=0 option_F="" option_s=0 option_m=0 option_v=0 option_p="." services="" torestart="" source="" sourcefs="" sourcesnap="" destination="" DCMD="/usr/bin/date" LZFS="/usr/sbin/zfs" RZFS="/usr/sbin/zfs" # # Print out usage information # usage() { cat <