Skip to main content

MooseFS PRO only.

mfspatch

MooseFS patch tools.

This page reproduces the manual page mfspatch(1) as the product ships it: the text man mfspatch prints on a machine where the packages are installed. It is not edited here, and where it disagrees with the rest of this documentation, the documentation is the side kept against the sources. What the subject is: Command line tools.

Synopsis​

mfscreatepatch [-?] [-d] [-f] [-c] [-o] [-m NUMBER] [-p OUTPUT_PATCH_FILENAME] PREVIOUS_SNAPSHOT CURRENT_SNAPSHOT

mfsapplypatch [-?] [-v] [-i] [-d] [-f] [-n] [-s POSITION] [-p INPUT_PATCH_FILENAME] OBJECT_TO_PATCH

mfsdumppatch [-?] [-s POSITION] [-p INPUT_PATCH_FILENAME]

Description​

These tools are used to create and manipulate "patch files" that describe differences between two snapshotted directories on MooseFS. Such patches can later be applied to a different directory (on another instance of MooseFS or even on a different filesystem) for backup purposes.

The tools rely heavily on MooseFS snapshot mechanics to find the smallest subset of operations. They will work with "regular" directories, but then the patch file will just contain the whole file data content of the current directory.

mfscreatepatch creates a "patch" between two directories, i.e. a set of operations that need to be performed to turn the content of directory PREVIOUS_SNAPSHOT into the content of directory CURRENT_SNAPSHOT. These operations include (but are not limited to): creating and deleting filesystem objects, writing data to files, changing object attributes. The patch can be written to a file (option -p) or to stdout (and, for example, piped directly to mfsapplypatch).

mfsapplypatch reads provided patch (from stdin or from a file when option -p is used) and applies it to OBJECT_TO_PATCH.

mfsdumppatch shows in human-readable format what operations will be performed when applying the patch (it doesn't show written data, just that a write operation will be performed and length of written data).

Options​

-? - displays short usage message.

-v - verbose mode.

-i - ignore non important errors (such as ENOENT on delete, EEXIST on create).

-d - data only mode (try to create or apply patch without root privileges - fail when data can't be read or written).

-c - small changes mode - during the patch creation process differing chunks are compared and only different parts of chunks are incorporated into the patch file, instead of whole chunks

-f - force mode (create or apply patch ignoring all errors - can be run without root privileges).

-o - two pass hardlinks mode - during the patch creation additional pass through the snapshot's tree is performed to detect all hardlinks; it's a bit more time consuming, but guarantees that the resulting patch file will not include any redundant data

-p - name of 'patch' file - if not defined then stdin or stdout will be used.

-m - optional number of extra threads that will be used to create the patch, this will divide the patch into smaller files (N+1 files if N is provided as parameter); accepted values are 1 to 100; requires -p option

-n - apply the patch file to a filesystem other than MooseFS; when this option is used, xattrs, facls and MooseFS specific attributes will not be recorded; trying to apply a patch to MooseFS will throw an error when this option is used

-s - seek to given position and start dumping or applying the patch from this position; for multiple file patch this option sets position of the main file only

Notes​

Application to a filesystem different than MooseFS is not guaranteed, although most POSIX filesystems should work. You have to use the -n option when applying to a non-MooseFS filesystem.

If one of the signals: USR1, USR2 or INFO (whichever one of them exists in the OS the tool is used on) is sent to the tool, it will display its progress to stderr. This does not work for the mfsdumppatch tool.

If a patch application is interrupted, it can be applied again from the start with option -i and should always eventually succeed. Some operations might be performed twice in this case. If the patch application fails because of some internal error, the tool will display the position it ended its work on and this position should be used when trying to re-apply (option -s), to avoid re-applying the same data, and option -i is no longer necessary. If some previous position is known (i.e. because a signal was used to check progress of the tool before application failed), this can also be used, but then the -i option should be used. In case of multi file patches, -s works only for the main file, so if the failure was displayed for a side file, this mechanism cannot be used.

If option -m is used, the tool starts to work in multi-threaded mode and it will create many patch files (option -p is obligatory in this case). Apply command will then also automatically work in multi-threaded mode. In multi-threaded mode N+1 files are created (N is the number of threads specified by the user). One file is the "main" file containing some of the metadata changes and references to "side" files, which contain file data changes and also some of the metadata changes. The name of the main file is the one supplied by -p option and the side files have additional suffixes predefined in the tool. If the apply tool encounters a patch in multi-file format, it will automatically create one additional thread per each side file.

For obvious reasons unix socket objects are ignored by these tools.

See also​

mfsmount(8), mfstools(1), mfssnapshots(1)