hammer.8: version 3 update, mandoc(1) clean
[dragonfly.git] / sbin / hammer / hammer.8
CommitLineData
0dfeb6c8
MD
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.\"
de1c0b31 33.\" $DragonFly: src/sbin/hammer/hammer.8,v 1.58 2008/11/13 02:04:27 dillon Exp $
e0331f4f 34.\"
f85afb25 35.Dd November 5, 2009
0dfeb6c8
MD
36.Dt HAMMER 8
37.Os
38.Sh NAME
39.Nm hammer
40.Nd HAMMER file system utility
41.Sh SYNOPSIS
42.Nm
4567021b
TN
43.Fl h
44.Nm
45.Op Fl 2Bqrvy
48eadef9 46.Op Fl b Ar bandwidth
4567021b 47.Op Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
d7ae405c 48.Op Fl c Ar cyclefile
4567021b 49.Op Fl f Ar blkdev Ns Oo Ns Cm \&: Ns Ar blkdev Oc Ns *
6d9ab5c5 50.\" .Op Fl s Ar linkpath
48eadef9 51.Op Fl i Ar delay
99d6191f 52.Op Fl t Ar seconds
0dfeb6c8 53.Ar command
34bb69d8 54.Op Ar argument ...
0dfeb6c8 55.Sh DESCRIPTION
6d9ab5c5 56This manual page documents the
0dfeb6c8 57.Nm
6d9ab5c5 58utility which provides miscellaneous functions related to managing a
b4448f1a
TN
59.Nm HAMMER
60file system.
61For a general introduction to the
62.Nm HAMMER
63file system, its features, and
6d9ab5c5 64examples on how to set up and maintain one, see
b4448f1a 65.Xr HAMMER 5 .
0dfeb6c8
MD
66.Pp
67The options are as follows:
68.Bl -tag -width indent
69.It Fl h
84082922 70Get help.
d4e5b69b
MD
71.It Fl 2
72Tell the mirror commands to use a 2-way protocol, which allows
2010519f
TN
73automatic negotiation of transaction id ranges.
74This option is automatically enabled by the
4567021b 75.Cm mirror-copy
d4e5b69b 76command.
4567021b
TN
77.It Fl B
78Bulk Transfer.
79.Cm Mirror-stream
80will not attempt to break-up large initial bulk transfers into smaller pieces.
81This can save time but if the link is lost in the middle of the
82initial bulk transfer you will have to start over from scratch.
48eadef9
MD
83.It Fl b Ar bandwidth
84Specify a bandwidth limit in bytes per second for mirroring streams.
85This option is typically used to prevent batch mirroring operations from
86loading down the machine.
15fa4caf 87The bandwidth may be suffixed with
4567021b 88.Cm k , m ,
15fa4caf 89or
4567021b 90.Cm g
2010519f 91to specify values in kilobytes, megabytes, and gigabytes per second.
224ac2f2 92If no suffix is specified, bytes per second is assumed.
4567021b
TN
93.It Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
94Set the memory cache size for any raw
95.Tn I/O .
96The default is 16m.
97A suffix of
98.Cm k
99for kilobytes and
100.Cm m
101for megabytes is allowed,
102else the cache size is specified in bytes.
103.Pp
16265794
TN
104The read-behind/read-ahead defaults to 4
105.Nm HAMMER
106blocks.
4567021b
TN
107.Pp
108This option is typically only used with diagnostic commands
109as kernel-supported commands will use the kernel's buffer cache.
d7ae405c 110.It Fl c Ar cyclefile
84082922
TN
111When pruning and reblocking you can instruction
112.Nm
2010519f 113to start at the object id stored in the specified file.
84082922 114If the file does not exist
15fa4caf 115.Nm
84082922
TN
116will start at the beginning.
117If
15fa4caf 118.Nm
84082922 119is told to run for a
d7ae405c 120specific period of time and is unable to complete the operation it will
2010519f 121write out the current object id so the next run can pick up where it left off.
84082922
TN
122If
123.Nm
483bb69b
TN
124runs to completion it will delete
125.Ar cyclefile .
4567021b 126.It Fl f Ar blkdev Ns Oo Ns Cm \&: Ns Ar blkdev Oc Ns *
b4448f1a
TN
127Specify the volumes making up a
128.Nm HAMMER
129file system.
48eadef9
MD
130.It Fl i Ar delay
131When maintaining a streaming mirroring this option specifies the
132minimum delay after a batch ends before the next batch is allowed
133to start.
134The default is five seconds.
e95314de 135.It Fl q
bb92c669 136Decrease verboseness.
2010519f 137May be specified multiple times.
bb8e52c0
TN
138.It Fl r
139Specify recursion for those commands which support it.
99d6191f 140.It Fl t Ar seconds
0006adae 141When pruning and reblocking you can tell the utility to stop after a
2010519f
TN
142certain period of time.
143This option is used along with the
483bb69b 144.Fl c Ar cyclefile
b4448f1a 145option to prune or reblock a portion of the file system incrementally.
563b4845 146.It Fl v
2010519f
TN
147Increase verboseness.
148May be specified multiple times.
07485271
MN
149.It Fl y
150Force "yes" for any interactive question.
0dfeb6c8
MD
151.El
152.Pp
153The commands are as follows:
154.Bl -tag -width indent
15fa4caf 155.\" ==== synctid ====
4567021b 156.It Cm synctid Ar filesystem Op Cm quick
367431cf 157Generates a guaranteed, formal 64 bit transaction id representing the
b4448f1a
TN
158current state of the specified
159.Nm HAMMER
2010519f
TN
160file system.
161The file system will be synced to the media.
367431cf
MD
162.Pp
163If the
4567021b 164.Cm quick
b4448f1a
TN
165keyword is specified the file system will be soft-synced, meaning that a
166crash might still undo the state of the file system as of the transaction
367431cf
MD
167id returned but any new modifications will occur after the returned
168transaction id as expected.
bf2c6489 169.Pp
16265794
TN
170This operation does not create a snapshot.
171It is meant to be used
bf2c6489 172to track temporary fine-grained changes to a subset of files and
16265794
TN
173will only remain valid for
174.Ql @@
175snapshot access purposes for the
bf2c6489 176.Cm prune-min
16265794
TN
177period configured for the PFS.
178If you desire a real snapshot then the
bf2c6489
MD
179.Cm snapq
180directive may be what you are looking for.
15fa4caf 181.\" ==== bstats ====
4567021b 182.It Cm bstats Op Ar interval
b4448f1a
TN
183Output
184.Nm HAMMER
185B-tree statistics until interrupted.
84082922
TN
186Pause
187.Ar interval
b4448f1a 188seconds between each display.
84082922 189The default interval is one second.
15fa4caf 190.\" ==== iostats ====
4567021b 191.It Cm iostats Op Ar interval
b4448f1a
TN
192Output
193.Nm HAMMER
4567021b
TN
194.Tn I/O
195statistics until interrupted.
84082922
TN
196Pause
197.Ar interval
b4448f1a 198seconds between each display.
84082922 199The default interval is one second.
15fa4caf 200.\" ==== history ====
4567021b 201.It Cm history Ar path ...
b4448f1a
TN
202Show the modification history for
203.Nm HAMMER
204file's inode and data.
b46b99bf 205.\" ==== blockmap ====
4567021b
TN
206.It Cm blockmap
207Dump the blockmap for the file system.
208The
209.Nm HAMMER
210blockmap is two-layer
211blockmap representing the maximum possible file system size of 1 Exabyte.
b46b99bf 212Needless to say the second layer is only present for blocks which exist.
4567021b
TN
213.Nm HAMMER Ns 's
214blockmap represents 8-Megabyte blocks, called big-blocks.
215Each big-block has an append
b46b99bf
MD
216point, a free byte count, and a typed zone id which allows content to be
217reverse engineered to some degree.
218.Pp
4567021b
TN
219In
220.Nm HAMMER
221allocations essentially appended to a selected big-block using
222the append offset and deducted from the free byte count.
223When space is freed the free byte count is adjusted but
224.Nm HAMMER
225does not track holes in big-blocks for reallocation.
226A big-block must be completely freed, either
227through normal file system operations or through reblocking, before
b46b99bf
MD
228it can be reused.
229.Pp
230Data blocks can be shared by deducting the space used from the free byte
4567021b
TN
231count for each shared references, though
232.Nm HAMMER
233does not yet make use of this feature.
234This means the free byte count can legally go negative.
b46b99bf
MD
235.Pp
236This command needs the
237.Fl f
238flag.
15fa4caf 239.\" ==== show ====
4567021b
TN
240.It Cm show Op Ar lo Ns Cm \&: Ns Ar objid
241Dump the B-tree.
242By default this command will validate all B-Tree
b46b99bf
MD
243linkages and CRCs, including data CRCs, and will report the most verbose
244information it can dig up.
16265794
TN
245Any errors will show up with a
246.Ql B
247in column 1 along with various
b46b99bf
MD
248other error flags.
249.Pp
e7f926a5
MD
250If you specify a localization and object id field the dump will
251search for the key printing nodes as it recurses down, and then
252will iterate forwards.
253.Pp
b46b99bf
MD
254If you use
255.Fl q
256the command will report less information about the inode contents.
257.Pp
258If you use
259.Fl qq
260the command will not report the content of the inode or other typed
261data at all.
262.Pp
263If you use
264.Fl qqq
265the command will not report volume header information, big-block fill
4567021b
TN
266ratios, mirror transaction ids, or report or check data CRCs.
267B-tree CRCs and linkages are still checked.
b46b99bf 268.Pp
2010519f 269This command needs the
b4448f1a 270.Fl f
84082922
TN
271flag.
272.\" .It Ar blockmap
273.\" Dump the B-tree, record, large-data, and small-data blockmaps, showing
274.\" physical block assignments and free space percentages.
5e435c92 275.\" ==== namekey1 ====
4567021b 276.It Cm namekey1 Ar filename
b4448f1a
TN
277Generate a
278.Nm HAMMER
5e435c92 27964 bit directory hash for the specified file name, using
4567021b 280the original directory hash algorithm in version 1 of the file system.
cbd800c2
MD
281The low 32 bits are used as an iterator for hash collisions and will be
282output as 0.
5e435c92 283.\" ==== namekey2 ====
4567021b 284.It Cm namekey2 Ar filename
5e435c92
MD
285Generate a
286.Nm HAMMER
28764 bit directory hash for the specified file name, using
4567021b 288the new directory hash algorithm in version 2 of the file system.
5e435c92
MD
289The low 32 bits are still used as an iterator but will start out containing
290part of the hash key.
15fa4caf 291.\" ==== namekey32 ====
4567021b 292.It Cm namekey32 Ar filename
b4448f1a
TN
293Generate the top 32 bits of a
294.Nm HAMMER
2010519f 29564 bit directory hash for the specified file name.
b66b9421 296.\" ==== info ====
4567021b
TN
297.It Cm info
298Shows extended information about all the mounted
299.Nm HAMMER
300file systems.
301At the moment volume identification, big-blocks information and space details
302are shown.
6a6e350f 303.\" ==== cleanup ====
4567021b
TN
304.It Cm cleanup Op Ar filesystem ...
305This is a meta-command which executes snapshot, prune, rebalance and reblock
226f3799
TN
306commands on the specified
307.Nm HAMMER
16265794 308file systems.
226f3799
TN
309If no
310.Ar filesystem
311is specified this command will clean-up all
312.Nm HAMMER
313file systems in use, including PFS's.
314To do this it will scan all
315.Nm HAMMER
316and
317.Nm null
6a6e350f
MD
318mounts, extract PFS id's, and clean-up each PFS found.
319.Pp
f85afb25 320This command will access a snapshots
16265794 321directory and a configuration file for each
226f3799
TN
322.Ar filesystem ,
323creating them if necessary.
f85afb25
TN
324.Bl -tag -width indent
325.It Nm HAMMER No version 2-
326The configuration file is
16265794
TN
327.Pa config
328in the snapshots directory which defaults to
329.Pa <pfs>/snapshots .
f85afb25
TN
330.It Nm HAMMER No version 3+
331The configuration file is saved in filesystem meta-data.
16265794
TN
332The snapshots directory defaults to
333.Pa /var/hammer/<pfs>
334.Pa ( /var/hammer/root
335for root mount).
f85afb25 336.El
16265794 337.Pp
226f3799
TN
338The format of the configuration file is:
339.Bd -literal -offset indent
5e435c92 340snapshots <period> <retention-time> [any]
226f3799 341prune <period> <max-runtime>
f13fea8b 342rebalance <period> <max-runtime>
4567021b
TN
343reblock <period> <max-runtime>
344recopy <period> <max-runtime>
345.Ed
346.Pp
226f3799 347Defaults are:
4567021b
TN
348.Bd -literal -offset indent
349snapshots 1d 60d # 0d 0d for PFS /tmp, /var/tmp, /usr/obj
226f3799 350prune 1d 5m
f13fea8b 351rebalance 1d 5m
226f3799
TN
352reblock 1d 5m
353recopy 30d 10m
354.Ed
6a6e350f 355.Pp
483bb69b 356Time is given with a suffix of
226f3799
TN
357.Cm d ,
358.Cm h ,
359.Cm m
483bb69b 360or
226f3799
TN
361.Cm s
362meaning day, hour, minute and second.
5e435c92 363.Pp
4567021b
TN
364If the
365.Cm snapshots
366directive has a period of 0 and a retention time of 0
5e435c92
MD
367then snapshot generation is disabled, removal of old snapshots are
368disabled, and prunes will use
4567021b
TN
369.Cm prune-everything .
370If the
371.Cm snapshots
372directive has a period of 0 but a non-zero retention time
5e435c92
MD
373then this command will not create any new snapshots but will remove old
374snapshots it finds based on the retention time.
375.Pp
4567021b
TN
376By default only snapshots in the form
377.Ql snap- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
378are processed.
5e435c92 379If the
4567021b
TN
380.Cm any
381directive is specified as a third argument on the
382.Cm snapshots
383config line then any softlink of the form
384.Ql *- Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
385or
386.Ql *. Ns Ar yyyymmdd Ns Op - Ns Ar HHMM
387will be processed.
5e435c92 388.Pp
226f3799
TN
389A prune max-runtime of 0 means unlimited.
390.Pp
e0331f4f 391If period hasn't passed since the previous
4567021b 392.Cm cleanup
483bb69b
TN
393run nothing is done.
394For example a day has passed when midnight is passed (localtime).
e0331f4f
SW
395By default,
396.Dx
397is set up to run
398.Nm Ar cleanup
399nightly via
400.Xr periodic 8 .
226f3799
TN
401.Pp
402The default configuration file will create a daily snapshot, do a daily
f13fea8b 403pruning, rebalancing and reblocking run and a monthly recopy run.
226f3799
TN
404Reblocking is defragmentation with a level of 95%,
405and recopy is full defragmentation.
406.Pp
4567021b
TN
407By default prune and rebalance operations are time limited to 5 minutes,
408reblock operations to a bit over 5 minutes,
409and recopy operations to a bit over 10 minutes.
410Reblocking and recopy runs are each broken down into four separate functions:
411btree, inodes, dirs and data.
412Each function is time limited to the time given in the configuration file,
413but the btree, inodes and dirs functions usually does not take very long time,
414full defragmentation is always used for these three functions.
226f3799 415Also note that this directive will by default disable snapshots on
2010519f 416the following PFS's:
6a6e350f 417.Pa /tmp ,
226f3799 418.Pa /var/tmp
6a6e350f 419and
226f3799 420.Pa /usr/obj .
6a6e350f 421.Pp
16265794 422The defaults may be adjusted by modifying the configuration file.
6a6e350f
MD
423The pruning and reblocking commands automatically maintain a cyclefile
424for incremental operation.
4567021b
TN
425If you interrupt (^C) the program the cyclefile will be updated,
426but a sub-command
226f3799
TN
427may continue to run in the background for a few seconds until the
428.Nm HAMMER
6a6e350f 429ioctl detects the interrupt.
226f3799 430The
4567021b 431.Cm snapshots
226f3799 432PFS option can be set to use another location for the snapshots directory.
6a6e350f
MD
433.Pp
434Work on this command is still in progress.
4567021b
TN
435Expected additions:
436An ability to remove snapshots dynamically as the
226f3799 437file system becomes full.
83f2a3aa 438.\" ==== config ====
16265794
TN
439.It Cm config Op Ar filesystem Op Ar configfile
440.Nm ( HAMMER
441VERSION 3+)
442If zero or one arguments are specified this function dumps the current
443configuration file to stdout.
444Zero arguments specifies the PFS containing the current directory.
445This configuration file is stored in filesystem meta-data.
83f2a3aa
MD
446If two arguments are specified this function installs a new config file.
447.Pp
448In
449.Nm HAMMER
16265794
TN
450versions less than 3 the configuration file is by default stored in
451.Pa <pfs>/snapshots/config ,
83f2a3aa
MD
452but in all later versions the configuration file is stored in filesystem
453meta-data.
16265794
TN
454.\" ==== viconfig ====
455.It Cm viconfig Op Ar filesystem
456.Nm ( HAMMER
457VERSION 3+)
458Edit the configuration file and reinstall into filesystem meta-data when done.
459Zero arguments specifies the PFS containing the current directory.
ceed7673 460.\" ==== expand ====
4567021b 461.It Cm expand Ar filesystem Ar device
ceed7673
MN
462This command will format
463.Ar device
464and add all of its space to
465.Ar filesystem .
466.Pp
4567021b
TN
467.Em NOTE!
468All existing data contained on
ceed7673 469.Ar device
4567021b
TN
470will be destroyed by this operation!
471If
ceed7673
MN
472.Ar device
473contains a valid
474.Nm HAMMER
16265794
TN
475filesystem, formatting will be denied.
476You can overcome this sanity check
ceed7673
MN
477by using
478.Xr dd 1
479to erase the beginning sectors of the device.
480Also remember that you have to specify
481.Ar device ,
482together with any other device that make the filesystem, colon-separated to
483.Xr mount_hammer 8 .
0e999592 484.\" ==== snapshot ====
4567021b 485.It Cm snapshot Oo Ar filesystem Oc Ar snapshot-dir
16265794 486.It Cm snapshot Ar filesystem Ar snapshot-dir Op Ar note
0e999592
TN
487Takes a snapshot of the file system either explicitly given by
488.Ar filesystem
489or implicitly derived from the
490.Ar snapshot-dir
491argument and creates a symlink in the directory provided by
492.Ar snapshot-dir
493pointing to the snapshot.
494If
495.Ar snapshot-dir
496is not a directory, it is assumed to be a format string passed to
497.Xr strftime 3
498with the current time as parameter.
499If
500.Ar snapshot-dir
4567021b
TN
501refers to an existing directory, a default format string of
502.Ql snap-%Y%d%m-%H%M
0e999592
TN
503is assumed and used as name for the newly created symlink.
504.Pp
505Snapshot is a per PFS operation, so a
506.Nm HAMMER
507file system and each PFS in it have to be snapshot separately.
508.Pp
509Example, assuming that
510.Pa /mysnapshots
511is on file system
512.Pa /
513and that
514.Pa /obj
16265794
TN
515and
516.Pa /usr
517are file systems on their own, the following invocations:
0e999592
TN
518.Bd -literal -offset indent
519hammer snapshot /mysnapshots
520
521hammer snapshot /mysnapshots/%Y-%m-%d
522
523hammer snapshot /obj /mysnapshots/obj-%Y-%m-%d
b5ec5ad4 524
16265794 525hammer snapshot /usr /my/snaps/usr "note"
0e999592
TN
526.Ed
527.Pp
b5ec5ad4 528Would create symlinks similar to:
0e999592
TN
529.Bd -literal -offset indent
530/mysnapshots/snap-20080627-1210 -> /@@0x10d2cd05b7270d16
531
532/mysnapshots/2008-06-27 -> /@@0x10d2cd05b7270d16
533
534/mysnapshots/obj-2008-06-27 -> /obj@@0x10d2cd05b7270d16
16265794
TN
535
536/my/snaps/usr/snap-20080627-1210 -> /usr@@0x10d2cd05b7270d16
0e999592 537.Ed
b5ec5ad4
MD
538.Pp
539When run on a
540.Nm HAMMER
541version 3+ filesystem the snapshot is also recorded in meta-data
16265794
TN
542along with the optional
543.Ar note .
544See the
b5ec5ad4
MD
545.Cm snapls
546directive.
83f2a3aa 547.\" ==== snap* ====
16265794
TN
548.It Cm snap Ar path Op Ar note
549.Nm ( HAMMER
550VERSION 3+)
551Create a snapshot for the PFS containing
552.Ar path
553and create a snapshot softlink.
554If the path specified is a
83f2a3aa
MD
555directory a standard snapshot softlink will be created in the directory.
556The snapshot softlink points to the base of the mounted PFS.
16265794
TN
557.It Cm snaplo Ar path Op Ar note
558.Nm ( HAMMER
559VERSION 3+)
560Create a snapshot for the PFS containing
561.Ar path
562and create a snapshot softlink.
563If the path specified is a
83f2a3aa
MD
564directory a standard snapshot softlink will be created in the directory.
565The snapshot softlink points into the directory it is contained in.
16265794
TN
566.It Cm snapq Ar dir Op Ar note
567.Nm ( HAMMER
568VERSION 3+)
83f2a3aa 569Create a snapshot for the PFS containing the specified directory but do
16265794
TN
570not create a softlink.
571Instead output a path which can be used to access
83f2a3aa 572the directory via the snapshot.
bf2c6489 573.Pp
16265794
TN
574An absolute or relative path may be specified.
575The path will be used as-is as a prefix in the path output to stdout.
576As with the other
bf2c6489
MD
577snap and snapshot directives the snapshot transaction id will be registered
578in the filesystem meta-data.
16265794
TN
579.It Cm snaprm Bro Ar path | transid Brc Ar ...
580.Nm ( HAMMER
581VERSION 3+)
582Remove a snapshot given its softlink or transaction id.
583If specifying a transaction id
83f2a3aa
MD
584the snapshot is removed from filesystem meta-data but you are responsible
585for removing any related softlinks.
16265794
TN
586.It Cm snapls Op Ar path ...
587.Nm ( HAMMER
588VERSION 3+)
589Dump the snapshot meta-data for PFSs containing each
590.Ar path
591listing all available snapshots and their notes.
592If no arguments are specified snapshots for the PFS containing the
593current directory are listed.
594This is the definitive list of snapshots for the filesystem.
15fa4caf 595.\" ==== prune ====
4567021b 596.It Cm prune Ar softlink-dir
b4448f1a
TN
597Prune the file system based on previously created snapshot softlinks.
598Pruning is the act of deleting file system history.
84082922 599The
4567021b
TN
600.Cm prune
601command will delete file system history such that
b4448f1a 602the file system state is retained for the given snapshots,
4567021b
TN
603and all history after the latest snapshot.
604By setting the per PFS parameter
605.Cm prune-min ,
606history is guaranteed to be saved at least this time interval.
607All other history is deleted.
84082922 608.Pp
e8969ef0 609The target directory is expected to contain softlinks pointing to
2010519f
TN
610snapshots of the file systems you wish to retain.
611The directory is scanned non-recursively and the mount points and
612transaction ids stored in the softlinks are extracted and sorted.
b4448f1a 613The file system is then explicitly pruned according to what is found.
4567021b
TN
614Cleaning out portions of the file system is as simple as removing a
615snapshot softlink and then running the
616.Cm prune
e8969ef0
MD
617command.
618.Pp
619As a safety measure pruning only occurs if one or more softlinks are found
4567021b
TN
620containing the
621.Ql @@
622snapshot id extension.
e8969ef0 623Currently the scanned softlink directory must contain softlinks pointing
b4448f1a
TN
624to a single
625.Nm HAMMER
2010519f
TN
626mount.
627The softlinks may specify absolute or relative paths.
4567021b
TN
628Softlinks must use 20-character
629.Ql @@0x%016llx
630transaction ids, as might be returned from
631.Nm Cm synctid Ar filesystem .
e8969ef0 632.Pp
226f3799 633Pruning is a per PFS operation, so a
15fa4caf
TN
634.Nm HAMMER
635file system and each PFS in it have to be pruned separately.
636.Pp
637Note that pruning a file system may not immediately free-up space,
638though typically some space will be freed if a large number of records are
2010519f
TN
639pruned out.
640The file system must be reblocked to completely recover all available space.
15fa4caf 641.Pp
4567021b
TN
642Example, lets say your that you didn't set
643.Cm prune-min ,
644and snapshot directory contains the following links:
226f3799 645.Bd -literal -offset indent
f51a18e7
SW
646lrwxr-xr-x 1 root wheel 29 May 31 17:57 snap1 ->
647/usr/obj/@@0x10d2cd05b7270d16
648
649lrwxr-xr-x 1 root wheel 29 May 31 17:58 snap2 ->
650/usr/obj/@@0x10d2cd13f3fde98f
651
652lrwxr-xr-x 1 root wheel 29 May 31 17:59 snap3 ->
653/usr/obj/@@0x10d2cd222adee364
654.Ed
e8969ef0 655.Pp
84082922 656If you were to run the
4567021b 657.Cm prune
b4448f1a
TN
658command on this directory, then the
659.Nm HAMMER
f51a18e7
SW
660.Pa /usr/obj
661mount will be pruned to retain the above three snapshots.
2010519f
TN
662In addition, history for modifications made to the file system older than
663the oldest snapshot will be destroyed and history for potentially fine-grained
664modifications made to the file system more recently than the most recent
665snapshot will be retained.
666.Pp
667If you then delete the
668.Pa snap2
669softlink and rerun the
4567021b 670.Cm prune
84082922
TN
671command,
672history for modifications pertaining to that snapshot would be destroyed.
83f2a3aa
MD
673.Pp
674In
675.Nm HAMMER
676filesystem versions 3+ this command also scans the snapshots stored
677in the filesystem meta-data and includes them in the prune.
15fa4caf 678.\" ==== prune-everything ====
4567021b 679.It Cm prune-everything Ar filesystem
b4448f1a 680This command will remove all historical records from the file system.
b5aaba7f 681This directive is not normally used on a production system.
83f2a3aa
MD
682.Pp
683This command does not remove snapshot softlinks but will delete all
684snapshots recorded in filesystem meta-data (for filesystem version 3+).
685The user is responsible for deleting any softlinks.
797a0b63 686.\" ==== rebalance ====
4567021b
TN
687.It Cm rebalance Ar filesystem Op Ar saturation_level
688This command will rebalance the B-tree, nodes with small number of
797a0b63
MD
689elements will be combined and element counts will be smoothed out
690between nodes.
691.Pp
4567021b
TN
692The saturation level is a percentage between 50 and 100.
693The default is 75 percent.
16265794 694.\" ==== reblock* ====
4567021b
TN
695.It Cm reblock Ar filesystem Op Ar fill_percentage
696.It Cm reblock-btree Ar filesystem Op Ar fill_percentage
697.It Cm reblock-inodes Ar filesystem Op Ar fill_percentage
698.It Cm reblock-dirs Ar filesystem Op Ar fill_percentage
699.It Cm reblock-data Ar filesystem Op Ar fill_percentage
9e29c876 700Attempt to defragment and free space for reuse by reblocking a live
b4448f1a
TN
701.Nm HAMMER
702file system.
4567021b 703Big-blocks cannot be reused by
b4448f1a
TN
704.Nm HAMMER
705until they are completely free.
9e29c876 706This command also has the effect of reordering all elements, effectively
b4448f1a 707defragmenting the file system.
ba7b52c9 708.Pp
b4448f1a 709The default fill percentage is 100% and will cause the file system to be
2010519f
TN
710completely defragmented.
711All specified element types will be reallocated and rewritten.
712If you wish to quickly free up space instead try specifying
15fa4caf
TN
713a smaller fill percentage, such as 90% or 80% (the
714.Sq %
715suffix is not needed).
ba7b52c9 716.Pp
9e29c876 717Since this command may rewrite the entire contents of the disk it is
84082922
TN
718best to do it incrementally from a
719.Xr cron 8
720job along with the
9e29c876
MD
721.Fl c Ar cyclefile
722and
99d6191f 723.Fl t Ar seconds
9e29c876 724options to limit the run time.
b4448f1a 725The file system would thus be defragmented over long period of time.
9e29c876
MD
726.Pp
727It is recommended that separate invocations be used for each data type.
d2ee8e9f 728B-tree nodes, inodes, and directories are typically the most important
2010519f
TN
729elements needing defragmentation.
730Data can be defragmented over a longer period of time.
15fa4caf 731.Pp
226f3799 732Reblocking is a per PFS operation, so a
15fa4caf
TN
733.Nm HAMMER
734file system and each PFS in it have to be reblocked separately.
735.\" ==== pfs-status ====
4567021b 736.It Cm pfs-status Ar dirpath ...
34ebae70 737Retrieve the mirroring configuration parameters for the specified
b4448f1a 738.Nm HAMMER
2010519f 739file systems or pseudo-filesystems (PFS's).
15fa4caf 740.\" ==== pfs-master ====
4567021b 741.It Cm pfs-master Ar dirpath Op Ar options
b4448f1a
TN
742Create a pseudo-filesystem (PFS) inside a
743.Nm HAMMER
744file system.
745Up to 65535 such file systems can be created.
765c85a8 746Each PFS uses an independent inode numbering space making it suitable
d4e5b69b
MD
747for use as a replication source or target.
748.Pp
749The
4567021b 750.Cm pfs-master
d4e5b69b
MD
751directive creates a PFS that you can read, write, and use as a mirroring
752source.
bb8e52c0
TN
753.Pp
754It is recommended to use a
755.Nm null
756mount to access a PFS, for more information see
757.Xr HAMMER 5 .
15fa4caf 758.\" ==== pfs-slave ====
4567021b 759.It Cm pfs-slave Ar dirpath Op Ar options
b4448f1a
TN
760Create a pseudo-filesystem (PFS) inside a
761.Nm HAMMER
762file system.
763Up to 65535 such file systems can be created.
765c85a8 764Each PFS uses an independent inode numbering space making it suitable
d4e5b69b
MD
765for use as a replication source or target.
766.Pp
767The
4567021b 768.Cm pfs-slave
765c85a8 769directive creates a PFS that you can use as a mirroring target.
d4e5b69b
MD
770You will not be able to access a slave PFS until you have completed the
771first mirroring operation with it as the target (its root directory will
772not exist until then).
34ebae70 773.Pp
4567021b 774Access to the pfs-slave via the special softlink, as described in the
2010519f
TN
775.Sx PFS NOTES
776below, allows
b4448f1a
TN
777.Nm HAMMER
778to
84082922
TN
779dynamically modify the snapshot transaction id by returning a dynamic result
780from
781.Xr readlink 2
782calls.
d4e5b69b 783.Pp
765c85a8 784A PFS can only be truly destroyed with the
4567021b 785.Cm pfs-destroy
d4e5b69b
MD
786directive.
787Removing the softlink will not destroy the underlying PFS.
bb8e52c0
TN
788.Pp
789It is recommended to use a
790.Nm null
791mount to access a PFS, for more information see
792.Xr HAMMER 5 .
15fa4caf 793.\" ==== pfs-update ====
4567021b 794.It Cm pfs-update Ar dirpath Op Ar options
b4448f1a
TN
795Update the configuration parameters for an existing
796.Nm HAMMER
4567021b 797file system or pseudo-filesystem.
2010519f 798Options that may be specified:
34ebae70 799.Bl -tag -width indent
4567021b 800.It Cm sync-beg-tid= Ns Ar 0x16llx
2010519f
TN
801This is the automatic snapshot access starting transaction id for
802mirroring slaves.
34ebae70 803This parameter is normally updated automatically by the
4567021b 804.Cm mirror-write
34ebae70
MD
805directive.
806.Pp
807It is important to note that accessing a mirroring slave
765c85a8 808with a transaction id greater than the last fully synchronized transaction
34ebae70
MD
809id can result in an unreliable snapshot since you will be accessing
810data that is still undergoing synchronization.
811.Pp
4567021b
TN
812Manually modifying this field is dangerous and can result in a broken mirror.
813.It Cm sync-end-tid= Ns Ar 0x16llx
ddc8e722 814This is the current synchronization point for mirroring slaves.
34ebae70 815This parameter is normally updated automatically by the
4567021b 816.Cm mirror-write
34ebae70
MD
817directive.
818.Pp
2010519f 819Manually modifying this field is dangerous and can result in a broken mirror.
4567021b 820.It Cm shared-uuid= Ns Ar uuid
2010519f
TN
821Set the shared UUID for this file system.
822All mirrors must have the same shared UUID.
823For safety purposes the
4567021b 824.Cm mirror-write
2010519f 825directives will refuse to operate on a target with a different shared UUID.
34ebae70 826.Pp
84082922 827Changing the shared UUID on an existing, non-empty mirroring target,
2010519f
TN
828including an empty but not completely pruned target,
829can lead to corruption of the mirroring target.
4567021b 830.It Cm unique-uuid= Ns Ar uuid
2010519f
TN
831Set the unique UUID for this file system.
832This UUID should not be used anywhere else,
833even on exact copies of the file system.
4567021b 834.It Cm label= Ns Ar string
b4448f1a 835Set a descriptive label for this file system.
4567021b 836.It Cm snapshots= Ns Ar string
226f3799
TN
837Specify the snapshots directory which
838.Nm
4567021b 839.Cm cleanup
2010519f 840will use to manage this PFS.
f85afb25
TN
841.Bl -tag -width indent
842.It Nm HAMMER No version 2-
2010519f 843The snapshots directory does not need to be configured for
226f3799
TN
844PFS masters and will default to
845.Pa <pfs>/snapshots .
ff1c9800
MD
846.Pp
847PFS slaves are mirroring slaves so you cannot configure a snapshots
848directory on the slave itself to be managed by the slave's machine.
226f3799
TN
849In fact, the slave will likely have a
850.Pa snapshots
851sub-directory mirrored
ff1c9800 852from the master, but that directory contains the configuration the master
226f3799 853is using for its copy of the file system, not the configuration that we
ff1c9800
MD
854want to use for our slave.
855.Pp
226f3799
TN
856It is recommended that
857.Pa <fs>/var/slaves/<name>
858be configured for a PFS slave, where
859.Pa <fs>
860is the base
861.Nm HAMMER
862file system, and
863.Pa <name>
864is an appropriate label.
f85afb25
TN
865.It Nm HAMMER No version 3+
866The snapshots directory does not need to be configured for PFS masters or
867slaves.
868The snapshots directory defaults to
869.Pa /var/hammer/<pfs>
870.Pa ( /var/hammer/root
871for root mount).
872.El
873.Pp
2010519f 874You can control snapshot retention on your slave independent of the master.
4567021b
TN
875.It Cm snapshots-clear
876Zero out the
877.Cm snapshots
878directory path for this PFS.
879.It Cm prune-min= Ns Ar N Ns Cm d
f85afb25
TN
880.It Cm prune-min= Ns Oo Ar N Ns Cm d/ Oc Ns \
881Ar hh Ns Op Cm \&: Ns Ar mm Ns Op Cm \&: Ns Ar ss
e7f926a5
MD
882Set the minimum fine-grained data retention period.
883.Nm HAMMER
0bd7a37c
MD
884always retains fine-grained history up to the most recent snapshot.
885You can extend the retention period further by specifying a non-zero
4567021b
TN
886pruning minimum.
887Any snapshot softlinks within the retention period are ignored
888for the purposes of pruning (the fine grained history is retained).
889Number of days, hours, minutes and seconds are given as
890.Ar N , hh , mm
891and
892.Ar ss .
0bd7a37c
MD
893.Pp
894Because the transaction id in the snapshot softlink cannot be used
895to calculate a timestamp,
896.Nm HAMMER
4567021b
TN
897uses the earlier of the
898.Fa st_ctime
899or
900.Fa st_mtime
901field of the softlink to
0bd7a37c
MD
902determine which snapshots fall within the retention period.
903Users must be sure to retain one of these two fields when manipulating
904the softlink.
34ebae70 905.El
34bb69d8 906.\" ==== pfs-upgrade ====
4567021b 907.It Cm pfs-upgrade Ar dirpath
2010519f 908Upgrade a PFS from slave to master operation.
4567021b 909The PFS will be rolled back to the current end synchronization transaction id
2010519f 910(removing any partial synchronizations), and will then become writable.
34bb69d8
TN
911.Pp
912.Em WARNING!
913.Nm HAMMER
914currently supports only single masters and using
2010519f
TN
915this command can easily result in file system corruption
916if you don't know what you are doing.
34bb69d8
TN
917.Pp
918This directive will refuse to run if any programs have open descriptors
919in the PFS, including programs chdir'd into the PFS.
920.\" ==== pfs-downgrade ====
4567021b 921.It Cm pfs-downgrade Ar dirpath
2010519f
TN
922Downgrade a master PFS from master to slave operation
923The PFS becomes read-only and access will be locked to its
4567021b 924.Cm sync-end-tid .
34bb69d8
TN
925.Pp
926This directive will refuse to run if any programs have open descriptors
927in the PFS, including programs chdir'd into the PFS.
928.\" ==== pfs-destroy ====
4567021b 929.It Cm pfs-destroy Ar dirpath
34bb69d8
TN
930This permanently destroys a PFS.
931.Pp
932This directive will refuse to run if any programs have open descriptors
933in the PFS, including programs chdir'd into the PFS.
15fa4caf 934.\" ==== mirror-read ====
4567021b 935.It Cm mirror-read Ar filesystem Op Ar begin-tid
34ebae70 936Generate a mirroring stream to stdout.
48eadef9 937The stream ends when the transaction id space has been exhausted.
15fa4caf 938.\" ==== mirror-read-stream ====
4567021b 939.It Cm mirror-read-stream Ar filesystem Op Ar begin-tid
48eadef9
MD
940Generate a mirroring stream to stdout.
941Upon completion the stream is paused until new data is synced to the
942master, then resumed.
943Operation continues until the pipe is broken.
15fa4caf 944.\" ==== mirror-write ====
4567021b 945.It Cm mirror-write Ar filesystem
34bb69d8 946Take a mirroring stream on stdin.
34ebae70
MD
947.Pp
948This command will fail if the
4567021b 949.Cm shared-uuid
b4448f1a 950configuration field for the two file systems do not match.
01a72c9f
MD
951.Pp
952If the target PFS does not exist this command will ask you whether
953you want to create a compatible PFS slave for the target or not.
15fa4caf 954.\" ==== mirror-dump ====
4567021b 955.It Cm mirror-dump
15fa4caf 956A
4567021b 957.Cm mirror-read
15fa4caf 958can be piped into a
4567021b 959.Cm mirror-dump
2010519f 960to dump an ASCII representation of the mirroring stream.
15fa4caf 961.\" ==== mirror-copy ====
4567021b 962.\".It Cm mirror-copy Ar [[user@]host:]filesystem [[user@]host:]filesystem
f85afb25
TN
963.It Cm mirror-copy \
964Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem \
965Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
84082922 966This is a shortcut which pipes a
4567021b 967.Cm mirror-read
84082922 968command to a
4567021b 969.Cm mirror-write
2010519f
TN
970command.
971If a remote host specification is made the program forks a
6d9ab5c5 972.Xr ssh 1
84082922 973and execs the
4567021b 974.Cm mirror-read
84082922 975and/or
4567021b 976.Cm mirror-write
84082922 977on the appropriate host.
9c67b4d2 978The source may be a master or slave PFS, and the target must be a slave PFS.
d4e5b69b 979.Pp
9c67b4d2 980This command also established full duplex communication and turns on
2010519f
TN
981the two-way protocol feature which automatically negotiates transaction id
982ranges without having to use a cyclefile.
84082922 983If the operation completes successfully the target PFS's
4567021b 984.Cm sync-end-tid
2010519f
TN
985will be updated.
986Note that you must re-chdir into the target PFS to see the updated information.
987If you do not you will still be in the previous snapshot.
01a72c9f
MD
988.Pp
989If the target PFS does not exist this command will ask you whether
990you want to create a compatible PFS slave for the target or not.
15fa4caf 991.\" ==== mirror-stream ====
4567021b 992.\".It Cm mirror-stream Ar [[user@]host:]filesystem [[user@]host:]filesystem
f85afb25
TN
993.It Cm mirror-stream \
994Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem \
995Oo Oo Ar user Oc Ns Cm @ Ns Ar host Ns Cm \&: Oc Ns Ar filesystem
48eadef9 996This command works similarly to
4567021b 997.Cm mirror-copy
e7f926a5
MD
998but does not exit after the initial mirroring completes.
999The mirroring operation will resume as changes continue to be made to the
1000master.
2010519f 1001The command is commonly used with
48eadef9
MD
1002.Fl i Ar delay
1003and
1004.Fl b Ar bandwidth
1005options to keep the mirroring target in sync with the source on a continuing
1006basis.
e7f926a5
MD
1007.Pp
1008If the pipe is broken the command will automatically retry after sleeping
4567021b
TN
1009for a short while.
1010The time slept will be 15 seconds plus the time given in the
0bd7a37c
MD
1011.Fl i
1012option.
e7f926a5
MD
1013.Pp
1014This command also detects the initial-mirroring case and spends some
1015time scanning the B-Tree to find good break points, allowing the initial
1016bulk mirroring operation to be broken down into about 20 separate pieces.
1017This means that the user can kill and restart the operation and it will
1018not have to start from scratch once it has gotten past the first chunk.
0bd7a37c
MD
1019The
1020.Fl B
1021option may be used to disable this feature and perform an initial bulk
1022transfer instead.
de1c0b31 1023.\" ==== version ====
4567021b 1024.It Cm version Ar filesystem
3f2565b9
SW
1025This command returns the
1026.Nm HAMMER
4567021b
TN
1027file system version for the specified
1028.Ar filesystem
1029as well as the range of versions supported in the kernel.
de1c0b31
MD
1030The
1031.Fl q
1032option may be used to remove the summary at the end.
1033.\" ==== version-upgrade ====
4567021b 1034.It Cm version-upgrade Ar filesystem Ar version Op Cm force
3f2565b9
SW
1035This command upgrades the
1036.Nm HAMMER
4567021b
TN
1037.Ar filesystem
1038to the specified
1039.Ar version .
1040Once upgraded a file system may not be downgraded.
1041If you wish to upgrade a file system to a version greater or equal to the
de1c0b31 1042work-in-progress version number you must specify the
4567021b 1043.Cm force
de1c0b31
MD
1044directive.
1045Use of WIP versions should be relegated to testing and may require wiping
1046the filesystem as development progresses, even though the WIP version might
1047not change.
1048.Pp
4567021b
TN
1049.Em NOTE!
1050This command operates on the entire
3f2565b9 1051.Nm HAMMER
4567021b 1052file system and is not a per PFS operation.
3f2565b9 1053All PFS's will be affected.
de1c0b31
MD
1054.Bl -tag -width indent
1055.It 1
3f2565b9
SW
1056.Dx 2.0
1057default version, first
1058.Nm HAMMER
1059release.
de1c0b31 1060.It 2
4567021b
TN
1061.Dx 2.3
1062default version, new directory entry layout.
1063This version is using a new directory hash key.
16265794
TN
1064.It 3
1065.Dx 2.5 .
1066New snapshot management, using filesystem meta-data for saving
1067configuration file and snapshots (transaction ids etc.).
1068Also default snapshots directory has changed.
1069.It 4
1070.Dx 2.5 .
1071New REDO, faster flush/sync.
1072WIP.
de1c0b31 1073.El
0dfeb6c8 1074.El
f51a18e7 1075.\".Sh EXAMPLES
4567021b 1076.Sh PSEUDO-FILESYSTEM (PFS) NOTES
b4448f1a
TN
1077The root of a PFS is not hooked into the primary
1078.Nm HAMMER
2010519f 1079file system as a directory.
b4448f1a
TN
1080Instead,
1081.Nm HAMMER
4567021b
TN
1082creates a special softlink called
1083.Ql @@PFS%05d
1084(exactly 10 characters long) in the primary
b4448f1a
TN
1085.Nm HAMMER
1086file system.
1087.Nm HAMMER
1088then modifies the contents of the softlink as read by
9c67b4d2 1089.Xr readlink 2 ,
84082922 1090and thus what you see with an
16265794 1091.Nm ls
84082922 1092command or if you were to
16265794 1093.Nm cd
84082922 1094into the link.
9c67b4d2
MD
1095If the PFS is a master the link reflects the current state of the PFS.
1096If the PFS is a slave the link reflects the last completed snapshot, and the
1097contents of the link will change when the next snapshot is completed, and
1098so forth.
1099.Pp
2010519f 1100The
9c67b4d2 1101.Nm
2010519f 1102utility employs numerous safeties to reduce user foot-shooting.
9c67b4d2 1103The
4567021b 1104.Cm mirror-copy
9c67b4d2 1105directive requires that the target be configured as a slave and that the
4567021b 1106.Cm shared-uuid
9c67b4d2 1107field of the mirroring source and target match.
bf2c6489 1108.Sh UPGRADE INSTRUCTIONS HAMMER V1 TO V2
16265794
TN
1109This upgrade changes the way directory entries are stored.
1110It is possible to upgrade a V1 filesystem to V2 in place, but
bf2c6489
MD
1111directories created prior to the upgrade will continue to use
1112the old layout.
1113.Pp
1114Note that the slave mirroring code in the target kernel had bugs in
1115V1 which can create an incompatible root directory on the slave.
16265794
TN
1116Do not mix a
1117.Nm HAMMER
1118master created after the upgrade with a
1119.Nm HAMMER
bf2c6489
MD
1120slave created prior to the upgrade.
1121.Pp
1122Any directories created after upgrading will use a new layout.
1123.Sh UPGRADE INSTRUCTIONS HAMMER V2 TO V3
16265794
TN
1124This upgrade adds meta-data elements to the B-Tree.
1125It is possible to upgrade a V2 filesystem to V3 in place.
1126After issuing the upgrade be sure to run a
1127.Nm
1128.Cm cleanup
1129to perform post-upgrade tasks.
bf2c6489 1130.Pp
16265794
TN
1131After making this upgrade running a
1132.Nm
1133.Cm cleanup
1134will move the
1135.Pa <pfs>/snapshots
bf2c6489 1136directory for each PFS mount into
16265794
TN
1137.Pa /var/hammer/<pfs> .
1138A
1139.Nm HAMMER
1140root mount will migrate
bf2c6489
MD
1141.Pa /snapshots
1142into
1143.Pa /var/hammer/root .
1144Migration occurs only once and only if you have not specified
16265794
TN
1145a snapshots directory in the PFS configuration.
1146If you have specified a snapshots directory in the PFS configuration no
bf2c6489
MD
1147automatic migration will occur.
1148.Pp
1149For slaves, if you desire, you can migrate your snapshots
1150config to the new location manually and then clear the
1151snapshot directory configuration in the slave PFS.
1152The new snapshots hierarchy is designed to work with
1153both master and slave PFSs equally well.
1154.Pp
1155In addition, the old config file will be moved to meta-data,
16265794
TN
1156editable via the new
1157.Nm
bf2c6489 1158.Cm viconfig
16265794
TN
1159directive.
1160The old config file will be deleted.
bf2c6489
MD
1161Migration occurs only once.
1162.Pp
1163The V3 filesystem has new
1164.Cm snap*
1165directives for creating snapshots.
1166All snapshot directives, including the original, will create
1167meta-data entries for the snapshots and the pruning code will
1168automatically incorporate these entries into its list and
1169expire them the same way it expires softlinks.
16265794 1170If you by accident blow away your snapshot softlinks you can use the
bf2c6489
MD
1171.Cm snapls
1172directive to get a definitive list from the meta-data and
1173regenerate them from that list.
92ed14a3 1174.Pp
16265794
TN
1175.Em WARNING!
1176If you are using
1177.Nm
1178to backup filesystems your scripts may be using the
92ed14a3 1179.Cm synctid
16265794
TN
1180directive to generate transaction ids.
1181This directive does not create a snapshot.
1182You will have to modify your scripts to use the
92ed14a3
MD
1183.Cm snapq
1184directive to generate the linkbuf for the softlink you create, or
1185use one of the other
1186.Cm snap*
1187directives.
1188The older
1189.Cm snapshot
1190directive will continue to work as expected and in V3 it will also
16265794
TN
1191record the snapshot transaction id in meta-data.
1192You may also want to make use of the new
1193.Ar note
1194tag for the meta-data.
92ed14a3 1195.Pp
16265794
TN
1196.Em WARNING!
1197If you used to remove snapshot softlinks with
92ed14a3
MD
1198.Nm rm
1199you should probably start using the
1200.Cm snaprm
1201directive instead to also remove the related meta-data.
1202The pruning code scans the meta-data so just removing the
1203softlink is not sufficient.
16265794
TN
1204.Sh EXIT STATUS
1205.Ex -std
226f3799
TN
1206.Sh FILES
1207.Bl -tag -width ".It Pa <fs>/var/slaves/<name>" -compact
4567021b 1208.It Pa <pfs>/snapshots
226f3799 1209default per PFS snapshots directory
16265794
TN
1210.Nm ( HAMMER
1211VERSION 2-)
1212.It Pa /var/hammer/<pfs>
1213default per PFS snapshots directory (not root)
1214.Nm ( HAMMER
1215VERSION 3+)
1216.It Pa /var/hammer/root
1217default snapshots directory for root directory
1218.Nm ( HAMMER
1219VERSION 3+)
226f3799 1220.It Pa <snapshots>/config
4567021b 1221per PFS
226f3799 1222.Nm
4567021b 1223.Cm cleanup
226f3799 1224configuration file
16265794
TN
1225.Nm ( HAMMER
1226VERSION 2-)
226f3799
TN
1227.It Pa <fs>/var/slaves/<name>
1228recommended slave PFS snapshots directory
16265794
TN
1229.Nm ( HAMMER
1230VERSION 2-)
226f3799 1231.El
0dfeb6c8 1232.Sh SEE ALSO
4567021b 1233.Xr ssh 1 ,
84082922 1234.Xr undo 1 ,
b4448f1a 1235.Xr HAMMER 5 ,
e0331f4f 1236.Xr periodic.conf 5 ,
84082922 1237.Xr mount_hammer 8 ,
bb8e52c0 1238.Xr mount_null 8 ,
0dfeb6c8
MD
1239.Xr newfs_hammer 8
1240.Sh HISTORY
1241The
1242.Nm
1243utility first appeared in
1244.Dx 1.11 .
1245.Sh AUTHORS
1246.An Matthew Dillon Aq dillon@backplane.com