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