Restore only several files from ZFS snapshot without creating copy of them?
Gary Palmer
gpalmer at freebsd.org
Mon Jan 11 22:40:38 UTC 2016
On Mon, Jan 11, 2016 at 05:24:36PM -0500, kpneal at 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 <paul at kraus-haus.org> wrote:
> > > On Jan 9, 2016, at 18:38, Lev Serebryakov <lev at FreeBSD.org> 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 at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
>
More information about the freebsd-fs
mailing list