From owner-freebsd-current@FreeBSD.ORG Wed Jan 30 09:43:34 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CAA2F5F1; Wed, 30 Jan 2013 09:43:34 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3A1EAAC8; Wed, 30 Jan 2013 09:43:34 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.6/8.14.6) with ESMTP id r0U9hQMG090453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 30 Jan 2013 10:43:26 +0100 (CET) (envelope-from uqs@FreeBSD.org) Date: Wed, 30 Jan 2013 10:43:26 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Fabian Keil Subject: Re: Zpool surgery Message-ID: <20130130094326.GT35868@acme.spoerlein.net> Mail-Followup-To: Fabian Keil , Dan Nelson , Peter Jeremy , current@freebsd.org, fs@freebsd.org References: <20130127103612.GB38645@acme.spoerlein.net> <1F0546C4D94D4CCE9F6BB4C8FA19FFF2@multiplay.co.uk> <20130127201140.GD29105@server.rulingia.com> <20130128085820.GR35868@acme.spoerlein.net> <20130128205802.1ffab53e@fabiankeil.de> <20130128214111.GA14888@dan.emsphone.com> <20130129155250.29d8f764@fabiankeil.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20130129155250.29d8f764@fabiankeil.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Peter Jeremy , Dan Nelson , current@freebsd.org, fs@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2013 09:43:34 -0000 On Tue, 2013-01-29 at 15:52:50 +0100, Fabian Keil wrote: > Dan Nelson wrote: > > > In the last episode (Jan 28), Fabian Keil said: > > > Ulrich Spörlein wrote: > > > > On Mon, 2013-01-28 at 07:11:40 +1100, Peter Jeremy wrote: > > > > > On 2013-Jan-27 14:31:56 -0000, Steven Hartland wrote: > > > > > >----- Original Message ----- > > > > > >From: "Ulrich Spörlein" > > > > > >> I want to transplant my old zpool tank from a 1TB drive to a new > > > > > >> 2TB drive, but *not* use dd(1) or any other cloning mechanism, as > > > > > >> the pool was very full very often and is surely severely > > > > > >> fragmented. > > > > > > > > > > > >Cant you just drop the disk in the original machine, set it as a > > > > > >mirror then once the mirror process has completed break the mirror > > > > > >and remove the 1TB disk. > > > > > > > > > > That will replicate any fragmentation as well. "zfs send | zfs recv" > > > > > is the only (current) way to defragment a ZFS pool. > > > > > > It's not obvious to me why "zpool replace" (or doing it manually) > > > would replicate the fragmentation. > > > > "zpool replace" essentially adds your new disk as a mirror to the parent > > vdev, then deletes the original disk when the resilver is done. Since > > mirrors are block-identical copies of each other, the new disk will contain > > an exact copy of the original disk, followed by 1TB of freespace. > > Thanks for the explanation. > > I was under the impression that zfs mirrors worked at a higher > level than traditional mirrors like gmirror but there seems to > be indeed less magic than I expected. > > Fabian To wrap this up, while the zpool replace worked for the disk, I played around with it some more, and using snapshots instead *did* work the second time. I'm not sure what I did wrong the first time ... So basically this: # zfs send -R oldtank@2013-01-22 | zfs recv -F -d newtank (takes ages, then do a final snapshot before unmounting and send the incremental) # zfs send -R -i 2013-01-22 oldtank@2013-01-29 | zfs recv -F -d newtank Allows me to send snapshots up to 2013-01-29 to the "archive" pool from either oldtank or newtank. Yay! Cheers, Uli