Restore only several files from ZFS snapshot without creating copy of them?

Eric A. Borisch eborisch at gmail.com
Mon Jan 11 21:39:09 UTC 2016


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.

 - Eric


More information about the freebsd-fs mailing list