hammer.8: Fix typo.
[dragonfly.git] / sbin / hammer / hammer.8
1 .\" Copyright (c) 2007 The DragonFly Project.  All rights reserved.
2 .\" 
3 .\" This code is derived from software contributed to The DragonFly Project
4 .\" by Matthew Dillon <dillon@backplane.com>
5 .\" 
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in
14 .\"    the documentation and/or other materials provided with the
15 .\"    distribution.
16 .\" 3. Neither the name of The DragonFly Project nor the names of its
17 .\"    contributors may be used to endorse or promote products derived
18 .\"    from this software without specific, prior written permission.
19 .\" 
20 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\" 
33 .\" $DragonFly: src/sbin/hammer/hammer.8,v 1.58 2008/11/13 02:04:27 dillon Exp $
34 .\"
35 .Dd October 22, 2008
36 .Dt HAMMER 8
37 .Os
38 .Sh NAME
39 .Nm hammer
40 .Nd HAMMER file system utility
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl h2qrv
44 .Op Fl b Ar bandwidth
45 .Op Fl c Ar cyclefile
46 .Op Fl f Ar blkdev[:blkdev]*
47 .\" .Op Fl s Ar linkpath
48 .Op Fl i Ar delay
49 .Op Fl t Ar seconds
50 .Ar command
51 .Op Ar argument ...
52 .Sh DESCRIPTION
53 This manual page documents the
54 .Nm
55 utility which provides miscellaneous functions related to managing a
56 .Nm HAMMER
57 file system.
58 For a general introduction to the
59 .Nm HAMMER
60 file system, its features, and
61 examples on how to set up and maintain one, see
62 .Xr HAMMER 5 .
63 .Pp
64 The options are as follows:
65 .Bl -tag -width indent
66 .It Fl h
67 Get help.
68 .It Fl 2
69 Tell the mirror commands to use a 2-way protocol, which allows
70 automatic negotiation of transaction id ranges.
71 This option is automatically enabled by the
72 .Ar mirror-copy
73 command.
74 .It Fl b Ar bandwidth
75 Specify a bandwidth limit in bytes per second for mirroring streams.
76 This option is typically used to prevent batch mirroring operations from
77 loading down the machine.
78 The bandwidth may be suffixed with
79 .Sq k ,
80 .Sq m ,
81 or
82 .Sq g
83 to specify values in kilobytes, megabytes, and gigabytes per second.
84 If no suffix is specified, bytes per second is assumed.
85 .It Fl c Ar cyclefile
86 When pruning and reblocking you can instruction
87 .Nm
88 to start at the object id stored in the specified file.
89 If the file does not exist
90 .Nm
91 will start at the beginning.
92 If
93 .Nm
94 is told to run for a
95 specific period of time and is unable to complete the operation it will
96 write out the current object id so the next run can pick up where it left off.
97 If
98 .Nm
99 runs to completion it will delete
100 .Ar cyclefile .
101 .It Fl f Ar blkdev[:blkdev]*
102 Specify the volumes making up a
103 .Nm HAMMER
104 file system.
105 .It Fl i Ar delay
106 When maintaining a streaming mirroring this option specifies the
107 minimum delay after a batch ends before the next batch is allowed
108 to start.
109 The default is five seconds.
110 .It Fl q
111 Decrease verboseness.
112 May be specified multiple times.
113 .It Fl r
114 Specify recursion for those commands which support it.
115 .It Fl t Ar seconds
116 When pruning and reblocking you can tell the utility to stop after a
117 certain period of time.
118 This option is used along with the
119 .Fl c Ar cyclefile
120 option to prune or reblock a portion of the file system incrementally.
121 .It Fl v
122 Increase verboseness.
123 May be specified multiple times.
124 .El
125 .Pp
126 The commands are as follows:
127 .Bl -tag -width indent
128 .\" ==== synctid ====
129 .It Ar synctid Ar filesystem Op quick
130 Generates a guaranteed, formal 64 bit transaction id representing the
131 current state of the specified
132 .Nm HAMMER
133 file system.
134 The file system will be synced to the media.
135 .Pp
136 If the
137 .Ar quick
138 keyword is specified the file system will be soft-synced, meaning that a
139 crash might still undo the state of the file system as of the transaction
140 id returned but any new modifications will occur after the returned
141 transaction id as expected.
142 .\" ==== bstats ====
143 .It Ar bstats Op interval
144 Output
145 .Nm HAMMER
146 B-tree statistics until interrupted.
147 Pause
148 .Ar interval
149 seconds between each display.
150 The default interval is one second.
151 .\" ==== iostats ====
152 .It Ar iostats Op interval
153 Output
154 .Nm HAMMER
155 I/O statistics until interrupted.
156 Pause
157 .Ar interval
158 seconds between each display.
159 The default interval is one second.
160 .\" ==== history ====
161 .It Ar history Ar path ...
162 Show the modification history for
163 .Nm HAMMER
164 file's inode and data.
165 .\" ==== show ====
166 .It Ar show
167 Dump the B-tree.
168 This command needs the
169 .Fl f
170 flag.
171 .\" .It Ar blockmap
172 .\" Dump the B-tree, record, large-data, and small-data blockmaps, showing
173 .\" physical block assignments and free space percentages.
174 .\" ==== namekey1 ====
175 .It Ar namekey1 Ar filename
176 Generate a
177 .Nm HAMMER
178 64 bit directory hash for the specified file name, using
179 the original directory hash algorithm in version 1 of the filesystem.
180 The low 32 bits are used as an iterator for hash collisions and will be
181 output as 0.
182 .\" ==== namekey2 ====
183 .It Ar namekey2 Ar filename
184 Generate a
185 .Nm HAMMER
186 64 bit directory hash for the specified file name, using
187 the new directory hash algorithm in version 2 of the filesystem.
188 The low 32 bits are still used as an iterator but will start out containing
189 part of the hash key.
190 .\" ==== namekey32 ====
191 .It Ar namekey32 Ar filename
192 Generate the top 32 bits of a
193 .Nm HAMMER
194 64 bit directory hash for the specified file name.
195 .\" ==== cleanup ====
196 .It Ar cleanup Op Ar filesystem ...
197 This is a meta-command which executes snapshot, pruning, and reblocking
198 commands on the specified
199 .Nm HAMMER
200 file system.
201 If no
202 .Ar filesystem
203 is specified this command will clean-up all
204 .Nm HAMMER
205 file systems in use, including PFS's.
206 To do this it will scan all
207 .Nm HAMMER
208 and
209 .Nm null
210 mounts, extract PFS id's, and clean-up each PFS found.
211 .Pp
212 This command will by default access a
213 .Pa snapshots
214 subdirectory and a
215 .Pa snapshots/config
216 file for each
217 .Ar filesystem ,
218 creating them if necessary.
219 The format of the configuration file is:
220 .Bd -literal -offset indent
221 snapshots  <period> <retention-time> [any]
222 prune      <period> <max-runtime>
223 rebalance  <period> <max-runtime>
224 reblock    <period> <1/3 max-runtime>
225 recopy     <period> <1/3 max-runtime>
226
227 Defaults are:
228 snapshots  1d 60d  # 0d 60d  for PFS /tmp, /var/tmp, /usr/obj
229 prune      1d 5m
230 rebalance  1d 5m
231 reblock    1d 5m
232 recopy     30d 10m
233 .Ed
234 .Pp
235 Time is given with a suffix of
236 .Cm d ,
237 .Cm h ,
238 .Cm m
239 or
240 .Cm s
241 meaning day, hour, minute and second.
242 .Pp
243 If the snapshots directive has a period of 0 and a retention time of 0
244 then snapshot generation is disabled, removal of old snapshots are
245 disabled, and prunes will use
246 .Ar prune-everything .
247 If the snapshots directive has a period of 0 but a non-zero retention time
248 then this command will not create any new snapshots but will remove old
249 snapshots it finds based on the retention time.
250 .Pp
251 By default only snapshots in the form:  snap-yyyymmdd[-hhmm] are processed.
252 If the
253 .Ar any
254 directive is specified as a third argument on the snapshots config line
255 then any softlink of the form *[- or .]yyyymmdd[-hhmm] will be processed.
256 .Pp
257 A prune max-runtime of 0 means unlimited.
258 .Pp
259 If period hasn't passed since the previous
260 .Ar cleanup
261 run nothing is done.
262 For example a day has passed when midnight is passed (localtime).
263 By default,
264 .Dx
265 is set up to run
266 .Nm Ar cleanup
267 nightly via
268 .Xr periodic 8 .
269 .Pp
270 The default configuration file will create a daily snapshot, do a daily
271 pruning and reblocking run and a monthly recopy run.
272 Reblocking is defragmentation with a level of 95%,
273 and recopy is full defragmentation.
274 .Pp
275 By default prune and reblock operations are limited to 5 minutes per function,
276 and recopy operations are limited to 10 minutes per function.
277 Reblocking and recopy runs are each broken down into three separate functions
278 (btree, inodes and data)
279 and are thus by default limited to 15 and 30 minutes respectively.
280 Also note that this directive will by default disable snapshots on
281 the following PFS's:
282 .Pa /tmp ,
283 .Pa /var/tmp
284 and
285 .Pa /usr/obj .
286 .Pp
287 The defaults may be adjusted by modifying the
288 .Pa config
289 file.
290 The pruning and reblocking commands automatically maintain a cyclefile
291 for incremental operation.
292 If you interrupt (^C) the program the cyclefile will be updated, but a sub-command
293 may continue to run in the background for a few seconds until the
294 .Nm HAMMER
295 ioctl detects the interrupt.
296 The
297 .Ar snapshots
298 PFS option can be set to use another location for the snapshots directory.
299 .Pp
300 Work on this command is still in progress.
301 Expected additions:  An ability to remove snapshots dynamically as the
302 file system becomes full.
303 .\" ==== snapshot ====
304 .It Ar snapshot Oo Ar filesystem Oc Ar snapshot-dir
305 Takes a snapshot of the file system either explicitly given by
306 .Ar filesystem
307 or implicitly derived from the
308 .Ar snapshot-dir
309 argument and creates a symlink in the directory provided by
310 .Ar snapshot-dir
311 pointing to the snapshot.
312 If
313 .Ar snapshot-dir
314 is not a directory, it is assumed to be a format string passed to
315 .Xr strftime 3
316 with the current time as parameter.
317 If
318 .Ar snapshot-dir
319 refers to an existing directory, a default format string of "snap-%Y%d%m-%H%M"
320 is assumed and used as name for the newly created symlink.
321 .Pp
322 Snapshot is a per PFS operation, so a
323 .Nm HAMMER
324 file system and each PFS in it have to be snapshot separately.
325 .Pp
326 Example, assuming that
327 .Pa /mysnapshots
328 is on file system
329 .Pa /
330 and that
331 .Pa /obj
332 is a file system on its own, the following invocations:
333 .Bd -literal -offset indent
334 hammer snapshot /mysnapshots
335
336 hammer snapshot /mysnapshots/%Y-%m-%d
337
338 hammer snapshot /obj /mysnapshots/obj-%Y-%m-%d
339 .Ed
340 .Pp
341 would create symlinks similar to:
342 .Bd -literal -offset indent
343 /mysnapshots/snap-20080627-1210 -> /@@0x10d2cd05b7270d16
344
345 /mysnapshots/2008-06-27 -> /@@0x10d2cd05b7270d16
346
347 /mysnapshots/obj-2008-06-27 -> /obj@@0x10d2cd05b7270d16
348 .Ed
349 .\" ==== prune ====
350 .It Ar prune Ar softlink-dir
351 Prune the file system based on previously created snapshot softlinks.
352 Pruning is the act of deleting file system history.
353 The
354 .Ar prune
355 command
356 will delete file system history such that
357 the file system state is retained for the given snapshots,
358 and all history after the latest snapshot,
359 but all other history is deleted.
360 .Pp
361 The target directory is expected to contain softlinks pointing to
362 snapshots of the file systems you wish to retain.
363 The directory is scanned non-recursively and the mount points and
364 transaction ids stored in the softlinks are extracted and sorted.
365 The file system is then explicitly pruned according to what is found.
366 Cleaning out portions of the file system is as simple as removing a softlink
367 and then running the
368 .Ar prune
369 command.
370 .Pp
371 As a safety measure pruning only occurs if one or more softlinks are found
372 containing the @@ snapshot id extension.
373 Currently the scanned softlink directory must contain softlinks pointing
374 to a single
375 .Nm HAMMER
376 mount.
377 The softlinks may specify absolute or relative paths.
378 Softlinks must use 20-character (@@0x%016llx) transaction ids,
379 as might be returned from
380 .Dq Nm Ar synctid filesystem .
381 .Pp
382 Pruning is a per PFS operation, so a
383 .Nm HAMMER
384 file system and each PFS in it have to be pruned separately.
385 .Pp
386 Note that pruning a file system may not immediately free-up space,
387 though typically some space will be freed if a large number of records are
388 pruned out.
389 The file system must be reblocked to completely recover all available space.
390 .Pp
391 Example, lets say your snapshot directory contains the following links:
392 .Bd -literal -offset indent
393 lrwxr-xr-x  1 root  wheel  29 May 31 17:57 snap1 ->
394 /usr/obj/@@0x10d2cd05b7270d16
395
396 lrwxr-xr-x  1 root  wheel  29 May 31 17:58 snap2 ->
397 /usr/obj/@@0x10d2cd13f3fde98f
398
399 lrwxr-xr-x  1 root  wheel  29 May 31 17:59 snap3 ->
400 /usr/obj/@@0x10d2cd222adee364
401 .Ed
402 .Pp
403 If you were to run the
404 .Ar prune
405 command on this directory, then the
406 .Nm HAMMER
407 .Pa /usr/obj
408 mount will be pruned to retain the above three snapshots.
409 In addition, history for modifications made to the file system older than
410 the oldest snapshot will be destroyed and history for potentially fine-grained
411 modifications made to the file system more recently than the most recent
412 snapshot will be retained.
413 .Pp
414 If you then delete the
415 .Pa snap2
416 softlink and rerun the
417 .Ar prune
418 command,
419 history for modifications pertaining to that snapshot would be destroyed.
420 .\" ==== prune-everything ====
421 .It Ar prune-everything Ar filesystem
422 This command will remove all historical records from the file system.
423 This directive is not normally used on a production system.
424 .\" ==== rebalance ====
425 .It Ar rebalance Ar filesystem Op Ar saturation_level
426 This command will rebalance the B-Tree, nodes with small numbers of
427 elements will be combined and element counts will be smoothed out
428 between nodes.
429 .Pp
430 The saturation level is a percentage between 50 and 100.  The default
431 is 75 percent.
432 .\" ==== reblock ====
433 .It Ar reblock Ar filesystem Op Ar fill_percentage
434 .It Ar reblock-btree Ar filesystem Op Ar fill_percentage
435 .It Ar reblock-inodes Ar filesystem Op Ar fill_percentage
436 .It Ar reblock-dirs Ar filesystem Op Ar fill_percentage
437 .It Ar reblock-data Ar filesystem Op Ar fill_percentage
438 Attempt to defragment and free space for reuse by reblocking a live
439 .Nm HAMMER
440 file system.
441 Big blocks cannot be reused by
442 .Nm HAMMER
443 until they are completely free.
444 This command also has the effect of reordering all elements, effectively
445 defragmenting the file system.
446 .Pp
447 The default fill percentage is 100% and will cause the file system to be
448 completely defragmented.
449 All specified element types will be reallocated and rewritten.
450 If you wish to quickly free up space instead try specifying
451 a smaller fill percentage, such as 90% or 80% (the
452 .Sq %
453 suffix is not needed).
454 .Pp
455 Since this command may rewrite the entire contents of the disk it is
456 best to do it incrementally from a
457 .Xr cron 8
458 job along with the
459 .Fl c Ar cyclefile
460 and
461 .Fl t Ar seconds
462 options to limit the run time.
463 The file system would thus be defragmented over long period of time.
464 .Pp
465 It is recommended that separate invocations be used for each data type.
466 B-tree nodes, inodes, and directories are typically the most important
467 elements needing defragmentation.
468 Data can be defragmented over a longer period of time.
469 .Pp
470 Reblocking is a per PFS operation, so a
471 .Nm HAMMER
472 file system and each PFS in it have to be reblocked separately.
473 .\" ==== pfs-status ====
474 .It Ar pfs-status Ar dirpath ...
475 Retrieve the mirroring configuration parameters for the specified
476 .Nm HAMMER
477 file systems or pseudo-filesystems (PFS's).
478 .\" ==== pfs-master ====
479 .It Ar pfs-master Ar dirpath Op options
480 Create a pseudo-filesystem (PFS) inside a
481 .Nm HAMMER
482 file system.
483 Up to 65535 such file systems can be created.
484 Each PFS uses an independent inode numbering space making it suitable
485 for use as a replication source or target.
486 .Pp
487 The
488 .Ar pfs-master
489 directive creates a PFS that you can read, write, and use as a mirroring
490 source.
491 .Pp
492 It is recommended to use a
493 .Nm null
494 mount to access a PFS, for more information see
495 .Xr HAMMER 5 .
496 .\" ==== pfs-slave ====
497 .It Ar pfs-slave Ar dirpath Op options
498 Create a pseudo-filesystem (PFS) inside a
499 .Nm HAMMER
500 file system.
501 Up to 65535 such file systems can be created.
502 Each PFS uses an independent inode numbering space making it suitable
503 for use as a replication source or target.
504 .Pp
505 The
506 .Ar pfs-slave
507 directive creates a PFS that you can use as a mirroring target.
508 You will not be able to access a slave PFS until you have completed the
509 first mirroring operation with it as the target (its root directory will
510 not exist until then).
511 .Pp
512 Access to the pfs-slave via the special softlink,
513 as described in the
514 .Sx PFS NOTES
515 below, allows
516 .Nm HAMMER
517 to
518 dynamically modify the snapshot transaction id by returning a dynamic result
519 from
520 .Xr readlink 2
521 calls.
522 .Pp
523 A PFS can only be truly destroyed with the
524 .Ar pfs-destroy
525 directive.
526 Removing the softlink will not destroy the underlying PFS.
527 .Pp
528 It is recommended to use a
529 .Nm null
530 mount to access a PFS, for more information see
531 .Xr HAMMER 5 .
532 .\" ==== pfs-update ====
533 .It Ar pfs-update Ar dirpath Op options
534 Update the configuration parameters for an existing
535 .Nm HAMMER
536 file system
537 or pseudo-filesystem.
538 Options that may be specified:
539 .Bl -tag -width indent
540 .It sync-beg-tid=0x16llx
541 This is the automatic snapshot access starting transaction id for
542 mirroring slaves.
543 This parameter is normally updated automatically by the
544 .Ar mirror-write
545 directive.
546 .Pp
547 It is important to note that accessing a mirroring slave
548 with a transaction id greater than the last fully synchronized transaction
549 id can result in an unreliable snapshot since you will be accessing
550 data that is still undergoing synchronization.
551 .Pp
552 Manually modifying this field is dangerous and can result in a broken
553 mirror.
554 .It sync-end-tid=0x16llx
555 This is the current synchronization point for mirroring slaves.
556 This parameter is normally updated automatically by the
557 .Ar mirror-write
558 directive.
559 .Pp
560 Manually modifying this field is dangerous and can result in a broken mirror.
561 .It shared-uuid=<uuid>
562 Set the shared UUID for this file system.
563 All mirrors must have the same shared UUID.
564 For safety purposes the
565 .Ar mirror-write
566 directives will refuse to operate on a target with a different shared UUID.
567 .Pp
568 Changing the shared UUID on an existing, non-empty mirroring target,
569 including an empty but not completely pruned target,
570 can lead to corruption of the mirroring target.
571 .It unique-uuid=<uuid>
572 Set the unique UUID for this file system.
573 This UUID should not be used anywhere else,
574 even on exact copies of the file system.
575 .It label=<string>
576 Set a descriptive label for this file system.
577 .It snapshots=<string>
578 Specify the snapshots directory which
579 .Nm
580 .Ar cleanup
581 will use to manage this PFS.
582 The snapshots directory does not need to be configured for
583 PFS masters and will default to
584 .Pa <pfs>/snapshots .
585 .Pp
586 PFS slaves are mirroring slaves so you cannot configure a snapshots
587 directory on the slave itself to be managed by the slave's machine.
588 In fact, the slave will likely have a
589 .Pa snapshots
590 sub-directory mirrored
591 from the master, but that directory contains the configuration the master
592 is using for its copy of the file system, not the configuration that we
593 want to use for our slave.
594 .Pp
595 It is recommended that
596 .Pa <fs>/var/slaves/<name>
597 be configured for a PFS slave, where
598 .Pa <fs>
599 is the base
600 .Nm HAMMER
601 file system, and
602 .Pa <name>
603 is an appropriate label.
604 You can control snapshot retention on your slave independent of the master.
605 .It snapshots-clear
606 Zero out the snapshots directory path for this PFS.
607 .El
608 .\" ==== pfs-upgrade ====
609 .It Ar pfs-upgrade Ar dirpath
610 Upgrade a PFS from slave to master operation.
611 The PFS will be rolled back to the current end synchronization tid
612 (removing any partial synchronizations), and will then become writable.
613 .Pp
614 .Em WARNING!
615 .Nm HAMMER
616 currently supports only single masters and using
617 this command can easily result in file system corruption
618 if you don't know what you are doing.
619 .Pp
620 This directive will refuse to run if any programs have open descriptors
621 in the PFS, including programs chdir'd into the PFS.
622 .\" ==== pfs-downgrade ====
623 .It Ar pfs-downgrade Ar dirpath
624 Downgrade a master PFS from master to slave operation
625 The PFS becomes read-only and access will be locked to its
626 .Ar sync-end-tid .
627 .Pp
628 This directive will refuse to run if any programs have open descriptors
629 in the PFS, including programs chdir'd into the PFS.
630 .\" ==== pfs-destroy ====
631 .It Ar pfs-destroy Ar dirpath
632 This permanently destroys a PFS.
633 .Pp
634 This directive will refuse to run if any programs have open descriptors
635 in the PFS, including programs chdir'd into the PFS.
636 .\" ==== mirror-read ====
637 .It Ar mirror-read Ar filesystem Op Ar <begin-tid>
638 Generate a mirroring stream to stdout.
639 The stream ends when the transaction id space has been exhausted.
640 .\" ==== mirror-read-stream ====
641 .It Ar mirror-read-stream Ar filesystem Op Ar <begin-tid>
642 Generate a mirroring stream to stdout.
643 Upon completion the stream is paused until new data is synced to the
644 master, then resumed.
645 Operation continues until the pipe is broken.
646 .\" ==== mirror-write ====
647 .It Ar mirror-write Ar filesystem
648 Take a mirroring stream on stdin.
649 .Pp
650 This command will fail if the
651 .Ar shared-uuid
652 configuration field for the two file systems do not match.
653 .Pp
654 If the target PFS does not exist this command will ask you whether
655 you want to create a compatible PFS slave for the target or not.
656 .\" ==== mirror-dump ====
657 .It Ar mirror-dump
658 A
659 .Ar mirror-read
660 can be piped into a
661 .Ar mirror-dump
662 to dump an ASCII representation of the mirroring stream.
663 .\" ==== mirror-copy ====
664 .It Ar mirror-copy Ar [[user@]host:]filesystem Ar [[user@]host:]filesystem
665 This is a shortcut which pipes a
666 .Ar mirror-read
667 command to a
668 .Ar mirror-write
669 command.
670 If a remote host specification is made the program forks a
671 .Xr ssh 1
672 and execs the
673 .Ar mirror-read
674 and/or
675 .Ar mirror-write
676 on the appropriate host.
677 The source may be a master or slave PFS, and the target must be a slave PFS.
678 .Pp
679 This command also established full duplex communication and turns on
680 the two-way protocol feature which automatically negotiates transaction id
681 ranges without having to use a cyclefile.
682 If the operation completes successfully the target PFS's
683 .Ar sync-end-tid
684 will be updated.
685 Note that you must re-chdir into the target PFS to see the updated information.
686 If you do not you will still be in the previous snapshot.
687 .Pp
688 If the target PFS does not exist this command will ask you whether
689 you want to create a compatible PFS slave for the target or not.
690 .\" ==== mirror-stream ====
691 .It Ar mirror-stream Ar [[user@]host:]filesystem Ar [[user@]host:]filesystem
692 This command works similarly to
693 .Ar mirror-copy
694 but does not exit unless the pipe is broken.
695 This command will resume the mirroring operation whenever the master is synced.
696 The command is commonly used with
697 .Fl i Ar delay
698 and
699 .Fl b Ar bandwidth
700 options to keep the mirroring target in sync with the source on a continuing
701 basis.
702 .\" ==== version ====
703 .It Ar version Ar filesystem
704 This command returns the
705 .Nm HAMMER
706 filesystem version for the specified
707 filesystem as well as the range of versions supported in the kernel.
708 The
709 .Fl q
710 option may be used to remove the summary at the end.
711 .\" ==== version-upgrade ====
712 .It Ar version-upgrade Ar filesystem Ar version Op Ar force
713 This command upgrades the
714 .Nm HAMMER
715 filesystem to the specified version.
716 Once upgraded a filesystem may not be downgraded.
717 If you wish to upgrade a filesystem to a version greater or equal to the
718 work-in-progress version number you must specify the
719 .Ar force
720 directive.
721 Use of WIP versions should be relegated to testing and may require wiping
722 the filesystem as development progresses, even though the WIP version might
723 not change.
724 .Pp
725 NOTE!  This command operates on the entire
726 .Nm HAMMER
727 filesystem and is not a per-PFS operation.
728 All PFS's will be affected.
729 .Bl -tag -width indent
730 .It 1
731 .Dx 2.0
732 default version, first
733 .Nm HAMMER
734 release.
735 .It 2
736 Work-in-progress version.
737 This version is developing a new directory hash key.
738 .El
739 .El
740 .\".Sh EXAMPLES
741 .Sh PSEUDO FILESYSTEM (PFS) NOTES
742 The root of a PFS is not hooked into the primary
743 .Nm HAMMER
744 file system as a directory.
745 Instead,
746 .Nm HAMMER
747 creates a special softlink called "@@PFS%05d" (exactly 10 characters long)
748 in the primary
749 .Nm HAMMER
750 file system.
751 .Nm HAMMER
752 then modifies the contents of the softlink as read by
753 .Xr readlink 2 ,
754 and thus what you see with an
755 .Xr ls 1
756 command or if you were to
757 .Xr cd 1
758 into the link.
759 If the PFS is a master the link reflects the current state of the PFS.
760 If the PFS is a slave the link reflects the last completed snapshot, and the
761 contents of the link will change when the next snapshot is completed, and
762 so forth.
763 .Pp
764 PFS support is currently very new and experimental.
765 The
766 .Nm
767 utility employs numerous safeties to reduce user foot-shooting.
768 The
769 .Ar mirror-copy
770 directive requires that the target be configured as a slave and that the
771 .Ar shared-uuid
772 field of the mirroring source and target match.
773 .Sh FILES
774 .Bl -tag -width ".It Pa <fs>/var/slaves/<name>" -compact
775 .It Pa snapshots
776 default per PFS snapshots directory
777 .It Pa <snapshots>/config
778 .Nm
779 .Ar cleanup
780 configuration file
781 .It Pa <fs>/var/slaves/<name>
782 recommended slave PFS snapshots directory
783 .El
784 .Sh EXIT STATUS
785 .Ex -std
786 .Sh SEE ALSO
787 .Xr undo 1 ,
788 .Xr HAMMER 5 ,
789 .Xr periodic.conf 5 ,
790 .Xr mount_hammer 8 ,
791 .Xr mount_null 8 ,
792 .Xr newfs_hammer 8
793 .Sh HISTORY
794 The
795 .Nm
796 utility first appeared in
797 .Dx 1.11 .
798 .Sh AUTHORS
799 .An Matthew Dillon Aq dillon@backplane.com