1 .\" Copyright (c) 2007 The DragonFly Project. All rights reserved.
3 .\" This code is derived from software contributed to The DragonFly Project
4 .\" by Matthew Dillon <dillon@backplane.com>
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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
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.
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
33 .\" $DragonFly: src/sbin/hammer/hammer.8,v 1.58 2008/11/13 02:04:27 dillon Exp $
35 .Dd September 28, 2009
40 .Nd HAMMER file system utility
47 .Op Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
49 .Op Fl f Ar blkdev Ns Oo Ns Cm \&: Ns Ar blkdev Oc Ns *
50 .\" .Op Fl s Ar linkpath
56 This manual page documents the
58 utility which provides miscellaneous functions related to managing a
61 For a general introduction to the
63 file system, its features, and
64 examples on how to set up and maintain one, see
67 The options are as follows:
68 .Bl -tag -width indent
72 Tell the mirror commands to use a 2-way protocol, which allows
73 automatic negotiation of transaction id ranges.
74 This option is automatically enabled by the
80 will not attempt to break-up large initial bulk transfers into smaller pieces.
81 This can save time but if the link is lost in the middle of the
82 initial bulk transfer you will have to start over from scratch.
84 Specify a bandwidth limit in bytes per second for mirroring streams.
85 This option is typically used to prevent batch mirroring operations from
86 loading down the machine.
87 The bandwidth may be suffixed with
91 to specify values in kilobytes, megabytes, and gigabytes per second.
92 If no suffix is specified, bytes per second is assumed.
93 .It Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
94 Set the memory cache size for any raw
101 for megabytes is allowed,
102 else the cache size is specified in bytes.
104 The read-behind/read-ahead defaults to 4 hammer blocks.
106 This option is typically only used with diagnostic commands
107 as kernel-supported commands will use the kernel's buffer cache.
108 .It Fl c Ar cyclefile
109 When pruning and reblocking you can instruction
111 to start at the object id stored in the specified file.
112 If the file does not exist
114 will start at the beginning.
118 specific period of time and is unable to complete the operation it will
119 write out the current object id so the next run can pick up where it left off.
122 runs to completion it will delete
124 .It Fl f Ar blkdev Ns Oo Ns Cm \&: Ns Ar blkdev Oc Ns *
125 Specify the volumes making up a
129 When maintaining a streaming mirroring this option specifies the
130 minimum delay after a batch ends before the next batch is allowed
132 The default is five seconds.
134 Decrease verboseness.
135 May be specified multiple times.
137 Specify recursion for those commands which support it.
139 When pruning and reblocking you can tell the utility to stop after a
140 certain period of time.
141 This option is used along with the
143 option to prune or reblock a portion of the file system incrementally.
145 Increase verboseness.
146 May be specified multiple times.
148 Force "yes" for any interactive question.
151 The commands are as follows:
152 .Bl -tag -width indent
153 .\" ==== synctid ====
154 .It Cm synctid Ar filesystem Op Cm quick
155 Generates a guaranteed, formal 64 bit transaction id representing the
156 current state of the specified
159 The file system will be synced to the media.
163 keyword is specified the file system will be soft-synced, meaning that a
164 crash might still undo the state of the file system as of the transaction
165 id returned but any new modifications will occur after the returned
166 transaction id as expected.
168 This operation does not create a snapshot. It is meant to be used
169 to track temporary fine-grained changes to a subset of files and
170 will only remain valid for @@ snapshot access purposes for the
172 period configured for the PFS. If you desire a real snapshot then
175 directive may be what you are looking for.
177 .It Cm bstats Op Ar interval
180 B-tree statistics until interrupted.
183 seconds between each display.
184 The default interval is one second.
185 .\" ==== iostats ====
186 .It Cm iostats Op Ar interval
190 statistics until interrupted.
193 seconds between each display.
194 The default interval is one second.
195 .\" ==== history ====
196 .It Cm history Ar path ...
197 Show the modification history for
199 file's inode and data.
200 .\" ==== blockmap ====
202 Dump the blockmap for the file system.
205 blockmap is two-layer
206 blockmap representing the maximum possible file system size of 1 Exabyte.
207 Needless to say the second layer is only present for blocks which exist.
209 blockmap represents 8-Megabyte blocks, called big-blocks.
210 Each big-block has an append
211 point, a free byte count, and a typed zone id which allows content to be
212 reverse engineered to some degree.
216 allocations essentially appended to a selected big-block using
217 the append offset and deducted from the free byte count.
218 When space is freed the free byte count is adjusted but
220 does not track holes in big-blocks for reallocation.
221 A big-block must be completely freed, either
222 through normal file system operations or through reblocking, before
225 Data blocks can be shared by deducting the space used from the free byte
226 count for each shared references, though
228 does not yet make use of this feature.
229 This means the free byte count can legally go negative.
231 This command needs the
235 .It Cm show Op Ar lo Ns Cm \&: Ns Ar objid
237 By default this command will validate all B-Tree
238 linkages and CRCs, including data CRCs, and will report the most verbose
239 information it can dig up.
240 Any errors will show up with a 'B' in column 1 along with various
243 If you specify a localization and object id field the dump will
244 search for the key printing nodes as it recurses down, and then
245 will iterate forwards.
249 the command will report less information about the inode contents.
253 the command will not report the content of the inode or other typed
258 the command will not report volume header information, big-block fill
259 ratios, mirror transaction ids, or report or check data CRCs.
260 B-tree CRCs and linkages are still checked.
262 This command needs the
266 .\" Dump the B-tree, record, large-data, and small-data blockmaps, showing
267 .\" physical block assignments and free space percentages.
268 .\" ==== namekey1 ====
269 .It Cm namekey1 Ar filename
272 64 bit directory hash for the specified file name, using
273 the original directory hash algorithm in version 1 of the file system.
274 The low 32 bits are used as an iterator for hash collisions and will be
276 .\" ==== namekey2 ====
277 .It Cm namekey2 Ar filename
280 64 bit directory hash for the specified file name, using
281 the new directory hash algorithm in version 2 of the file system.
282 The low 32 bits are still used as an iterator but will start out containing
283 part of the hash key.
284 .\" ==== namekey32 ====
285 .It Cm namekey32 Ar filename
286 Generate the top 32 bits of a
288 64 bit directory hash for the specified file name.
291 Shows extended information about all the mounted
294 At the moment volume identification, big-blocks information and space details
296 .\" ==== cleanup ====
297 .It Cm cleanup Op Ar filesystem ...
298 This is a meta-command which executes snapshot, prune, rebalance and reblock
299 commands on the specified
304 is specified this command will clean-up all
306 file systems in use, including PFS's.
307 To do this it will scan all
311 mounts, extract PFS id's, and clean-up each PFS found.
313 This command will by default access a
319 creating them if necessary.
320 The format of the configuration file is:
321 .Bd -literal -offset indent
322 snapshots <period> <retention-time> [any]
323 prune <period> <max-runtime>
324 rebalance <period> <max-runtime>
325 reblock <period> <max-runtime>
326 recopy <period> <max-runtime>
330 .Bd -literal -offset indent
331 snapshots 1d 60d # 0d 0d for PFS /tmp, /var/tmp, /usr/obj
338 Time is given with a suffix of
344 meaning day, hour, minute and second.
348 directive has a period of 0 and a retention time of 0
349 then snapshot generation is disabled, removal of old snapshots are
350 disabled, and prunes will use
351 .Cm prune-everything .
354 directive has a period of 0 but a non-zero retention time
355 then this command will not create any new snapshots but will remove old
356 snapshots it finds based on the retention time.
358 By default only snapshots in the form
359 .Ql snap- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
363 directive is specified as a third argument on the
365 config line then any softlink of the form
366 .Ql *- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
368 .Ql *. Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
371 A prune max-runtime of 0 means unlimited.
373 If period hasn't passed since the previous
376 For example a day has passed when midnight is passed (localtime).
384 The default configuration file will create a daily snapshot, do a daily
385 pruning, rebalancing and reblocking run and a monthly recopy run.
386 Reblocking is defragmentation with a level of 95%,
387 and recopy is full defragmentation.
389 By default prune and rebalance operations are time limited to 5 minutes,
390 reblock operations to a bit over 5 minutes,
391 and recopy operations to a bit over 10 minutes.
392 Reblocking and recopy runs are each broken down into four separate functions:
393 btree, inodes, dirs and data.
394 Each function is time limited to the time given in the configuration file,
395 but the btree, inodes and dirs functions usually does not take very long time,
396 full defragmentation is always used for these three functions.
397 Also note that this directive will by default disable snapshots on
404 The defaults may be adjusted by modifying the
407 The pruning and reblocking commands automatically maintain a cyclefile
408 for incremental operation.
409 If you interrupt (^C) the program the cyclefile will be updated,
411 may continue to run in the background for a few seconds until the
413 ioctl detects the interrupt.
416 PFS option can be set to use another location for the snapshots directory.
418 Work on this command is still in progress.
420 An ability to remove snapshots dynamically as the
421 file system becomes full.
423 .It Cm config Ar filesystem Op configfile
425 If one argument is specified this function dumps the current configuration
426 file to stdout. This configuration file is stored in filesystem meta-data.
427 If two arguments are specified this function installs a new config file.
431 versions less then 3 the configuration file is stored in
432 .Pa <fs>/snapshots/config ,
433 but in all later versions the configuration file is stored in filesystem
435 .It Cm viconfig Ar filesystem
437 Edit the configuration file and reinstall into filesystem meta-data when
440 .It Cm expand Ar filesystem Ar device
441 This command will format
443 and add all of its space to
447 All existing data contained on
449 will be destroyed by this operation!
454 filesystem, formatting will be denied. You can overcome this sanity check
457 to erase the beginning sectors of the device.
458 Also remember that you have to specify
460 together with any other device that make the filesystem, colon-separated to
462 .\" ==== snapshot ====
463 .It Cm snapshot Oo Ar filesystem Oc Ar snapshot-dir
464 .It Cm snapshot Ar filesystem Ar snapshot-dir Ar note
465 Takes a snapshot of the file system either explicitly given by
467 or implicitly derived from the
469 argument and creates a symlink in the directory provided by
471 pointing to the snapshot.
474 is not a directory, it is assumed to be a format string passed to
476 with the current time as parameter.
479 refers to an existing directory, a default format string of
481 is assumed and used as name for the newly created symlink.
483 Snapshot is a per PFS operation, so a
485 file system and each PFS in it have to be snapshot separately.
487 Example, assuming that
493 is a file system on its own, the following invocations:
494 .Bd -literal -offset indent
495 hammer snapshot /mysnapshots
497 hammer snapshot /mysnapshots/%Y-%m-%d
499 hammer snapshot /obj /mysnapshots/obj-%Y-%m-%d
501 hammer snapshot /usr /my/snaps/for/usr "note"
504 Would create symlinks similar to:
505 .Bd -literal -offset indent
506 /mysnapshots/snap-20080627-1210 -> /@@0x10d2cd05b7270d16
508 /mysnapshots/2008-06-27 -> /@@0x10d2cd05b7270d16
510 /mysnapshots/obj-2008-06-27 -> /obj@@0x10d2cd05b7270d16
515 version 3+ filesystem the snapshot is also recorded in meta-data
516 along with the optional note. See the
520 .It Cm snap Ar path Op "note"
522 Create the named snapshot softlink. If the path specified is a
523 directory a standard snapshot softlink will be created in the directory.
524 The snapshot softlink points to the base of the mounted PFS.
525 .It Cm snaplo Ar path Op "note"
527 Create the named snapshot softlink. If the path specified is a
528 directory a standard snapshot softlink will be created in the directory.
529 The snapshot softlink points into the directory it is contained in.
530 .It Cm snapq Ar dir Op "note"
532 Create a snapshot for the PFS containing the specified directory but do
533 not create a softlink. Instead output a path which can be used to access
534 the directory via the snapshot.
536 An absolute or relative path may be specified. The path will be used
537 as-is as a prefix in the path output to stdout. As with the other
538 snap and snapshot directives the snapshot transaction id will be registered
539 in the filesystem meta-data.
540 .It Cm snaprm Op fs Ar path/transid
542 Remove a snapshot given its softlink. If specifying a transaction id
543 the snapshot is removed from filesystem meta-data but you are responsible
544 for removing any related softlinks.
547 Dump the snapshot meta-data in the filesystem, listing all available
548 snapshots and their notes. This is the definitive list of snapshots
551 .It Cm prune Ar softlink-dir
552 Prune the file system based on previously created snapshot softlinks.
553 Pruning is the act of deleting file system history.
556 command will delete file system history such that
557 the file system state is retained for the given snapshots,
558 and all history after the latest snapshot.
559 By setting the per PFS parameter
561 history is guaranteed to be saved at least this time interval.
562 All other history is deleted.
564 The target directory is expected to contain softlinks pointing to
565 snapshots of the file systems you wish to retain.
566 The directory is scanned non-recursively and the mount points and
567 transaction ids stored in the softlinks are extracted and sorted.
568 The file system is then explicitly pruned according to what is found.
569 Cleaning out portions of the file system is as simple as removing a
570 snapshot softlink and then running the
574 As a safety measure pruning only occurs if one or more softlinks are found
577 snapshot id extension.
578 Currently the scanned softlink directory must contain softlinks pointing
582 The softlinks may specify absolute or relative paths.
583 Softlinks must use 20-character
585 transaction ids, as might be returned from
586 .Nm Cm synctid Ar filesystem .
588 Pruning is a per PFS operation, so a
590 file system and each PFS in it have to be pruned separately.
592 Note that pruning a file system may not immediately free-up space,
593 though typically some space will be freed if a large number of records are
595 The file system must be reblocked to completely recover all available space.
597 Example, lets say your that you didn't set
599 and snapshot directory contains the following links:
600 .Bd -literal -offset indent
601 lrwxr-xr-x 1 root wheel 29 May 31 17:57 snap1 ->
602 /usr/obj/@@0x10d2cd05b7270d16
604 lrwxr-xr-x 1 root wheel 29 May 31 17:58 snap2 ->
605 /usr/obj/@@0x10d2cd13f3fde98f
607 lrwxr-xr-x 1 root wheel 29 May 31 17:59 snap3 ->
608 /usr/obj/@@0x10d2cd222adee364
611 If you were to run the
613 command on this directory, then the
616 mount will be pruned to retain the above three snapshots.
617 In addition, history for modifications made to the file system older than
618 the oldest snapshot will be destroyed and history for potentially fine-grained
619 modifications made to the file system more recently than the most recent
620 snapshot will be retained.
622 If you then delete the
624 softlink and rerun the
627 history for modifications pertaining to that snapshot would be destroyed.
631 filesystem versions 3+ this command also scans the snapshots stored
632 in the filesystem meta-data and includes them in the prune.
633 .\" ==== prune-everything ====
634 .It Cm prune-everything Ar filesystem
635 This command will remove all historical records from the file system.
636 This directive is not normally used on a production system.
638 This command does not remove snapshot softlinks but will delete all
639 snapshots recorded in filesystem meta-data (for filesystem version 3+).
640 The user is responsible for deleting any softlinks.
641 .\" ==== rebalance ====
642 .It Cm rebalance Ar filesystem Op Ar saturation_level
643 This command will rebalance the B-tree, nodes with small number of
644 elements will be combined and element counts will be smoothed out
647 The saturation level is a percentage between 50 and 100.
648 The default is 75 percent.
649 .\" ==== reblock ====
650 .It Cm reblock Ar filesystem Op Ar fill_percentage
651 .It Cm reblock-btree Ar filesystem Op Ar fill_percentage
652 .It Cm reblock-inodes Ar filesystem Op Ar fill_percentage
653 .It Cm reblock-dirs Ar filesystem Op Ar fill_percentage
654 .It Cm reblock-data Ar filesystem Op Ar fill_percentage
655 Attempt to defragment and free space for reuse by reblocking a live
658 Big-blocks cannot be reused by
660 until they are completely free.
661 This command also has the effect of reordering all elements, effectively
662 defragmenting the file system.
664 The default fill percentage is 100% and will cause the file system to be
665 completely defragmented.
666 All specified element types will be reallocated and rewritten.
667 If you wish to quickly free up space instead try specifying
668 a smaller fill percentage, such as 90% or 80% (the
670 suffix is not needed).
672 Since this command may rewrite the entire contents of the disk it is
673 best to do it incrementally from a
679 options to limit the run time.
680 The file system would thus be defragmented over long period of time.
682 It is recommended that separate invocations be used for each data type.
683 B-tree nodes, inodes, and directories are typically the most important
684 elements needing defragmentation.
685 Data can be defragmented over a longer period of time.
687 Reblocking is a per PFS operation, so a
689 file system and each PFS in it have to be reblocked separately.
690 .\" ==== pfs-status ====
691 .It Cm pfs-status Ar dirpath ...
692 Retrieve the mirroring configuration parameters for the specified
694 file systems or pseudo-filesystems (PFS's).
695 .\" ==== pfs-master ====
696 .It Cm pfs-master Ar dirpath Op Ar options
697 Create a pseudo-filesystem (PFS) inside a
700 Up to 65535 such file systems can be created.
701 Each PFS uses an independent inode numbering space making it suitable
702 for use as a replication source or target.
706 directive creates a PFS that you can read, write, and use as a mirroring
709 It is recommended to use a
711 mount to access a PFS, for more information see
713 .\" ==== pfs-slave ====
714 .It Cm pfs-slave Ar dirpath Op Ar options
715 Create a pseudo-filesystem (PFS) inside a
718 Up to 65535 such file systems can be created.
719 Each PFS uses an independent inode numbering space making it suitable
720 for use as a replication source or target.
724 directive creates a PFS that you can use as a mirroring target.
725 You will not be able to access a slave PFS until you have completed the
726 first mirroring operation with it as the target (its root directory will
727 not exist until then).
729 Access to the pfs-slave via the special softlink, as described in the
734 dynamically modify the snapshot transaction id by returning a dynamic result
739 A PFS can only be truly destroyed with the
742 Removing the softlink will not destroy the underlying PFS.
744 It is recommended to use a
746 mount to access a PFS, for more information see
748 .\" ==== pfs-update ====
749 .It Cm pfs-update Ar dirpath Op Ar options
750 Update the configuration parameters for an existing
752 file system or pseudo-filesystem.
753 Options that may be specified:
754 .Bl -tag -width indent
755 .It Cm sync-beg-tid= Ns Ar 0x16llx
756 This is the automatic snapshot access starting transaction id for
758 This parameter is normally updated automatically by the
762 It is important to note that accessing a mirroring slave
763 with a transaction id greater than the last fully synchronized transaction
764 id can result in an unreliable snapshot since you will be accessing
765 data that is still undergoing synchronization.
767 Manually modifying this field is dangerous and can result in a broken mirror.
768 .It Cm sync-end-tid= Ns Ar 0x16llx
769 This is the current synchronization point for mirroring slaves.
770 This parameter is normally updated automatically by the
774 Manually modifying this field is dangerous and can result in a broken mirror.
775 .It Cm shared-uuid= Ns Ar uuid
776 Set the shared UUID for this file system.
777 All mirrors must have the same shared UUID.
778 For safety purposes the
780 directives will refuse to operate on a target with a different shared UUID.
782 Changing the shared UUID on an existing, non-empty mirroring target,
783 including an empty but not completely pruned target,
784 can lead to corruption of the mirroring target.
785 .It Cm unique-uuid= Ns Ar uuid
786 Set the unique UUID for this file system.
787 This UUID should not be used anywhere else,
788 even on exact copies of the file system.
789 .It Cm label= Ns Ar string
790 Set a descriptive label for this file system.
791 .It Cm snapshots= Ns Ar string
792 Specify the snapshots directory which
795 will use to manage this PFS.
796 The snapshots directory does not need to be configured for
797 PFS masters and will default to
798 .Pa <pfs>/snapshots .
800 PFS slaves are mirroring slaves so you cannot configure a snapshots
801 directory on the slave itself to be managed by the slave's machine.
802 In fact, the slave will likely have a
804 sub-directory mirrored
805 from the master, but that directory contains the configuration the master
806 is using for its copy of the file system, not the configuration that we
807 want to use for our slave.
809 It is recommended that
810 .Pa <fs>/var/slaves/<name>
811 be configured for a PFS slave, where
817 is an appropriate label.
818 You can control snapshot retention on your slave independent of the master.
819 .It Cm snapshots-clear
822 directory path for this PFS.
823 .It Cm prune-min= Ns Ar N Ns Cm d
824 .It Cm prune-min= Ns Xo
826 .Ar hh Ns Op Cm \&: Ns Ar mm Ns Op Cm \&: Ns Ar ss
828 Set the minimum fine-grained data retention period.
830 always retains fine-grained history up to the most recent snapshot.
831 You can extend the retention period further by specifying a non-zero
833 Any snapshot softlinks within the retention period are ignored
834 for the purposes of pruning (the fine grained history is retained).
835 Number of days, hours, minutes and seconds are given as
840 Because the transaction id in the snapshot softlink cannot be used
841 to calculate a timestamp,
843 uses the earlier of the
847 field of the softlink to
848 determine which snapshots fall within the retention period.
849 Users must be sure to retain one of these two fields when manipulating
852 .\" ==== pfs-upgrade ====
853 .It Cm pfs-upgrade Ar dirpath
854 Upgrade a PFS from slave to master operation.
855 The PFS will be rolled back to the current end synchronization transaction id
856 (removing any partial synchronizations), and will then become writable.
860 currently supports only single masters and using
861 this command can easily result in file system corruption
862 if you don't know what you are doing.
864 This directive will refuse to run if any programs have open descriptors
865 in the PFS, including programs chdir'd into the PFS.
866 .\" ==== pfs-downgrade ====
867 .It Cm pfs-downgrade Ar dirpath
868 Downgrade a master PFS from master to slave operation
869 The PFS becomes read-only and access will be locked to its
872 This directive will refuse to run if any programs have open descriptors
873 in the PFS, including programs chdir'd into the PFS.
874 .\" ==== pfs-destroy ====
875 .It Cm pfs-destroy Ar dirpath
876 This permanently destroys a PFS.
878 This directive will refuse to run if any programs have open descriptors
879 in the PFS, including programs chdir'd into the PFS.
880 .\" ==== mirror-read ====
881 .It Cm mirror-read Ar filesystem Op Ar begin-tid
882 Generate a mirroring stream to stdout.
883 The stream ends when the transaction id space has been exhausted.
884 .\" ==== mirror-read-stream ====
885 .It Cm mirror-read-stream Ar filesystem Op Ar begin-tid
886 Generate a mirroring stream to stdout.
887 Upon completion the stream is paused until new data is synced to the
888 master, then resumed.
889 Operation continues until the pipe is broken.
890 .\" ==== mirror-write ====
891 .It Cm mirror-write Ar filesystem
892 Take a mirroring stream on stdin.
894 This command will fail if the
896 configuration field for the two file systems do not match.
898 If the target PFS does not exist this command will ask you whether
899 you want to create a compatible PFS slave for the target or not.
900 .\" ==== mirror-dump ====
906 to dump an ASCII representation of the mirroring stream.
907 .\" ==== mirror-copy ====
908 .\".It Cm mirror-copy Ar [[user@]host:]filesystem [[user@]host:]filesystem
909 .It Cm mirror-copy Xo
910 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
911 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
913 This is a shortcut which pipes a
918 If a remote host specification is made the program forks a
924 on the appropriate host.
925 The source may be a master or slave PFS, and the target must be a slave PFS.
927 This command also established full duplex communication and turns on
928 the two-way protocol feature which automatically negotiates transaction id
929 ranges without having to use a cyclefile.
930 If the operation completes successfully the target PFS's
933 Note that you must re-chdir into the target PFS to see the updated information.
934 If you do not you will still be in the previous snapshot.
936 If the target PFS does not exist this command will ask you whether
937 you want to create a compatible PFS slave for the target or not.
938 .\" ==== mirror-stream ====
939 .\".It Cm mirror-stream Ar [[user@]host:]filesystem [[user@]host:]filesystem
940 .It Cm mirror-stream Xo
941 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
942 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
944 This command works similarly to
946 but does not exit after the initial mirroring completes.
947 The mirroring operation will resume as changes continue to be made to the
949 The command is commonly used with
953 options to keep the mirroring target in sync with the source on a continuing
956 If the pipe is broken the command will automatically retry after sleeping
958 The time slept will be 15 seconds plus the time given in the
962 This command also detects the initial-mirroring case and spends some
963 time scanning the B-Tree to find good break points, allowing the initial
964 bulk mirroring operation to be broken down into about 20 separate pieces.
965 This means that the user can kill and restart the operation and it will
966 not have to start from scratch once it has gotten past the first chunk.
969 option may be used to disable this feature and perform an initial bulk
971 .\" ==== version ====
972 .It Cm version Ar filesystem
973 This command returns the
975 file system version for the specified
977 as well as the range of versions supported in the kernel.
980 option may be used to remove the summary at the end.
981 .\" ==== version-upgrade ====
982 .It Cm version-upgrade Ar filesystem Ar version Op Cm force
983 This command upgrades the
988 Once upgraded a file system may not be downgraded.
989 If you wish to upgrade a file system to a version greater or equal to the
990 work-in-progress version number you must specify the
993 Use of WIP versions should be relegated to testing and may require wiping
994 the filesystem as development progresses, even though the WIP version might
998 This command operates on the entire
1000 file system and is not a per PFS operation.
1001 All PFS's will be affected.
1002 .Bl -tag -width indent
1005 default version, first
1010 default version, new directory entry layout.
1011 This version is using a new directory hash key.
1015 .Sh PSEUDO-FILESYSTEM (PFS) NOTES
1016 The root of a PFS is not hooked into the primary
1018 file system as a directory.
1021 creates a special softlink called
1023 (exactly 10 characters long) in the primary
1027 then modifies the contents of the softlink as read by
1029 and thus what you see with an
1031 command or if you were to
1034 If the PFS is a master the link reflects the current state of the PFS.
1035 If the PFS is a slave the link reflects the last completed snapshot, and the
1036 contents of the link will change when the next snapshot is completed, and
1041 utility employs numerous safeties to reduce user foot-shooting.
1044 directive requires that the target be configured as a slave and that the
1046 field of the mirroring source and target match.
1047 .Sh UPGRADE INSTRUCTIONS HAMMER V1 TO V2
1048 This upgrade changes the way directory entries are stored. It
1049 is possible to upgrade a V1 filesystem to V2 in place, but
1050 directories created prior to the upgrade will continue to use
1053 Note that the slave mirroring code in the target kernel had bugs in
1054 V1 which can create an incompatible root directory on the slave.
1055 Do not mix a HAMMER master created after the upgrade with a HAMMER
1056 slave created prior to the upgrade.
1058 Any directories created after upgrading will use a new layout.
1059 .Sh UPGRADE INSTRUCTIONS HAMMER V2 TO V3
1060 This upgrade adds meta-data elements to the B-Tree. It is
1061 possible to upgrade a V2 filesystem to V3 in place. After
1062 issuing the upgrade be sure to run a 'hammer cleanup' to
1063 perform post-upgrade tasks.
1065 After making this upgrade running a hammer cleanup will move the
1067 directory for each PFS mount into
1068 .Pa /var/hammer/<path-from-root> .
1069 A HAMMER root mount will migrated
1072 .Pa /var/hammer/root .
1073 Migration occurs only once and only if you have not specified
1074 a snapshots directory in the PFS configuration. If you have
1075 specified a snapshots directory in the PFS configuration no
1076 automatic migration will occur.
1078 For slaves, if you desire, you can migrate your snapshots
1079 config to the new location manually and then clear the
1080 snapshot directory configuration in the slave PFS.
1081 The new snapshots hierarchy is designed to work with
1082 both master and slave PFSs equally well.
1084 In addition, the old config file will be moved to meta-data,
1085 editable via the new hammer
1087 directive. The old config file will be deleted.
1088 Migration occurs only once.
1090 The V3 filesystem has new
1092 directives for creating snapshots.
1093 All snapshot directives, including the original, will create
1094 meta-data entries for the snapshots and the pruning code will
1095 automatically incorporate these entries into its list and
1096 expire them the same way it expires softlinks.
1097 If you accidently blow away your snapshot softlinks you can use
1100 directive to get a definitive list from the meta-data and
1101 regenerate them from that list.
1103 WARNING! If you are using hammer to backup filesystems your scripts
1106 directive to generate transaction ids. This directive does not create
1107 a snapshot. You will have to modify your scripts to use the
1109 directive to generate the linkbuf for the softlink you create, or
1110 use one of the other
1115 directive will continue to work as expected and in V3 it will also
1116 record the snapshot transaction id in meta-data. You may also want
1117 to make use of the new 'note' tag for the meta-data.
1119 WARNING! If you used to remove snapshot softlinks with
1121 you should probably start using the
1123 directive instead to also remove the related meta-data.
1124 The pruning code scans the meta-data so just removing the
1125 softlink is not sufficient.
1127 .Bl -tag -width ".It Pa <fs>/var/slaves/<name>" -compact
1128 .It Pa <pfs>/snapshots
1129 default per PFS snapshots directory
1130 .It Pa <snapshots>/config
1135 .It Pa <fs>/var/slaves/<name>
1136 recommended slave PFS snapshots directory
1144 .Xr periodic.conf 5 ,
1145 .Xr mount_hammer 8 ,
1151 utility first appeared in
1154 .An Matthew Dillon Aq dillon@backplane.com