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

Bob Friesenhahn bfriesen at simple.dallas.tx.us
Mon Jan 11 23:44:19 UTC 2016


On Mon, 11 Jan 2016, kpneal at pobox.com wrote:
>>
>> The rock is somewhat softer than that.  All that is needed to remove
>> most of the duplication is a file copy program which operates at the
>> filesystem blocksize (e.g. 128k) and only copies blocks for existing
>> files if the data in that block has changed.
>>
>> Absent writing a dedicated copy program, rsync with options '-a
>> --inplace --no-whole-file' comes close to copying the file without
>> duplication since it compares blocks and only writes changed blocks
>> (but not necessarily aligned to zfs blocks).
>
> I don't think that will work to restore files from snapshots as snapshots
> appear as different filesystems to applications if I'm not mistaken. That's
> also why using "ln" to create a hard link won't work. Unless I'm mistaken.

Rsync just copies files from one location to another, and/or tries 
make the copy as similar to the original with minimal work.  It is 
easy to rsync from a snapshot (from 
/filesystem/.zfs/snapshot/snapshotname).

If there have been large changes to the file and there are 
intermediate snapshots, then even using rsync with '--inplace 
--no-whole-file' will still result in losing the space attributed to 
those intermediate snapshots.

Bob
-- 
Bob Friesenhahn
bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


More information about the freebsd-fs mailing list