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
108 This option is typically only used with diagnostic commands
109 as kernel-supported commands will use the kernel's buffer cache.
110 .It Fl c Ar cyclefile
111 When pruning and reblocking you can instruction
113 to start at the object id stored in the specified file.
114 If the file does not exist
116 will start at the beginning.
120 specific period of time and is unable to complete the operation it will
121 write out the current object id so the next run can pick up where it left off.
124 runs to completion it will delete
126 .It Fl f Ar blkdev Ns Oo Ns Cm \&: Ns Ar blkdev Oc Ns *
127 Specify the volumes making up a
131 When maintaining a streaming mirroring this option specifies the
132 minimum delay after a batch ends before the next batch is allowed
134 The default is five seconds.
136 Decrease verboseness.
137 May be specified multiple times.
139 Specify recursion for those commands which support it.
141 When pruning and reblocking you can tell the utility to stop after a
142 certain period of time.
143 This option is used along with the
145 option to prune or reblock a portion of the file system incrementally.
147 Increase verboseness.
148 May be specified multiple times.
150 Force "yes" for any interactive question.
153 The commands are as follows:
154 .Bl -tag -width indent
155 .\" ==== synctid ====
156 .It Cm synctid Ar filesystem Op Cm quick
157 Generates a guaranteed, formal 64 bit transaction id representing the
158 current state of the specified
161 The file system will be synced to the media.
165 keyword is specified the file system will be soft-synced, meaning that a
166 crash might still undo the state of the file system as of the transaction
167 id returned but any new modifications will occur after the returned
168 transaction id as expected.
170 This operation does not create a snapshot.
171 It is meant to be used
172 to track temporary fine-grained changes to a subset of files and
173 will only remain valid for
175 snapshot access purposes for the
177 period configured for the PFS.
178 If you desire a real snapshot then the
180 directive may be what you are looking for.
182 .It Cm bstats Op Ar interval
185 B-tree statistics until interrupted.
188 seconds between each display.
189 The default interval is one second.
190 .\" ==== iostats ====
191 .It Cm iostats Op Ar interval
195 statistics until interrupted.
198 seconds between each display.
199 The default interval is one second.
200 .\" ==== history ====
201 .It Cm history Ar path ...
202 Show the modification history for
204 file's inode and data.
205 .\" ==== blockmap ====
207 Dump the blockmap for the file system.
210 blockmap is two-layer
211 blockmap representing the maximum possible file system size of 1 Exabyte.
212 Needless to say the second layer is only present for blocks which exist.
214 blockmap represents 8-Megabyte blocks, called big-blocks.
215 Each big-block has an append
216 point, a free byte count, and a typed zone id which allows content to be
217 reverse engineered to some degree.
221 allocations essentially appended to a selected big-block using
222 the append offset and deducted from the free byte count.
223 When space is freed the free byte count is adjusted but
225 does not track holes in big-blocks for reallocation.
226 A big-block must be completely freed, either
227 through normal file system operations or through reblocking, before
230 Data blocks can be shared by deducting the space used from the free byte
231 count for each shared references, though
233 does not yet make use of this feature.
234 This means the free byte count can legally go negative.
236 This command needs the
240 .It Cm show Op Ar lo Ns Cm \&: Ns Ar objid
242 By default this command will validate all B-Tree
243 linkages and CRCs, including data CRCs, and will report the most verbose
244 information it can dig up.
245 Any errors will show up with a
247 in column 1 along with various
250 If you specify a localization and object id field the dump will
251 search for the key printing nodes as it recurses down, and then
252 will iterate forwards.
256 the command will report less information about the inode contents.
260 the command will not report the content of the inode or other typed
265 the command will not report volume header information, big-block fill
266 ratios, mirror transaction ids, or report or check data CRCs.
267 B-tree CRCs and linkages are still checked.
269 This command needs the
273 .\" Dump the B-tree, record, large-data, and small-data blockmaps, showing
274 .\" physical block assignments and free space percentages.
275 .\" ==== namekey1 ====
276 .It Cm namekey1 Ar filename
279 64 bit directory hash for the specified file name, using
280 the original directory hash algorithm in version 1 of the file system.
281 The low 32 bits are used as an iterator for hash collisions and will be
283 .\" ==== namekey2 ====
284 .It Cm namekey2 Ar filename
287 64 bit directory hash for the specified file name, using
288 the new directory hash algorithm in version 2 of the file system.
289 The low 32 bits are still used as an iterator but will start out containing
290 part of the hash key.
291 .\" ==== namekey32 ====
292 .It Cm namekey32 Ar filename
293 Generate the top 32 bits of a
295 64 bit directory hash for the specified file name.
298 Shows extended information about all the mounted
301 At the moment volume identification, big-blocks information and space details
303 .\" ==== cleanup ====
304 .It Cm cleanup Op Ar filesystem ...
305 This is a meta-command which executes snapshot, prune, rebalance and reblock
306 commands on the specified
311 is specified this command will clean-up all
313 file systems in use, including PFS's.
314 To do this it will scan all
318 mounts, extract PFS id's, and clean-up each PFS found.
320 This command will by access a snapshots
321 directory and a configuration file for each
323 creating them if necessary.
327 version 2- the configuration file is
329 in the snapshots directory which defaults to
330 .Pa <pfs>/snapshots .
333 version 3+ the configuration file is saved in filesystem meta-data.
334 The snapshots directory defaults to
335 .Pa /var/hammer/<pfs>
336 .Pa ( /var/hammer/root
339 The format of the configuration file is:
340 .Bd -literal -offset indent
341 snapshots <period> <retention-time> [any]
342 prune <period> <max-runtime>
343 rebalance <period> <max-runtime>
344 reblock <period> <max-runtime>
345 recopy <period> <max-runtime>
349 .Bd -literal -offset indent
350 snapshots 1d 60d # 0d 0d for PFS /tmp, /var/tmp, /usr/obj
357 Time is given with a suffix of
363 meaning day, hour, minute and second.
367 directive has a period of 0 and a retention time of 0
368 then snapshot generation is disabled, removal of old snapshots are
369 disabled, and prunes will use
370 .Cm prune-everything .
373 directive has a period of 0 but a non-zero retention time
374 then this command will not create any new snapshots but will remove old
375 snapshots it finds based on the retention time.
377 By default only snapshots in the form
378 .Ql snap- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
382 directive is specified as a third argument on the
384 config line then any softlink of the form
385 .Ql *- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
387 .Ql *. Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
390 A prune max-runtime of 0 means unlimited.
392 If period hasn't passed since the previous
395 For example a day has passed when midnight is passed (localtime).
403 The default configuration file will create a daily snapshot, do a daily
404 pruning, rebalancing and reblocking run and a monthly recopy run.
405 Reblocking is defragmentation with a level of 95%,
406 and recopy is full defragmentation.
408 By default prune and rebalance operations are time limited to 5 minutes,
409 reblock operations to a bit over 5 minutes,
410 and recopy operations to a bit over 10 minutes.
411 Reblocking and recopy runs are each broken down into four separate functions:
412 btree, inodes, dirs and data.
413 Each function is time limited to the time given in the configuration file,
414 but the btree, inodes and dirs functions usually does not take very long time,
415 full defragmentation is always used for these three functions.
416 Also note that this directive will by default disable snapshots on
423 The defaults may be adjusted by modifying the configuration file.
424 The pruning and reblocking commands automatically maintain a cyclefile
425 for incremental operation.
426 If you interrupt (^C) the program the cyclefile will be updated,
428 may continue to run in the background for a few seconds until the
430 ioctl detects the interrupt.
433 PFS option can be set to use another location for the snapshots directory.
435 Work on this command is still in progress.
437 An ability to remove snapshots dynamically as the
438 file system becomes full.
440 .It Cm config Op Ar filesystem Op Ar configfile
443 If zero or one arguments are specified this function dumps the current
444 configuration file to stdout.
445 Zero arguments specifies the PFS containing the current directory.
446 This configuration file is stored in filesystem meta-data.
447 If two arguments are specified this function installs a new config file.
451 versions less than 3 the configuration file is by default stored in
452 .Pa <pfs>/snapshots/config ,
453 but in all later versions the configuration file is stored in filesystem
455 .\" ==== viconfig ====
456 .It Cm viconfig Op Ar filesystem
459 Edit the configuration file and reinstall into filesystem meta-data when done.
460 Zero arguments specifies the PFS containing the current directory.
462 .It Cm expand Ar filesystem Ar device
463 This command will format
465 and add all of its space to
469 All existing data contained on
471 will be destroyed by this operation!
476 filesystem, formatting will be denied.
477 You can overcome this sanity check
480 to erase the beginning sectors of the device.
481 Also remember that you have to specify
483 together with any other device that make the filesystem, colon-separated to
485 .\" ==== snapshot ====
486 .It Cm snapshot Oo Ar filesystem Oc Ar snapshot-dir
487 .It Cm snapshot Ar filesystem Ar snapshot-dir Op Ar note
488 Takes a snapshot of the file system either explicitly given by
490 or implicitly derived from the
492 argument and creates a symlink in the directory provided by
494 pointing to the snapshot.
497 is not a directory, it is assumed to be a format string passed to
499 with the current time as parameter.
502 refers to an existing directory, a default format string of
504 is assumed and used as name for the newly created symlink.
506 Snapshot is a per PFS operation, so a
508 file system and each PFS in it have to be snapshot separately.
510 Example, assuming that
518 are file systems on their own, the following invocations:
519 .Bd -literal -offset indent
520 hammer snapshot /mysnapshots
522 hammer snapshot /mysnapshots/%Y-%m-%d
524 hammer snapshot /obj /mysnapshots/obj-%Y-%m-%d
526 hammer snapshot /usr /my/snaps/usr "note"
529 Would create symlinks similar to:
530 .Bd -literal -offset indent
531 /mysnapshots/snap-20080627-1210 -> /@@0x10d2cd05b7270d16
533 /mysnapshots/2008-06-27 -> /@@0x10d2cd05b7270d16
535 /mysnapshots/obj-2008-06-27 -> /obj@@0x10d2cd05b7270d16
537 /my/snaps/usr/snap-20080627-1210 -> /usr@@0x10d2cd05b7270d16
542 version 3+ filesystem the snapshot is also recorded in meta-data
543 along with the optional
549 .It Cm snap Ar path Op Ar note
552 Create a snapshot for the PFS containing
554 and create a snapshot softlink.
555 If the path specified is a
556 directory a standard snapshot softlink will be created in the directory.
557 The snapshot softlink points to the base of the mounted PFS.
558 .It Cm snaplo Ar path Op Ar note
561 Create a snapshot for the PFS containing
563 and create a snapshot softlink.
564 If the path specified is a
565 directory a standard snapshot softlink will be created in the directory.
566 The snapshot softlink points into the directory it is contained in.
567 .It Cm snapq Ar dir Op Ar note
570 Create a snapshot for the PFS containing the specified directory but do
571 not create a softlink.
572 Instead output a path which can be used to access
573 the directory via the snapshot.
575 An absolute or relative path may be specified.
576 The path will be used as-is as a prefix in the path output to stdout.
578 snap and snapshot directives the snapshot transaction id will be registered
579 in the filesystem meta-data.
580 .It Cm snaprm Bro Ar path | transid Brc Ar ...
583 Remove a snapshot given its softlink or transaction id.
584 If specifying a transaction id
585 the snapshot is removed from filesystem meta-data but you are responsible
586 for removing any related softlinks.
587 .It Cm snapls Op Ar path ...
590 Dump the snapshot meta-data for PFSs containing each
592 listing all available snapshots and their notes.
593 If no arguments are specified snapshots for the PFS containing the
594 current directory are listed.
595 This is the definitive list of snapshots for the filesystem.
597 .It Cm prune Ar softlink-dir
598 Prune the file system based on previously created snapshot softlinks.
599 Pruning is the act of deleting file system history.
602 command will delete file system history such that
603 the file system state is retained for the given snapshots,
604 and all history after the latest snapshot.
605 By setting the per PFS parameter
607 history is guaranteed to be saved at least this time interval.
608 All other history is deleted.
610 The target directory is expected to contain softlinks pointing to
611 snapshots of the file systems you wish to retain.
612 The directory is scanned non-recursively and the mount points and
613 transaction ids stored in the softlinks are extracted and sorted.
614 The file system is then explicitly pruned according to what is found.
615 Cleaning out portions of the file system is as simple as removing a
616 snapshot softlink and then running the
620 As a safety measure pruning only occurs if one or more softlinks are found
623 snapshot id extension.
624 Currently the scanned softlink directory must contain softlinks pointing
628 The softlinks may specify absolute or relative paths.
629 Softlinks must use 20-character
631 transaction ids, as might be returned from
632 .Nm Cm synctid Ar filesystem .
634 Pruning is a per PFS operation, so a
636 file system and each PFS in it have to be pruned separately.
638 Note that pruning a file system may not immediately free-up space,
639 though typically some space will be freed if a large number of records are
641 The file system must be reblocked to completely recover all available space.
643 Example, lets say your that you didn't set
645 and snapshot directory contains the following links:
646 .Bd -literal -offset indent
647 lrwxr-xr-x 1 root wheel 29 May 31 17:57 snap1 ->
648 /usr/obj/@@0x10d2cd05b7270d16
650 lrwxr-xr-x 1 root wheel 29 May 31 17:58 snap2 ->
651 /usr/obj/@@0x10d2cd13f3fde98f
653 lrwxr-xr-x 1 root wheel 29 May 31 17:59 snap3 ->
654 /usr/obj/@@0x10d2cd222adee364
657 If you were to run the
659 command on this directory, then the
662 mount will be pruned to retain the above three snapshots.
663 In addition, history for modifications made to the file system older than
664 the oldest snapshot will be destroyed and history for potentially fine-grained
665 modifications made to the file system more recently than the most recent
666 snapshot will be retained.
668 If you then delete the
670 softlink and rerun the
673 history for modifications pertaining to that snapshot would be destroyed.
677 filesystem versions 3+ this command also scans the snapshots stored
678 in the filesystem meta-data and includes them in the prune.
679 .\" ==== prune-everything ====
680 .It Cm prune-everything Ar filesystem
681 This command will remove all historical records from the file system.
682 This directive is not normally used on a production system.
684 This command does not remove snapshot softlinks but will delete all
685 snapshots recorded in filesystem meta-data (for filesystem version 3+).
686 The user is responsible for deleting any softlinks.
687 .\" ==== rebalance ====
688 .It Cm rebalance Ar filesystem Op Ar saturation_level
689 This command will rebalance the B-tree, nodes with small number of
690 elements will be combined and element counts will be smoothed out
693 The saturation level is a percentage between 50 and 100.
694 The default is 75 percent.
695 .\" ==== reblock* ====
696 .It Cm reblock Ar filesystem Op Ar fill_percentage
697 .It Cm reblock-btree Ar filesystem Op Ar fill_percentage
698 .It Cm reblock-inodes Ar filesystem Op Ar fill_percentage
699 .It Cm reblock-dirs Ar filesystem Op Ar fill_percentage
700 .It Cm reblock-data Ar filesystem Op Ar fill_percentage
701 Attempt to defragment and free space for reuse by reblocking a live
704 Big-blocks cannot be reused by
706 until they are completely free.
707 This command also has the effect of reordering all elements, effectively
708 defragmenting the file system.
710 The default fill percentage is 100% and will cause the file system to be
711 completely defragmented.
712 All specified element types will be reallocated and rewritten.
713 If you wish to quickly free up space instead try specifying
714 a smaller fill percentage, such as 90% or 80% (the
716 suffix is not needed).
718 Since this command may rewrite the entire contents of the disk it is
719 best to do it incrementally from a
725 options to limit the run time.
726 The file system would thus be defragmented over long period of time.
728 It is recommended that separate invocations be used for each data type.
729 B-tree nodes, inodes, and directories are typically the most important
730 elements needing defragmentation.
731 Data can be defragmented over a longer period of time.
733 Reblocking is a per PFS operation, so a
735 file system and each PFS in it have to be reblocked separately.
736 .\" ==== pfs-status ====
737 .It Cm pfs-status Ar dirpath ...
738 Retrieve the mirroring configuration parameters for the specified
740 file systems or pseudo-filesystems (PFS's).
741 .\" ==== pfs-master ====
742 .It Cm pfs-master Ar dirpath Op Ar options
743 Create a pseudo-filesystem (PFS) inside a
746 Up to 65535 such file systems can be created.
747 Each PFS uses an independent inode numbering space making it suitable
748 for use as a replication source or target.
752 directive creates a PFS that you can read, write, and use as a mirroring
755 It is recommended to use a
757 mount to access a PFS, for more information see
759 .\" ==== pfs-slave ====
760 .It Cm pfs-slave Ar dirpath Op Ar options
761 Create a pseudo-filesystem (PFS) inside a
764 Up to 65535 such file systems can be created.
765 Each PFS uses an independent inode numbering space making it suitable
766 for use as a replication source or target.
770 directive creates a PFS that you can use as a mirroring target.
771 You will not be able to access a slave PFS until you have completed the
772 first mirroring operation with it as the target (its root directory will
773 not exist until then).
775 Access to the pfs-slave via the special softlink, as described in the
780 dynamically modify the snapshot transaction id by returning a dynamic result
785 A PFS can only be truly destroyed with the
788 Removing the softlink will not destroy the underlying PFS.
790 It is recommended to use a
792 mount to access a PFS, for more information see
794 .\" ==== pfs-update ====
795 .It Cm pfs-update Ar dirpath Op Ar options
796 Update the configuration parameters for an existing
798 file system or pseudo-filesystem.
799 Options that may be specified:
800 .Bl -tag -width indent
801 .It Cm sync-beg-tid= Ns Ar 0x16llx
802 This is the automatic snapshot access starting transaction id for
804 This parameter is normally updated automatically by the
808 It is important to note that accessing a mirroring slave
809 with a transaction id greater than the last fully synchronized transaction
810 id can result in an unreliable snapshot since you will be accessing
811 data that is still undergoing synchronization.
813 Manually modifying this field is dangerous and can result in a broken mirror.
814 .It Cm sync-end-tid= Ns Ar 0x16llx
815 This is the current synchronization point for mirroring slaves.
816 This parameter is normally updated automatically by the
820 Manually modifying this field is dangerous and can result in a broken mirror.
821 .It Cm shared-uuid= Ns Ar uuid
822 Set the shared UUID for this file system.
823 All mirrors must have the same shared UUID.
824 For safety purposes the
826 directives will refuse to operate on a target with a different shared UUID.
828 Changing the shared UUID on an existing, non-empty mirroring target,
829 including an empty but not completely pruned target,
830 can lead to corruption of the mirroring target.
831 .It Cm unique-uuid= Ns Ar uuid
832 Set the unique UUID for this file system.
833 This UUID should not be used anywhere else,
834 even on exact copies of the file system.
835 .It Cm label= Ns Ar string
836 Set a descriptive label for this file system.
837 .It Cm snapshots= Ns Ar string
838 Specify the snapshots directory which
841 will use to manage this PFS.
842 The snapshots directory does not need to be configured for
843 PFS masters and will default to
844 .Pa <pfs>/snapshots .
846 PFS slaves are mirroring slaves so you cannot configure a snapshots
847 directory on the slave itself to be managed by the slave's machine.
848 In fact, the slave will likely have a
850 sub-directory mirrored
851 from the master, but that directory contains the configuration the master
852 is using for its copy of the file system, not the configuration that we
853 want to use for our slave.
855 It is recommended that
856 .Pa <fs>/var/slaves/<name>
857 be configured for a PFS slave, where
863 is an appropriate label.
864 You can control snapshot retention on your slave independent of the master.
865 .It Cm snapshots-clear
868 directory path for this PFS.
869 .It Cm prune-min= Ns Ar N Ns Cm d
870 .It Cm prune-min= Ns Xo
872 .Ar hh Ns Op Cm \&: Ns Ar mm Ns Op Cm \&: Ns Ar ss
874 Set the minimum fine-grained data retention period.
876 always retains fine-grained history up to the most recent snapshot.
877 You can extend the retention period further by specifying a non-zero
879 Any snapshot softlinks within the retention period are ignored
880 for the purposes of pruning (the fine grained history is retained).
881 Number of days, hours, minutes and seconds are given as
886 Because the transaction id in the snapshot softlink cannot be used
887 to calculate a timestamp,
889 uses the earlier of the
893 field of the softlink to
894 determine which snapshots fall within the retention period.
895 Users must be sure to retain one of these two fields when manipulating
898 .\" ==== pfs-upgrade ====
899 .It Cm pfs-upgrade Ar dirpath
900 Upgrade a PFS from slave to master operation.
901 The PFS will be rolled back to the current end synchronization transaction id
902 (removing any partial synchronizations), and will then become writable.
906 currently supports only single masters and using
907 this command can easily result in file system corruption
908 if you don't know what you are doing.
910 This directive will refuse to run if any programs have open descriptors
911 in the PFS, including programs chdir'd into the PFS.
912 .\" ==== pfs-downgrade ====
913 .It Cm pfs-downgrade Ar dirpath
914 Downgrade a master PFS from master to slave operation
915 The PFS becomes read-only and access will be locked to its
918 This directive will refuse to run if any programs have open descriptors
919 in the PFS, including programs chdir'd into the PFS.
920 .\" ==== pfs-destroy ====
921 .It Cm pfs-destroy Ar dirpath
922 This permanently destroys a PFS.
924 This directive will refuse to run if any programs have open descriptors
925 in the PFS, including programs chdir'd into the PFS.
926 .\" ==== mirror-read ====
927 .It Cm mirror-read Ar filesystem Op Ar begin-tid
928 Generate a mirroring stream to stdout.
929 The stream ends when the transaction id space has been exhausted.
930 .\" ==== mirror-read-stream ====
931 .It Cm mirror-read-stream Ar filesystem Op Ar begin-tid
932 Generate a mirroring stream to stdout.
933 Upon completion the stream is paused until new data is synced to the
934 master, then resumed.
935 Operation continues until the pipe is broken.
936 .\" ==== mirror-write ====
937 .It Cm mirror-write Ar filesystem
938 Take a mirroring stream on stdin.
940 This command will fail if the
942 configuration field for the two file systems do not match.
944 If the target PFS does not exist this command will ask you whether
945 you want to create a compatible PFS slave for the target or not.
946 .\" ==== mirror-dump ====
952 to dump an ASCII representation of the mirroring stream.
953 .\" ==== mirror-copy ====
954 .\".It Cm mirror-copy Ar [[user@]host:]filesystem [[user@]host:]filesystem
955 .It Cm mirror-copy Xo
956 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
957 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
959 This is a shortcut which pipes a
964 If a remote host specification is made the program forks a
970 on the appropriate host.
971 The source may be a master or slave PFS, and the target must be a slave PFS.
973 This command also established full duplex communication and turns on
974 the two-way protocol feature which automatically negotiates transaction id
975 ranges without having to use a cyclefile.
976 If the operation completes successfully the target PFS's
979 Note that you must re-chdir into the target PFS to see the updated information.
980 If you do not you will still be in the previous snapshot.
982 If the target PFS does not exist this command will ask you whether
983 you want to create a compatible PFS slave for the target or not.
984 .\" ==== mirror-stream ====
985 .\".It Cm mirror-stream Ar [[user@]host:]filesystem [[user@]host:]filesystem
986 .It Cm mirror-stream Xo
987 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
988 .Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
990 This command works similarly to
992 but does not exit after the initial mirroring completes.
993 The mirroring operation will resume as changes continue to be made to the
995 The command is commonly used with
999 options to keep the mirroring target in sync with the source on a continuing
1002 If the pipe is broken the command will automatically retry after sleeping
1004 The time slept will be 15 seconds plus the time given in the
1008 This command also detects the initial-mirroring case and spends some
1009 time scanning the B-Tree to find good break points, allowing the initial
1010 bulk mirroring operation to be broken down into about 20 separate pieces.
1011 This means that the user can kill and restart the operation and it will
1012 not have to start from scratch once it has gotten past the first chunk.
1015 option may be used to disable this feature and perform an initial bulk
1017 .\" ==== version ====
1018 .It Cm version Ar filesystem
1019 This command returns the
1021 file system version for the specified
1023 as well as the range of versions supported in the kernel.
1026 option may be used to remove the summary at the end.
1027 .\" ==== version-upgrade ====
1028 .It Cm version-upgrade Ar filesystem Ar version Op Cm force
1029 This command upgrades the
1034 Once upgraded a file system may not be downgraded.
1035 If you wish to upgrade a file system to a version greater or equal to the
1036 work-in-progress version number you must specify the
1039 Use of WIP versions should be relegated to testing and may require wiping
1040 the filesystem as development progresses, even though the WIP version might
1044 This command operates on the entire
1046 file system and is not a per PFS operation.
1047 All PFS's will be affected.
1048 .Bl -tag -width indent
1051 default version, first
1056 default version, new directory entry layout.
1057 This version is using a new directory hash key.
1060 New snapshot management, using filesystem meta-data for saving
1061 configuration file and snapshots (transaction ids etc.).
1062 Also default snapshots directory has changed.
1065 New REDO, faster flush/sync.
1070 .Sh PSEUDO-FILESYSTEM (PFS) NOTES
1071 The root of a PFS is not hooked into the primary
1073 file system as a directory.
1076 creates a special softlink called
1078 (exactly 10 characters long) in the primary
1082 then modifies the contents of the softlink as read by
1084 and thus what you see with an
1086 command or if you were to
1089 If the PFS is a master the link reflects the current state of the PFS.
1090 If the PFS is a slave the link reflects the last completed snapshot, and the
1091 contents of the link will change when the next snapshot is completed, and
1096 utility employs numerous safeties to reduce user foot-shooting.
1099 directive requires that the target be configured as a slave and that the
1101 field of the mirroring source and target match.
1102 .Sh UPGRADE INSTRUCTIONS HAMMER V1 TO V2
1103 This upgrade changes the way directory entries are stored.
1104 It is possible to upgrade a V1 filesystem to V2 in place, but
1105 directories created prior to the upgrade will continue to use
1108 Note that the slave mirroring code in the target kernel had bugs in
1109 V1 which can create an incompatible root directory on the slave.
1112 master created after the upgrade with a
1114 slave created prior to the upgrade.
1116 Any directories created after upgrading will use a new layout.
1117 .Sh UPGRADE INSTRUCTIONS HAMMER V2 TO V3
1118 This upgrade adds meta-data elements to the B-Tree.
1119 It is possible to upgrade a V2 filesystem to V3 in place.
1120 After issuing the upgrade be sure to run a
1123 to perform post-upgrade tasks.
1125 After making this upgrade running a
1130 directory for each PFS mount into
1131 .Pa /var/hammer/<pfs> .
1134 root mount will migrate
1137 .Pa /var/hammer/root .
1138 Migration occurs only once and only if you have not specified
1139 a snapshots directory in the PFS configuration.
1140 If you have specified a snapshots directory in the PFS configuration no
1141 automatic migration will occur.
1143 For slaves, if you desire, you can migrate your snapshots
1144 config to the new location manually and then clear the
1145 snapshot directory configuration in the slave PFS.
1146 The new snapshots hierarchy is designed to work with
1147 both master and slave PFSs equally well.
1149 In addition, the old config file will be moved to meta-data,
1150 editable via the new
1154 The old config file will be deleted.
1155 Migration occurs only once.
1157 The V3 filesystem has new
1159 directives for creating snapshots.
1160 All snapshot directives, including the original, will create
1161 meta-data entries for the snapshots and the pruning code will
1162 automatically incorporate these entries into its list and
1163 expire them the same way it expires softlinks.
1164 If you by accident blow away your snapshot softlinks you can use the
1166 directive to get a definitive list from the meta-data and
1167 regenerate them from that list.
1172 to backup filesystems your scripts may be using the
1174 directive to generate transaction ids.
1175 This directive does not create a snapshot.
1176 You will have to modify your scripts to use the
1178 directive to generate the linkbuf for the softlink you create, or
1179 use one of the other
1184 directive will continue to work as expected and in V3 it will also
1185 record the snapshot transaction id in meta-data.
1186 You may also want to make use of the new
1188 tag for the meta-data.
1191 If you used to remove snapshot softlinks with
1193 you should probably start using the
1195 directive instead to also remove the related meta-data.
1196 The pruning code scans the meta-data so just removing the
1197 softlink is not sufficient.
1201 .Bl -tag -width ".It Pa <fs>/var/slaves/<name>" -compact
1202 .It Pa <pfs>/snapshots
1203 default per PFS snapshots directory
1206 .It Pa /var/hammer/<pfs>
1207 default per PFS snapshots directory (not root)
1210 .It Pa /var/hammer/root
1211 default snapshots directory for root directory
1214 .It Pa <snapshots>/config
1221 .It Pa <fs>/var/slaves/<name>
1222 recommended slave PFS snapshots directory
1230 .Xr periodic.conf 5 ,
1231 .Xr mount_hammer 8 ,
1237 utility first appeared in
1240 .An Matthew Dillon Aq dillon@backplane.com