Is there a way to mount a virtual partition containing only the files specific to a snapshot? I know about the hidden zfs directory but it contains all files at the snapshot time. My goal is to make diff backup faster...
Thanks in advance
greg
Is there a way to mount a virtual partition containing only the files specific to a snapshot? I know about the hidden zfs directory but it contains all files at the snapshot time. My goal is to make diff backup faster...
Thanks in advance
greg
Although Andrew's suggestion of zfs send
is the right way to work with differential snapshots, if you just want to see the differences and work with them in your own scripts or on other platforms without ZFS support, there also is zfs diff
:
zfs diff [-FHt] snapshot snapshot|filesystem
Display the difference between a snapshot of a given filesystem
and another snapshot of that filesystem from a later time or
the current contents of the filesystem. The first column is a
character indicating the type of change, the other columns
indicate pathname, new pathname (in case of rename), change in
link count, and optionally file type and/or change time.
The types of change are:
- The path has been removed
+ The path has been created
M The path has been modified
R The path has been renamed
-F
Display an indication of the type of file, in a manner
similar to the -F option of ls(1).
B Block device
C Character device
/ Directory
> Door
| Named pipe
@ Symbolic link
P Event port
= Socket
F Regular file
-H
Give more parsable tab-separated output, without header
lines and without arrows.
-t
Display the path's inode change time as the first column of
output.
Note that the order of the two datasets must be chronological. You could parse the resulting list and only work with those filenames you are interested in.
Example output from the man page:
# zfs diff -F tank/test@before tank/test
M / /tank/test/
M F /tank/test/linked (+1)
R F /tank/test/oldname -> /tank/test/newname
- F /tank/test/deleted
+ F /tank/test/created
M F /tank/test/modified
Also, if you use Oracle Solaris 11.3, you also have the -r
switch to recursively diff all children datasets.
There is no way to access differential data directly via "normal" file access, and there's no way to apply the data obtained from one even if you could get it. How could you read just the differences from a file if only a block or two changed? And if you could read just the differences, how would you know how to apply just the changed data to the file that changed? If you're trying to speed up differential backups, that's a "patch" style of update that is likely to be extremely slow.
Simple, "normal" file access does not provide the information needed to do a differences-only backup.
To do a differential backup of ZFS, use an incremental zfs send ...
command:
zfs send -i pool@snap1 pool@snap2 ...
That's what it's meant for, and there's really no way to do it faster, since the ZFS filesystem is designed from the ground up to know the differences.