NAME
undo
—
Undo changes made to files on HAMMER
filesystems
SYNOPSIS
undo |
[-adDiuv ] [-o
outfile] [-t
transaction-id] [-t
transaction-id] file ... |
DESCRIPTION
Theundo
utility acquires an older version of the
specified files and can output them to stdout, generate a file with the
previous contents, or generate a diff to stdout. A history can also be
generated.
The options are as follows:
-d
- Generate a unified diff from the older version to the current version.
-D
- Generate a unified diff from the current version to the older version.
-i
- Generate a single line giving the transaction id and converted timestamp of the version of the file requested, rather than dumping the contents of the file.
-a
- Iterate through the file's entire history generating undo files, diffs, output, etc. Note that due to the way file creation is laid down a file may appear to be zero-filled just after creation before the data is actually synced. There will be a later version with the synced data. This is a known bug.
-u
- Output to a file with name synthesized from the input filename postfixed
with ".undo". If not specified output is either to stdout or, if
a single file argument is given, the file specified by the
-o
option. -v
- Increase verboseness.
-o
outfile- Output to the specified file instead of to stdout. If iterating through a file's entire history outfile will be postfixed with an iteration number in the form "outfile.%04d". If multiple files are specified outfile is used as a template where '%s' is replaced with the last component of each file path. When used with multiple files '%%' must be used in the outfile specification to indicate a '%'. When used with a single file the outfile string is used verbatim.
-t
transaction-id- Specify how far to go back in time, by giving a hexadecimal HAMMER
transaction id which must start with "0x". If not specified the
program will attempt to locate the most recent version of the file(s)
prior to the current version. This option does not apply if
-a
is specified.A second
-t
specification may be given to provide two end-points for a diff, and will imply-d
unless overridden.Transaction ids always start with "0x". A simple index may be specified instead of a transaction id where 0 indicates the latest version and increasing values indicate older versions.
EXIT STATUS
The undo
utility exits 0 on
success, and >0 if an error occurs.
EXAMPLES
undo -d mytextfile
undo -o mytextfile.old mytextfile
DIAGNOSTICS
- Warning: fake transaction id path@@0x...
- While locating past versions of the file,
undo
came across a fake transaction id, which are automatically generated by hammer(5) in case the file's directory entry and inode got bisected in the past.
SEE ALSO
HISTORY
The undo
utility first appeared in
DragonFly 1.13.
AUTHORS
Matthew Dillon <dillon@backplane.com>
BUGS
HAMMER only synchronizes information to disk every 30 seconds or
so and a quick file create / delete is done entirely in system memory and
cannot be undone. This can be worked around by running
“hammer
synctid
filesystem”.