From owner-freebsd-fs@freebsd.org Mon Jan 11 22:40:38 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D15AA6B86D for ; Mon, 11 Jan 2016 22:40:38 +0000 (UTC) (envelope-from gpalmer@freebsd.org) Received: from mail.in-addr.com (mail.in-addr.com [IPv6:2a01:4f8:191:61e8::2525:2525]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB60E1F70; Mon, 11 Jan 2016 22:40:37 +0000 (UTC) (envelope-from gpalmer@freebsd.org) Received: from gjp by mail.in-addr.com with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aIl8d-000BXC-DO; Mon, 11 Jan 2016 22:40:35 +0000 Date: Mon, 11 Jan 2016 22:40:35 +0000 From: Gary Palmer To: kpneal@pobox.com Cc: "Eric A. Borisch" , FreeBSD Filesystems , lev@freebsd.org, Paul Kraus Subject: Re: Restore only several files from ZFS snapshot without creating copy of them? Message-ID: <20160111224035.GA1019@in-addr.com> References: <133976260.20160110023807@serebryakov.spb.ru> <20160111222436.GE88498@neutralgood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160111222436.GE88498@neutralgood.org> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: gpalmer@freebsd.org X-SA-Exim-Scanned: No (on mail.in-addr.com); SAEximRunCond expanded to false X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2016 22:40:38 -0000 On Mon, Jan 11, 2016 at 05:24:36PM -0500, kpneal@pobox.com wrote: > On Mon, Jan 11, 2016 at 03:39:08PM -0600, Eric A. Borisch wrote: > > On Mon, Jan 11, 2016 at 3:20 PM, Paul Kraus wrote: > > > On Jan 9, 2016, at 18:38, Lev Serebryakov wrote: > > > > > >> Hello FreeBSD, > > >> > > >> I have a ZFS filesystem, which have daily snapshots. User removed several > > >> multi-gigabyte files by accident and need to get them back. These files are > > >> present in old daily snapshots, allright. But as far as I understnad, if I > > >> do > > >> > > >> cp /fs/.zfs/snapshots/old-snapshot/file /fs/file > > >> > > >> I got TWO copies of this file (one in live filesystem and future snapshots > > >> and other one in old snapshots). As files in question are multi-gigabyte > > >> (about 100G alltogether) I don't want such duplication (dedup is turned off, > > >> as it is very memory-consuming). > > >> > > >> Is it possible to restore these files without such data duplication? > > > > > > Could you leverage a CLONE of the snapshot until such time as other snapshots of these large files have expired (assuming you are expiring and destroying old snapshots after a certain amount of time) ? I am trying to think out of the box here and have to completely thought all this through. > > > > I think you'll find a combination of Paul's and Bob's answers will be > > your best bet; clone, then rsync (or some other update tool) into the > > clone from the 'current' (with appropriate --exclude rules to not > > delete the files in question, likely any other deletions will be > > desired) and then rename/promote/delete when ready. > > But can a clone be promoted to the "head" of a dataset? I thought a clone > was always backed by a snapshot. The goal as I understood it was to get > the files back into the normal dataset. zfs promote Regards Gary > Now, having a clone mounted with symlinks from the normal dataset to the > mounted clone may work. It depends on whether or not the files get changed. > (The point of the clone is to avoid having the snapshot deleted out from > under you.) > > Another idea would be to copy the files from the snapshot into the normal > dataset and then to delete the old snapshots. This will leave you without > the safety net of the old snapshots, but it will also leave you with one > copy of the files in the normal location. It's not my place to say if that > is acceptable or not. > > -- > Kevin P. Neal http://www.pobox.com/~kpn/ > > "It sounded pretty good, but it's hard to tell how it will work out > in practice." -- Dennis Ritchie, ~1977, "Summary of a DEC 32-bit machine" > _______________________________________________ > freebsd-fs@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" >