4

スナップショットに固有のファイルのみを含む仮想パーティションをマウントする方法はありますか? 非表示の zfs ディレクトリについては知っていますが、スナップショット時のすべてのファイルが含まれています。私の目標は、差分バックアップを高速化することです...

前もって感謝します

グレッグ

4

2 に答える 2

8

アンドリューの提案は差分スナップショットを操作する正しい方法ですが、違いを確認し、独自のスクリプトで、または ZFS をサポートしていない他のプラットフォームでそれらを操作しzfs sendたいだけの場合は、次の方法もあります。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.

2 つのデータセットの順序は時系列でなければならないことに注意してください。結果のリストを解析して、関心のあるファイル名のみを操作できます。

マニュアルページからの出力例:

# 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

また、Oracle Solaris 11.3 を使用する場合は、-rすべての子データセットを再帰的に比較するスイッチもあります。

于 2016-05-12T13:27:21.097 に答える
2

「通常の」ファイル アクセスで直接差分データにアクセスする方法はありません。取得できたとしても、取得したデータを適用する方法はありません。ブロックが 1 つまたは 2 つしか変更されていない場合、ファイルから相違点だけを読み取るにはどうすればよいでしょうか。そして、違いだけを読み取ることができた場合、変更されたデータだけを変更されたファイルに適用する方法をどのように知ることができますか? 差分バックアップを高速化しようとしている場合、それは「パッチ」スタイルの更新であり、非常に遅くなる可能性があります。

単純な「通常の」ファイル アクセスでは、差分のみのバックアップを実行するために必要な情報は提供されません。

ZFS の差分バックアップを行うには、増分zfs send ...コマンドを使用します。

zfs send -i pool@snap1 pool@snap2 ...

それが意図されたものであり、ZFS ファイルシステムはゼロから違いを知るように設計されているため、実際には高速化する方法はありません。

于 2016-02-25T10:23:28.633 に答える