1mkfs.ocfs2(8)                 OCFS2 Manual Pages                 mkfs.ocfs2(8)
2
3
4

NAME

6       mkfs.ocfs2 - Creates an OCFS2 file system.
7

SYNOPSIS

9       mkfs.ocfs2  [-b  block-size]  [-C  cluster-size]  [-L volume-label] [-M
10       mount-type]  [-N  number-of-nodes]  [-J   journal-options]   [--fs-fea‐
11       tures=[no]sparse...]  [--fs-feature-level=feature-level]  [-T  filesys‐
12       tem-type]   [--cluster-stack=stackname]    [--cluster-name=clustername]
13       [--global-heartbeat]  [--discard | --nodiscard] [-FqvV] device [blocks-
14       count]
15

DESCRIPTION

17       mkfs.ocfs2 is used to create an OCFS2 file system on a device,  usually
18       a partition on a shared disk. In order to prevent data loss, mkfs.ocfs2
19       will not format an existing OCFS2 volume  if  it  detects  that  it  is
20       mounted  on another node in the cluster. This tool requires the cluster
21       service to be online.
22
23

OPTIONS

25       -b, --block-size block-size
26              Valid block size values are 512, 1K, 2K and 4K bytes per  block.
27              If  omitted,  a  value will be heuristically determined based on
28              the expected usage of the file system (see  the  -T  option).  A
29              block  size  of 512 bytes is never recommended. Choose 1K, 2K or
30              4K.
31
32
33       -C, --cluster-size cluster-size
34              Valid cluster size values are 4K, 8K, 16K, 32K, 64K, 128K, 256K,
35              512K  and  1M.  If omitted, a value will be heuristically deter‐
36              mined based on the expected usage of the file system (see the -T
37              option).  For  volumes expected to store large files, like data‐
38              base files, while a cluster size of 128K or more is recommended,
39              one  can  opt  for  a  smaller size as long as that value is not
40              smaller than the database block size.  For others, use 4K.
41
42
43       -F, --force
44              For existing OCFS2 volumes, mkfs.ocfs2 ensures the volume is not
45              mounted  on  any node in the cluster before formatting. For that
46              to work, mkfs.ocfs2 expects the cluster service  to  be  online.
47              Specify this option to disable this check.
48
49
50       -J, --journal-options options
51              Create  the journal using options specified on the command-line.
52              Journal options are comma separated, and may  take  an  argument
53              using  the  equals  ('=')  sign.  The following options are sup‐
54              ported:
55
56
57              size=journal-size
58                     Create a journal of size journal-size.  Minimum  size  is
59                     4M.   If  omitted,  a  value  is heuristically determined
60                     based upon the file system size.
61
62
63              block32
64                     Use a standard 32bit journal.  The journal will  be  able
65                     to  access up to 2^32-1 blocks.  This is the default.  It
66                     has been the journal format for OCFS2 volumes  since  the
67                     beginning.   The  journal is compatible with all versions
68                     of OCFS2.  Prepending no is  equivalent  to  the  block64
69                     journal option.
70
71
72              block64
73                     Use  a 64bit journal.  The journal will be able to access
74                     up to 2^64-1 blocks.  This allows large filesystems  that
75                     can  extend  to  the theoretical limits of OCFS2.  It re‐
76                     quires a new-enough filesystem driver that uses  the  new
77                     journalled  block  device, JBD2. Prepending no is equiva‐
78                     lent to the block32 journal option.
79
80
81       -L, --label volume-label
82              Set the volume label for the file system.  This  is  useful  for
83              mounting-by-label. Limit the label to under 64 bytes.
84
85
86       -M, --mount mount-type
87              Valid  types  are local and cluster. Local mount allows users to
88              mount the volume without the cluster  overhead  and  works  only
89              with  OCFS2 bundled with Linux kernels 2.6.20 or later. Defaults
90              to cluster.
91
92
93       -N, --node-slots number-of-node-slots
94              Valid number ranges from 1 to 255.  This  number  specifies  the
95              maximum  number  of nodes that can concurrently mount the parti‐
96              tion. If omitted, the number depends on volume size, for  volume
97              size < 2G, it's 2, for 2G <= size < 10G, it's 4, for 10G <= size
98              < 1T, it's 8, for other size, it's 16. The number of  slots  can
99              be later tuned up or down using tunefs.ocfs2.
100
101
102       -T filesystem-type
103              Specify  how  the  filesystem  is  going  to  be  used,  so that
104              mkfs.ocfs2 can chose optimal filesystem parameters for that use.
105              The supported filesystem types are:
106
107
108              mail   Appropriate for file systems that will host lots of small
109                     files.
110
111
112              datafiles
113                     Appropriate for file systems that will host a  relatively
114                     small number of very large files.
115
116
117              vmstore
118                     Appropriate  for  file systems that will host Virtual ma‐
119                     chine images.
120
121
122       --fs-features=[no]sparse...
123              Turn specific file system features on or off. A comma  separated
124              list  of  feature flags can be provided, and mkfs.ocfs2 will try
125              to create the file system with those features set  according  to
126              the  list. To turn a feature on, include it in the list. To turn
127              a feature off, prepend no to the name. Choices here  will  over‐
128              ride  individual features set via the --fs-feature-level option.
129              Refer to the section titled feature compatibility before select‐
130              ing specific features. The following flags are supported:
131
132
133              backup-super
134                     mkfs.ocfs2,  by  default,  makes up to 6 backup copies of
135                     the super block at offsets 1G, 4G, 16G, 64G, 256G and  1T
136                     depending  on the size of the volume.  This can be useful
137                     in disaster recovery. This feature  is  fully  compatible
138                     with all versions of the file system and generally should
139                     not be disabled.
140
141
142              local  Create the file system as a local mount, so that  it  can
143                     be mounted without a cluster stack.
144
145
146              sparse Enable  support  for  sparse  files. With this, OCFS2 can
147                     avoid allocating (and zeroing) data to fill  holes.  Turn
148                     this  feature  on  if you can, otherwise extends and some
149                     writes might be less performant.
150
151
152              unwritten
153                     Enable unwritten extents support. With this turned on, an
154                     application  can request that a range of clusters be pre-
155                     allocated within a file. OCFS2 will  mark  those  extents
156                     with  a  special  flag  so  that  expensive  data zeroing
157                     doesn't have to be performed. Reads and writes to a  pre-
158                     allocated  region  act as reads and writes to a hole, ex‐
159                     cept a write will not fail due to lack  of  data  alloca‐
160                     tion.  This  feature  requires  sparse file support to be
161                     turned on.
162
163
164              inline-data
165                     Enable inline-data support. If this feature is turned on,
166                     OCFS2  will  store small files and directories inside the
167                     inode block. Data is transparently moved out to an extent
168                     when  it  no  longer fits inside the inode block. In some
169                     cases, this can also make a positive impact on cold-cache
170                     directory and file operations.
171
172
173              extended-slotmap
174                     The  slot-map  is  a  hidden file on an OCFS2 fs which is
175                     used to map mounted nodes to system file  resources.  The
176                     extended  slot map allows a larger range of possible node
177                     numbers, which is useful for userspace cluster stacks. If
178                     required,  this  feature  is  automatically  turned on by
179                     mkfs.ocfs2.
180
181
182              metaecc
183                     Enables metadata checksums. With this enabled,  the  file
184                     system  computes and stores the checksums in all metadata
185                     blocks. It also computes and stores an  error  correction
186                     code capable of fixing single bit errors.
187
188
189              refcount
190                     Enables  creation  of  reference counted trees. With this
191                     enabled, the file system allows users  to  create  inode-
192                     based snapshots and clones known as reflinks.
193
194
195              xattr  Enable  extended  attributes  support. With this enabled,
196                     users can attach name:value pairs to objects  within  the
197                     file  system.  In OCFS2, the names can be up to 255 bytes
198                     in length, terminated by the first NUL byte. While it  is
199                     not  required,  printable  names (ASCII) are recommended.
200                     The values can be up to 64KB of  arbitrary  binary  data.
201                     Attributes  can be attached to all types of inodes: regu‐
202                     lar files, directories,  symbolic  links,  device  nodes,
203                     etc.  This  feature  is required for users wanting to use
204                     extended security facilities like POSIX ACLs or SELinux.
205
206
207              usrquota
208                     Enable user quota support.  With  this  feature  enabled,
209                     filesystem  will  track amount of space and number of in‐
210                     odes (files, directories, symbolic links) each user owns.
211                     It  is then possible to limit the maximum amount of space
212                     or inodes user can have. See a  documentation  of  quota-
213                     tools package for more details.
214
215
216              grpquota
217                     Enable  group  quota  support. With this feature enabled,
218                     filesystem will track amount of space and number  of  in‐
219                     odes  (files,  directories,  symbolic  links)  each group
220                     owns. It is then possible to limit the maximum amount  of
221                     space  or  inodes  user  can have. See a documentation of
222                     quota-tools package for more details.
223
224
225              indexed-dirs
226                     Enable directory indexing support. With this feature  en‐
227                     abled,  the  file system creates indexed tree for non-in‐
228                     line directory entries. For large scale directories,  di‐
229                     rectory entry lookup performance from the indexed tree is
230                     faster then from the legacy directory blocks.
231
232
233              discontig-bg
234                     Enables discontiguous block groups. With this feature en‐
235                     abled,  the file system is able to grow the inode and the
236                     extent allocators even when there is no  contiguous  free
237                     chunk  available.  It  allows the file system to grow the
238                     allocators in smaller (discontiguous) chunks.
239
240
241              clusterinfo
242                     Enables storing the cluster stack information in the  su‐
243                     perblock.  This  feature  is  needed to support userspace
244                     cluster stacks and the global heartbeat mode in the  o2cb
245                     cluster  stack.  If needed, this feature is automatically
246                     turned on by mkfs.ocfs2.
247
248
249       --fs-feature-level=feature-level
250              Choose from a set of pre-determined file-system  features.  This
251              option  is  designed to allow users to conveniently choose a set
252              of file system features which fits  their  needs.  There  is  no
253              downside to trying a set of features which your module might not
254              support - if it won't mount the new file system simply  reformat
255              at  a  lower  level.  Feature  levels  can be fine-tuned via the
256              --fs-features option. Currently, there are 3  types  of  feature
257              levels:
258
259
260              max-compat
261                     Chooses  fewer  features but ensures that the file system
262                     can be mounted from older versions of the OCFS2 module.
263
264
265              default
266                     The default feature set tries to strike a balance between
267                     providing new features and maintaining compatibility with
268                     relatively recent versions of OCFS2. It currently enables
269                     sparse, unwritten, inline-data, xattr, indexed-dirs, dis‐
270                     contig-bg, refcount, extended-slotmap and clusterinfo.
271
272
273              max-features
274                     Choose the maximum amount  of  features  available.  This
275                     will typically provide the best performance from OCFS2 at
276                     the expense of creating a file system that is  only  com‐
277                     patible  with  very  recent  versions of the OCFS2 kernel
278                     module.
279
280
281       --cluster-stack
282              Specify the cluster stack. This option is normally not  required
283              as  mkfs.ocfs2 chooses the currently active cluster stack. It is
284              required only if the cluster stack is not online  and  the  user
285              wishes  to  use a stack other than the default, o2cb. Other sup‐
286              ported cluster stacks are pcmk (Pacemaker) and cman (rgmanager).
287              Once  set,  OCFS2 will only allow mounting the volume if the ac‐
288              tive cluster stack and cluster name matches  the  one  specified
289              on-disk.
290
291
292       --cluster-name
293              Specify the name of the cluster. This option is mandatory if the
294              user has specified a cluster-stack. This name is restricted to a
295              max  of  16 characters. Additionally, the o2cb cluster stack al‐
296              lows only alpha-numeric characters.
297
298
299       --global-heartbeat
300              Enable the global heartbeat mode of the o2cb cluster stack. This
301              option  is  not  required  if the o2cb cluster stack with global
302              heartbeat is online as mkfs.ocfs2 will detect the active  stack.
303              However, if the cluster stack is not up, then this option is re‐
304              quired alongwith cluster-stack and cluster-name.  For more,  re‐
305              fer to o2cb(7).
306
307
308       --discard
309              Attempt  to  discard blocks at mkfs time (discarding blocks ini‐
310              tially is useful on solid state devices and sparse / thin-provi‐
311              sioned  storage).  When  the device advertises that discard also
312              zeroes data (any subsequent read after the  discard  and  before
313              write  returns zero), then mark all not-yet-zeroed blocks as ze‐
314              roed. This significantly speeds  up  filesystem  initialization.
315              This is set as default.
316
317
318       --nodiscard
319              Do not attempt to discard blocks at mkfs time.
320
321
322       --no-backup-super
323              This option is deprecated, please use --fs-features=nobackup-su‐
324              per instead.
325
326
327       -n, --dry-run
328              Display the heuristically determined values without  overwriting
329              the existing file system.
330
331
332       -q, --quiet
333              Quiet mode.
334
335
336       -U uuid
337              Specify      a      custom      UUID      in      the      plain
338              (2A4D1C581FAA42A1A41D26EFC90C1315)        or         traditional
339              (2a4d1c58-1faa-42a1-a41d-26efc90c1315)  format.  This  option in
340              not recommended  because  the  file  system  uses  the  UUID  to
341              uniquely  identify  a  file system. If more than one file system
342              were to have the same UUID, one is very likely to encounter  er‐
343              ratic behavior, if not, outright file system corruption.
344
345
346       -v, --verbose
347              Verbose mode.
348
349
350       -V, --version
351              Print version and exit.
352
353
354       blocks-count
355              Usually  mkfs.ocfs2  automatically  determines  the  size of the
356              given device and creates a file system  that  uses  all  of  the
357              available space on the device.  This optional argument specifies
358              that the file system should only consume  the  given  number  of
359              file system blocks (see -b) on the device.
360
361

FEATURE COMPATIBILITY

363       This section lists the file system features that have been added to the
364       OCFS2 file system and the version that it first appeared in. The  table
365       below  lists the versions of the mainline Linux kernel and ocfs2-tools.
366       Users should use this information to enable only  those  features  that
367       are  available in the file system that they are using.  Before enabling
368       new features, users are advised to review to the section titled feature
369       values.
370
371
372                ┌─────────────────┬────────────────┬─────────────────┐
373Feature          Kernel Version Tools Version   
374                ├─────────────────┼────────────────┼─────────────────┤
375local            │  Linux 2.6.20  │ ocfs2-tools 1.2 │
376                ├─────────────────┼────────────────┼─────────────────┤
377sparse           │  Linux 2.6.22  │ ocfs2-tools 1.4 │
378                ├─────────────────┼────────────────┼─────────────────┤
379unwritten        │  Linux 2.6.23  │ ocfs2-tools 1.4 │
380                ├─────────────────┼────────────────┼─────────────────┤
381inline-data      │  Linux 2.6.24  │ ocfs2-tools 1.4 │
382                ├─────────────────┼────────────────┼─────────────────┤
383extended-slotmap │  Linux 2.6.27  │ ocfs2-tools 1.6 │
384                ├─────────────────┼────────────────┼─────────────────┤
385metaecc          │  Linux 2.6.29  │ ocfs2-tools 1.6 │
386                ├─────────────────┼────────────────┼─────────────────┤
387grpquota         │  Linux 2.6.29  │ ocfs2-tools 1.6 │
388                ├─────────────────┼────────────────┼─────────────────┤
389usrquota         │  Linux 2.6.29  │ ocfs2-tools 1.6 │
390                ├─────────────────┼────────────────┼─────────────────┤
391xattr            │  Linux 2.6.29  │ ocfs2-tools 1.6 │
392                ├─────────────────┼────────────────┼─────────────────┤
393indexed-dirs     │  Linux 2.6.30  │ ocfs2-tools 1.6 │
394                ├─────────────────┼────────────────┼─────────────────┤
395refcount         │  Linux 2.6.32  │ ocfs2-tools 1.6 │
396                ├─────────────────┼────────────────┼─────────────────┤
397discontig-bg     │  Linux 2.6.35  │ ocfs2-tools 1.6 │
398                ├─────────────────┼────────────────┼─────────────────┤
399clusterinfo      │  Linux 2.6.37  │ ocfs2-tools 1.8 │
400                └─────────────────┴────────────────┴─────────────────┘
401
402       Users can query the features enabled in the file system as follows:
403
404       # tunefs.ocfs2 -Q "Label: %V\nFeatures: %H %O\n" /dev/sdg1
405       Label: apache_files_10
406       Features: sparse inline-data unwritten
407
408

FEATURE VALUES

410       This  section  lists  the  hex values that are associated with the file
411       system features.  This information is useful when debugging mount fail‐
412       ures  that  are due to feature incompatibility. When a user attempts to
413       mount an OCFS2 volume that has features enabled that are not  supported
414       by the running file system software, it will fail with an error like:
415
416       ERROR: couldn't mount because of unsupported optional features (200).
417
418       By  referring to the table below, it becomes apparent that the user at‐
419       tempted to mount a volume with the xattr (extended attributes)  feature
420       enabled with a version of the file system software that did not support
421       it. At this stage, the user has the option of either upgrading the file
422       system software, or, disabling that on-disk feature using tunefs.ocfs2.
423
424       Some features allow the file system to be mounted with an older version
425       of the software provided the mount is read-only. If a user attempts  to
426       mount  such  a  volume in a read-write mode, it will fail with an error
427       like:
428
429       ERROR: couldn't mount RDWR because of unsupported optional features (1).
430
431       This error indicates that the volume had the unwritten RO  compat  fea‐
432       ture enabled.  This volume can be mounted by an older file system soft‐
433       ware only in the read-only mode.  In this case, the user has the option
434       of  either  mounting the volume with the ro mount option, or, disabling
435       that on-disk feature using tunefs.ocfs2.
436
437
438                     ┌─────────────────┬───────────┬───────────┐
439FeatureCategoryHex value
440                     ├─────────────────┼───────────┼───────────┤
441local            │ Incompat  │     8     │
442                     ├─────────────────┼───────────┼───────────┤
443sparse           │ Incompat  │    10     │
444                     ├─────────────────┼───────────┼───────────┤
445inline-data      │ Incompat  │    40     │
446                     ├─────────────────┼───────────┼───────────┤
447extended-slotmap │ Incompat  │    100    │
448                     ├─────────────────┼───────────┼───────────┤
449xattr            │ Incompat  │    200    │
450                     ├─────────────────┼───────────┼───────────┤
451indexed-dirs     │ Incompat  │    400    │
452                     ├─────────────────┼───────────┼───────────┤
453metaecc          │ Incompat  │    800    │
454                     ├─────────────────┼───────────┼───────────┤
455refcount         │ Incompat  │   1000    │
456                     ├─────────────────┼───────────┼───────────┤
457discontig-bg     │ Incompat  │   2000    │
458                     ├─────────────────┼───────────┼───────────┤
459clusterinfo      │ Incompat  │   4000    │
460                     ├─────────────────┼───────────┼───────────┤
461unwritten        │ RO Compat │     1     │
462                     ├─────────────────┼───────────┼───────────┤
463usrquota         │ RO Compat │     2     │
464                     ├─────────────────┼───────────┼───────────┤
465grpquota         │ RO Compat │     4     │
466                     └─────────────────┴───────────┴───────────┘
467
468

SEE ALSO

470       debugfs.ocfs2(8) fsck.ocfs2(8) mount.ocfs2(8) mounted.ocfs2(8)  o2cb(7)
471       o2cluster(8) o2image(8) o2info(1) tunefs.ocfs2(8)
472
473

AUTHORS

475       Oracle Corporation
476
477
479       Copyright © 2004, 2012 Oracle. All rights reserved.
480
481
482
483Version 1.8.7                    January 2012                    mkfs.ocfs2(8)
Impressum