1.\" Copyright (c) 2007 The DragonFly Project.  All rights reserved.
2.\"
3.\" This code is derived from software contributed to The DragonFly Project
4.\" by Matthew Dillon <dillon@backplane.com>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in
14.\"    the documentation and/or other materials provided with the
15.\"    distribution.
16.\" 3. Neither the name of The DragonFly Project nor the names of its
17.\"    contributors may be used to endorse or promote products derived
18.\"    from this software without specific, prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.Dd August 15, 2016
34.Dt NEWFS_HAMMER 8
35.Os
36.Sh NAME
37.Nm newfs_hammer
38.Nd construct a new HAMMER file system
39.Sh SYNOPSIS
40.Nm
41.Fl L Ar label
42.Op Fl \&Efh
43.Op Fl b Ar bootsize
44.Op Fl m Ar savesize
45.Op Fl u Ar undosize
46.Op Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
47.Op Fl V Ar version
48.Ar special ...
49.Sh DESCRIPTION
50The
51.Nm
52utility creates a
53.Nm HAMMER
54file system on device(s)
55.Ar special .
56If multiple devices are specified a single
57.Nm HAMMER
58file system is created
59which spans all of them.
60Each
61.Ar special
62will constitute a volume which the
63.Nm HAMMER
64file system is built on.
65The first
66.Ar special
67specified becomes the
68.Ar root-volume .
69.Nm HAMMER
70file systems are sector-size agnostic, however the
71.Dx
72implementation requires the sector size to be no larger than 16KB.
73.Nm HAMMER
74file systems start at a relative offset of 0 and may only be created
75under out-of-band disk labels
76.Po
77.Xr disklabel64 5
78or
79.Xr gpt 8
80labels
81.Pc ,
82or in
83.Xr disklabel32 5
84partitions which do not overlap the label area (have a starting sector
85greater than 16).
86.Pp
87.Nm HAMMER
88file systems are designed for large storage systems, up to 1 Exabyte, and
89will not operate efficiently on small storage systems.
90The minimum recommended file system size is 50GB.
91.Nm HAMMER
92must reserve 500MB to 1GB of its storage for reblocking and UNDO/REDO.
93In addition,
94.Nm HAMMER
95file systems operating normally, with full history
96retention and daily snapshots, do not immediately reclaim space when
97files are deleted.
98A regular system maintenance job runs once a day by
99.Xr periodic 8
100to handle reclamation.
101.Pp
102.Nm HAMMER
103works best when the machine's normal workload would not otherwise fill
104the file system up in the course of 60 days of operation.
105.Pp
106The options are as follows:
107.Bl -tag -width indent
108.It Fl L Ar label
109All
110.Nm HAMMER
111file systems must be named and names should be unique on a
112per-machine basis, although
113.Nm
114does not prevent from making file systems with the same label.
115.It Fl b Ar bootsize
116Specify a fixed area in which a boot related kernel and data can be stored.
117This area is currently unused.
118The
119.Ar bootsize
120is specified in bytes.
121.It Fl f
122Force operation.
123This is needed for the creation of a
124.Nm HAMMER
125file system less than 10GB size or
126with less than 500MB UNDO/REDO FIFO.
127This should not be used under normal circumstances.
128.It Fl E
129Use TRIM to erase the device's data before creating the file system.
130The underlying device must have the TRIM sysctl enabled.
131Only devices that support TRIM will have such a sysctl option
132.Va ( kern.cam.da.X.trim_enabled ) .
133.It Fl m Ar savesize
134Specify a fixed area which
135.Nm HAMMER
136may use as a memory log.
137This area is currently unused.
138The
139.Ar savesize
140is specified in bytes.
141.It Fl u Ar undosize
142Specify the size of the fixed UNDO/REDO FIFO.
143The
144.Ar undosize
145is specified in bytes.
146By default 0.1% of the root
147volume's size is used, with a reasonable minimum and a reasonable cap.
148The UNDO/REDO FIFO is used to sequence meta-data out to the media for
149instant crash recovery.
150.It Fl h
151Show usage.
152.It Fl C Ar cachesize Ns Op Ns Cm \&: Ns Ar readahead
153Refer to the same option in
154.Xr hammer 8 .
155.It Fl V Ar version
156Specify the
157.Nm HAMMER
158file system version to format.
159By default
160.Nm
161formats the file system using the highest production version number
162supported by the
163.Nm HAMMER
164VFS by checking the
165.Va vfs.hammer.supported_version
166sysctl.
167If you need to maintain compatibility with an older version of
168.Nm HAMMER
169you may specify the version with this option.
170.El
171.Pp
172The
173.Ar bootsize ,
174.Ar savesize
175and
176.Ar undosize
177must be given with a suffix of
178.Cm K , M , G
179or
180.Cm T
181meaning kilobyte, megabyte, gigabyte and terabyte.
182Lower case can also be used for suffix.
183.Sh EXIT STATUS
184.Ex -std
185.Sh EXAMPLES
186Create a file system named
187.Sq HOME
188on
189.Pa /dev/ad0s1d :
190.Bd -literal -offset indent
191newfs_hammer -L HOME /dev/ad0s1d
192.Ed
193.Pp
194Create a file system named
195.Sq TEMP
196on
197.Pa /dev/ad0s1d
198and
199.Pa /dev/ad1s1d :
200.Bd -literal -offset indent
201newfs_hammer -L TEMP /dev/ad0s1d /dev/ad1s1d
202.Ed
203.Sh SEE ALSO
204.Xr disklabel32 5 ,
205.Xr disklabel64 5 ,
206.Xr HAMMER 5 ,
207.Xr fdisk 8 ,
208.Xr gpt 8 ,
209.Xr hammer 8 ,
210.Xr mount_hammer 8 ,
211.Xr newfs 8
212.Sh HISTORY
213The
214.Nm
215utility first appeared in
216.Dx 1.11 .
217.Sh AUTHORS
218.An Matthew Dillon Aq Mt dillon@backplane.com
219