From owner-freebsd-fs@FreeBSD.ORG Fri Dec 2 07:35:05 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBF7E1065670 for ; Fri, 2 Dec 2011 07:35:05 +0000 (UTC) (envelope-from peter.maloney@brockmann-consult.de) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5DDAD8FC1B for ; Fri, 2 Dec 2011 07:35:05 +0000 (UTC) Received: from [10.3.0.26] ([141.4.215.32]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MXWgY-1RKhkH1XnS-00WVoK; Fri, 02 Dec 2011 08:35:03 +0100 Message-ID: <4ED87FA6.6010408@brockmann-consult.de> Date: Fri, 02 Dec 2011 08:35:02 +0100 From: Peter Maloney User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: Zaphod Beeblebrox References: <4ED77B09.1090709@brockmann-consult.de> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------060108000304030705050005" X-Provags-ID: V02:K0:ExgzHgEcOX9h2vJAO57Hj79+GOScYfVvDOzjY3rC+BC /VlLKM8Sj0S6iYXCZbeD73pYU008oxLd/EaTBfdPUBkdfw2Mhq 5cHtzNu9NOX0G+Z/dgA4qdsTWB6GgrWerVf7Ww43AxKOHNGB1I 3K1QCRa7zUi3qlXdvcR49rGfFP0/ah/WhZfiW9JdBqDQOqrC+c miWc5wgJdWU2m2v+tD7+LvgkeN/7o6gpgsGwyy+r5u5Uy13QNc WKfzObinMDM4kKHyX4clcEAYhBFEr3jEQoefT2HF8pAGIIIifB UADOO8+8/cUld5hBGUsxcs4Z0zu+CdO+q9xSRWOYTjrAgyQyzt kL0/iVajkmHzVPiMHl8t6nu9jzbKSp6k1rzYufqyO X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-fs@freebsd.org Subject: Re: ZFS dedup and replication X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2011 07:35:05 -0000 This is a multi-part message in MIME format. --------------060108000304030705050005 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 12/01/2011 10:11 PM, Zaphod Beeblebrox wrote: > On Thu, Dec 1, 2011 at 11:42 AM, krad wrote: >> On 1 December 2011 13:03, Peter Maloney >> wrote: >>> On 12/01/2011 11:20 AM, krad wrote: >>> On my system with 12 TiB used up, what I do in a script is basically: >>> -generate a snap name >>> -make a recursive snapshot >>> -ssh to the remote server and compare snapshots (find the latest common >>> snapshot, to find an incremental reference point) >>> -if a usable reference point exists, start the incremental send like >>> this (which wipes all changes on the remote system without confirmation): >>> zfs send -R -I ${destLastSnap} ${srcLastSnap} | ssh ${destHost} >>> zfs recv -d -F -v ${destPool} >>> -and if no usable reference point existed, then do a full send, >>> non-incremental: >>> zfs send -R ${srcLastSnap} | ssh ${destHost} zfs recv -F -v >>> ${destDataSet} >>> The part about finding the reference snapshot is the most complicated >>> part of my script, and missing from anything else I found online when I >>> was looking for a good solution. For example this script: >>> http://blogs.sun.com/clive/resource/zfs_repl.ksh >>> found on this page: >>> http://blogs.oracle.com/clive/entry/replication_using_zfs > Not that everyone doesn't enjoy inventing their own wheel, but would > you mind sharing your snapshot parser? Sure. Here are a bunch of my zfs scripts. (attached) Disclaimer/notes: -provided as is... might destroy your system, furthermore, I am not responsible for bodily injury nor nuclear war that may result from misuse -there are no unit tests, and no documentation other than a few comments that are possibly only coherent when I read them. For example, it says that it does it recursively and rolls back the destination dataset, but there are a few undocumented cases I can't remember when I needed to do something manual like delete a snapshot, or destroy a dataset. Maybe that is all in the past. I don't know. -the zfs_repl2.bash is the one that makes snapshots and replicates which I wrote myself. The other ksh one is the Oracle one I linked above, and the .sh version of it was just what I was working on to try to make it work reliably, before redoing it all myself (reinventing the wheel is indeed fun). -especially beware of the deleteOldSnapshots.bash which is not well tested and not used yet (and deleteEmptySnapshots.bash which does not work and I believe cannot work). -granted transferable your choice of any present or future version of the BSD or GPL license and another note, I meant to study these which might be better versions of the same thing, or something different, but never got around to it: /usr/ports/sysutils/zfs-replicate/ /usr/ports/sysutils/zfsnap/ /usr/ports/sysutils/zfs-periodic Enjoy! -- -------------------------------------------- Peter Maloney Brockmann Consult Max-Planck-Str. 2 21502 Geesthacht Germany Tel: +49 4152 889 300 Fax: +49 4152 889 333 E-mail: peter.maloney@brockmann-consult.de Internet: http://www.brockmann-consult.de -------------------------------------------- --------------060108000304030705050005--