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