1mkfs.xfs(8)                 System Manager's Manual                mkfs.xfs(8)
2
3
4

NAME

6       mkfs.xfs - construct an XFS filesystem
7

SYNOPSIS

9       mkfs.xfs  [  -b  block_size  ]  [ -d data_section_options ] [ -f ] [ -i
10       inode_options ] [ -l log_section_options ] [ -n naming_options ]  [  -p
11       protofile ] [ -q ] [ -r realtime_section_options ] [ -s sector_size ] [
12       -L label ] [ -N ] [ -K ] device
13

DESCRIPTION

15       mkfs.xfs constructs an XFS filesystem by  writing  on  a  special  file
16       using  the  values  found  in the arguments of the command line.  It is
17       invoked automatically by mkfs(8) when it is given the -t xfs option.
18
19       In its simplest (and most commonly used form), the size of the filesys‐
20       tem  is  determined  from  the  disk  driver.  As an example, to make a
21       filesystem with an internal log on the first  partition  on  the  first
22       SCSI disk, use:
23
24              mkfs.xfs /dev/sda1
25
26       The  metadata  log can be placed on another device to reduce the number
27       of disk seeks.  To create a filesystem on the first  partition  on  the
28       first  SCSI  disk with a 10000 block log located on the first partition
29       on the second SCSI disk, use:
30
31              mkfs.xfs -l logdev=/dev/sdb1,size=10000b /dev/sda1
32
33       Each of the option elements in the argument list above can be given  as
34       multiple comma-separated suboptions if multiple suboptions apply to the
35       same option.  Equivalently, each main  option  can  be  given  multiple
36       times  with different suboptions.  For example, -l internal,size=10000b
37       and -l internal -l size=10000b are equivalent.
38
39       In the descriptions below, sizes are given in sectors,  bytes,  blocks,
40       kilobytes, megabytes, gigabytes, etc.  Sizes are treated as hexadecimal
41       if prefixed by 0x or 0X, octal if prefixed by 0, or decimal  otherwise.
42       The following lists possible multiplication suffixes:
43              s - multiply  by  sector  size  (default  =  512,  see -s option
44                     below).
45              b - multiply by filesystem block size  (default  =  4K,  see  -b
46                     option below).
47              k - multiply by one kilobyte (1,024 bytes).
48              m - multiply by one megabyte (1,048,576 bytes).
49              g - multiply by one gigabyte (1,073,741,824 bytes).
50              t - multiply by one terabyte (1,099,511,627,776 bytes).
51              p - multiply by one petabyte (1,024 terabytes).
52              e - multiply by one exabyte (1,048,576 terabytes).
53

OPTIONS

55       -b block_size_options
56              This option specifies the fundamental block size of the filesys‐
57              tem.  The valid block_size_options are: log=value or  size=value
58              and  only  one  can  be  supplied.   The block size is specified
59              either as a base two logarithm value with log=, or in bytes with
60              size=.   The default value is 4096 bytes (4 KiB), the minimum is
61              512, and the maximum is 65536 (64 KiB).  XFS on Linux  currently
62              only supports pagesize or smaller blocks.
63
64       -d data_section_options
65              These  options  specify the location, size, and other parameters
66              of the data section  of  the  filesystem.  The  valid  data_sec‐
67              tion_options are:
68
69                   agcount=value
70                          This  is  used  to  specify the number of allocation
71                          groups.  The  data  section  of  the  filesystem  is
72                          divided  into  allocation groups to improve the per‐
73                          formance of XFS. More allocation groups  imply  that
74                          more  parallelism  can  be  achieved when allocating
75                          blocks and inodes. The minimum allocation group size
76                          is  16  MiB;  the  maximum size is just under 1 TiB.
77                          The data section of the filesystem is  divided  into
78                          value  allocation  groups  (default  value is scaled
79                          automatically based on the underlying device size).
80
81                   agsize=value
82                          This is an alternative to using the  agcount  subop‐
83                          tion.  The  value is the desired size of the alloca‐
84                          tion group expressed in bytes (usually using  the  m
85                          or  g  suffixes).   This value must be a multiple of
86                          the filesystem block size,  and  must  be  at  least
87                          16MiB,  and  no more than 1TiB, and may be automati‐
88                          cally adjusted to properly  align  with  the  stripe
89                          geometry.   The  agcount  and  agsize suboptions are
90                          mutually exclusive.
91
92                   name=value
93                          This can be used to specify the name of the  special
94                          file  containing  the  filesystem. In this case, the
95                          log section must be specified as  internal  (with  a
96                          size,  see  the -l option below) and there can be no
97                          real-time section.
98
99                   file[=value]
100                          This is used to specify that the file given  by  the
101                          name  suboption  is  a  regular  file.  The value is
102                          either 0 or 1, with 1 signifying that  the  file  is
103                          regular.  This  suboption  is  used  only  to make a
104                          filesystem image. If the value is omitted then 1  is
105                          assumed.
106
107                   size=value
108                          This  is  used  to specify the size of the data sec‐
109                          tion. This suboption is required if -d  file[=1]  is
110                          given.  Otherwise, it is only needed if the filesys‐
111                          tem should occupy less space than the  size  of  the
112                          special file.
113
114                   sunit=value
115                          This  is  used to specify the stripe unit for a RAID
116                          device or a logical volume.  The  value  has  to  be
117                          specified in 512-byte block units. Use the su subop‐
118                          tion to specify the stripe unit size in bytes.  This
119                          suboption  ensures  that  data  allocations  will be
120                          stripe unit aligned when the current end of file  is
121                          being  extended  and  the  file  size is larger than
122                          512KiB. Also inode allocations and the internal  log
123                          will be stripe unit aligned.
124
125                   su=value
126                          This  is an alternative to using sunit.  The su sub‐
127                          option is used to specify the stripe unit for a RAID
128                          device or a striped logical volume. The value has to
129                          be specified in bytes, (usually using  the  m  or  g
130                          suffixes).  This  value  must  be  a multiple of the
131                          filesystem block size.
132
133                   swidth=value
134                          This is used to specify the stripe width for a  RAID
135                          device or a striped logical volume. The value has to
136                          be specified in 512-byte block  units.  Use  the  sw
137                          suboption to specify the stripe width size in bytes.
138                          This suboption is required  if  -d  sunit  has  been
139                          specified  and  it  has  to  be a multiple of the -d
140                          sunit suboption.
141
142                   sw=value
143                          suboption is an alternative to using swidth.  The sw
144                          suboption  is used to specify the stripe width for a
145                          RAID device or striped logical volume. The value  is
146                          expressed  as  a multiplier of the stripe unit, usu‐
147                          ally the same as the number of stripe members in the
148                          logical  volume  configuration,  or  data disks in a
149                          RAID device.
150
151                          When a filesystem is created  on  a  logical  volume
152                          device,  mkfs.xfs will automatically query the logi‐
153                          cal volume for appropriate sunit and swidth values.
154
155       -f     Force overwrite when an existing filesystem is detected  on  the
156              device.  By default, mkfs.xfs will not write to the device if it
157              suspects that there is a filesystem or partition  table  on  the
158              device already.
159
160       -i inode_options
161              This  option  specifies  the  inode  size of the filesystem, and
162              other inode allocation parameters.  The  XFS  inode  contains  a
163              fixed-size  part  and  a  variable-size part.  The variable-size
164              part, whose size is affected by this option, can contain: direc‐
165              tory  data,  for  small  directories;  attribute data, for small
166              attribute sets; symbolic link data, for  small  symbolic  links;
167              the  extent  list for the file, for files with a small number of
168              extents; and the root of  a  tree  describing  the  location  of
169              extents for the file, for files with a large number of extents.
170
171              The valid inode_options are:
172
173                   size=value | log=value | perblock=value
174                          The  inode  size  is  specified either as a value in
175                          bytes with size=, a base two  logarithm  value  with
176                          log=, or as the number fitting in a filesystem block
177                          with perblock=.  The mininum (and default) value  is
178                          256  bytes.   The maximum value is 2048 (2 KiB) sub‐
179                          ject to the restriction that the inode  size  cannot
180                          exceed one half of the filesystem block size.
181
182                          XFS  uses  64-bit inode numbers internally; however,
183                          the number of significant bits in an inode number is
184                          affected   by  filesystem  geometry.   In  practice,
185                          filesystem size and inode size are  the  predominant
186                          factors.  The Linux kernel (on 32 bit hardware plat‐
187                          forms) and most applications cannot currently handle
188                          inode  numbers  greater than 32 significant bits, so
189                          if no inode size  is  given  on  the  command  line,
190                          mkfs.xfs  will  attempt  to  choose a size such that
191                          inode numbers will be < 32 bits.  If an  inode  size
192                          is  specified,  or  if  a  filesystem is sufficently
193                          large, mkfs.xfs will warn if this will create  inode
194                          numbers > 32 significant bits.
195
196                   maxpct=value
197                          This  specifies  the  maximum percentage of space in
198                          the filesystem that can be allocated to inodes.  The
199                          default  value  is 25% for filesystems under 1TB, 5%
200                          for filesystems under 50TB and  1%  for  filesystems
201                          over 50TB.
202
203                          In  the  default inode allocation mode, inode blocks
204                          are chosen such that inode numbers will  not  exceed
205                          32  bits,  which  restricts  the inode blocks to the
206                          lower portion of  the  filesystem.  The  data  block
207                          allocator will avoid these low blocks to accommodate
208                          the specified maxpct, so a high value may result  in
209                          a  filesystem  with nothing but inodes in a signifi‐
210                          cant portion of the lower blocks of the  filesystem.
211                          (This restriction is not present when the filesystem
212                          is mounted with the inode64 option on  64-bit  plat‐
213                          forms).
214
215                          Setting the value to 0 means that essentially all of
216                          the filesystem can become inode blocks,  subject  to
217                          inode32 restrictions.
218
219                          This value can be modified with xfs_growfs(8).
220
221                   align[=value]
222                          This  is used to specify that inode allocation is or
223                          is not aligned. The value is either 0 or 1,  with  1
224                          signifying  that  inodes  are allocated aligned.  If
225                          the value is omitted, 1 is assumed. The  default  is
226                          that  inodes  are  aligned.  Aligned inode access is
227                          normally  more  efficient  than  unaligned   access;
228                          alignment  must  be  established  at  the  time  the
229                          filesystem is created, since inodes are allocated at
230                          that  time.   This  option  can  be used to turn off
231                          inode alignment when  the  filesystem  needs  to  be
232                          mountable  by  a  version of IRIX that does not have
233                          the inode alignment feature  (any  release  of  IRIX
234                          before 6.2, and IRIX 6.2 without XFS patches).
235
236                   attr=value
237                          This  is  used  to  specify  the version of extended
238                          attribute inline allocation policy to be  used.   By
239                          default,  this  is  2, which uses an efficient algo‐
240                          rithm for managing the available inline inode  space
241                          between attribute and extent data.
242
243                          The  previous version 1, which has fixed regions for
244                          attribute and extent data,  is  kept  for  backwards
245                          compatibility   with   kernels  older  than  version
246                          2.6.16.
247
248       -l log_section_options
249              These options specify the location, size, and  other  parameters
250              of  the  log  section  of  the  filesystem.  The  valid log_sec‐
251              tion_options are:
252
253                   internal[=value]
254                          This is used to specify that the log  section  is  a
255                          piece  of  the data section instead of being another
256                          device or logical volume. The value is either  0  or
257                          1,  with  1  signifying that the log is internal. If
258                          the value is omitted, 1 is assumed.
259
260                   logdev=device
261                          This is used to specify that the log section  should
262                          reside on the device separate from the data section.
263                          The  internal=1  and  logdev  options  are  mutually
264                          exclusive.
265
266                   size=value
267                          This is used to specify the size of the log section.
268
269                          If  the log is contained within the data section and
270                          size isn't specified, mkfs.xfs will try to select  a
271                          suitable  log  size  depending  on  the  size of the
272                          filesystem.   The  actual  logsize  depends  on  the
273                          filesystem block size and the directory block size.
274
275                          Otherwise,  the size suboption is only needed if the
276                          log section of the  filesystem  should  occupy  less
277                          space  than  the size of the special file. The value
278                          is specified in bytes or blocks,  with  a  b  suffix
279                          meaning multiplication by the filesystem block size,
280                          as described above. The overriding minimum value for
281                          size  is  512  blocks.   With  some  combinations of
282                          filesystem block size,  inode  size,  and  directory
283                          block  size, the minimum log size is larger than 512
284                          blocks.
285
286                   version=value
287                          This specifies the version of the log.  The  current
288                          default  is  2,  which  allows for larger log buffer
289                          sizes, as  well  as  supporting  stripe-aligned  log
290                          writes (see the sunit and su options, below).
291
292                          The  previous version 1, which is limited to 32k log
293                          buffers and does not support stripe-aligned  writes,
294                          is  kept  for  backwards compatibility with very old
295                          2.4 kernels.
296
297                   sunit=value
298                          This specifies the alignment  to  be  used  for  log
299                          writes.  The  value  has to be specified in 512-byte
300                          block units. Use the su suboption to specify the log
301                          stripe  unit  size  in  bytes.   Log  writes will be
302                          aligned on this boundary, and  rounded  up  to  this
303                          boundary.   This gives major improvements in perfor‐
304                          mance on some configurations such as software  RAID5
305                          when  the sunit is specified as the filesystem block
306                          size.  The equivalent byte value must be a  multiple
307                          of  the  filesystem  block  size. Version 2 logs are
308                          automatically selected if the log sunit suboption is
309                          specified.
310
311                          The su suboption is an alternative to using sunit.
312
313                   su=value
314                          This  is  used  to specify the log stripe. The value
315                          has to be specified in bytes, (usually using  the  s
316                          or b suffixes). This value must be a multiple of the
317                          filesystem block size.  Version 2 logs are automati‐
318                          cally selected if the log su suboption is specified.
319
320                   lazy-count=value
321                          This  changes  the method of logging various persis‐
322                          tent counters in  the  superblock.   Under  metadata
323                          intensive  workloads, these counters are updated and
324                          logged frequently enough that the superblock updates
325                          become  a serialisation point in the filesystem. The
326                          value can be either 0 or 1.
327
328                          With lazy-count=1, the superblock is not modified or
329                          logged  on  every change of the persistent counters.
330                          Instead, enough information is kept in  other  parts
331                          of the filesystem to be able to maintain the persis‐
332                          tent counter values without needed to keep  them  in
333                          the superblock.  This gives significant improvements
334                          in performance on some configurations.  The  default
335                          value  is 1 (on) so you must specify lazy-count=0 if
336                          you want to disable this feature for  older  kernels
337                          which don't support it.
338
339       -n naming_options
340              These  options  specify  the version and size parameters for the
341              naming (directory)  area  of  the  filesystem.  The  valid  nam‐
342              ing_options are:
343
344                   size=value | log=value
345                          The  block  size  is  specified either as a value in
346                          bytes with size=, or as a base two  logarithm  value
347                          with  log=.  The block size must be a power of 2 and
348                          cannot be less than the filesystem block size.   The
349                          default size value for version 2 directories is 4096
350                          bytes (4 KiB), unless the filesystem block  size  is
351                          larger than 4096, in which case the default value is
352                          the filesystem block size.  For version  1  directo‐
353                          ries  the  block  size is the same as the filesystem
354                          block size.
355
356                   version=value
357                          The naming (directory) version value can be either 2
358                          or  'ci', defaulting to 2 if unspecified.  With ver‐
359                          sion 2 directories, the directory block size can  be
360                          any  power  of 2 size from the filesystem block size
361                          up to 65536.
362
363                          The version=ci option enables ASCII only case-insen‐
364                          sitive  filename  lookup  and version 2 directories.
365                          Filenames are case-preserving, that  is,  the  names
366                          are  stored  in directories using the case they were
367                          created with.
368
369                          Note: Version 1 directories are not supported.
370
371       -p protofile
372              If the optional -p protofile argument is  given,  mkfs.xfs  uses
373              protofile as a prototype file and takes its directions from that
374              file.  The blocks and inodes specifiers  in  the  protofile  are
375              provided  for backwards compatibility, but are otherwise unused.
376              The syntax of the protofile is defined by  a  number  of  tokens
377              separated  by spaces or newlines. Note that the line numbers are
378              not part of the syntax but are meant to help you in the  follow‐
379              ing discussion of the file contents.
380
381                   1       /stand/diskboot
382                   2       4872 110
383                   3       d--777 3 1
384                   4       usr     d--777 3 1
385                   5       sh      ---755 3 1 /bin/sh
386                   6       ken     d--755 6 1
387                   7               $
388                   8       b0      b--644 3 1 0 0
389                   9       c0      c--644 3 1 0 0
390                   10      fifo    p--644 3 1
391                   11      slink   l--644 3 1 /a/symbolic/link
392                   12      :  This is a comment line
393                   13      $
394                   14      $
395
396              Line  1  is a dummy string.  (It was formerly the bootfilename.)
397              It is present for backward compatibility; boot  blocks  are  not
398              used on SGI systems.
399
400              Note that some string of characters must be present as the first
401              line of the proto file to cause it to be parsed  correctly;  the
402              value of this string is immaterial since it is ignored.
403
404              Line  2  contains  two  numeric  values (formerly the numbers of
405              blocks and inodes).  These are also merely for backward compati‐
406              bility:  two  numeric  values  must appear at this point for the
407              proto file to be correctly parsed, but their values are  immate‐
408              rial since they are ignored.
409
410              The  lines  3  through  11 specify the files and directories you
411              want to include in this filesystem.  Line  3  defines  the  root
412              directory.  Other  directories  and  files  that you want in the
413              filesystem are indicated by  lines  4  through  6  and  lines  8
414              through 10. Line 11 contains symbolic link syntax.
415
416              Notice the dollar sign ($) syntax on line 7. This syntax directs
417              the mkfs.xfs command to terminate the branch of  the  filesystem
418              it  is  currently on and then continue from the directory speci‐
419              fied by the next line, in this case line 8.  It must be the last
420              character on a line.  The colon on line 12 introduces a comment;
421              all characters up until the following newline are ignored.  Note
422              that this means you cannot have a file in a prototype file whose
423              name contains a colon.  The  $  on  lines  13  and  14  end  the
424              process, since no additional specifications follow.
425
426              File specifications provide the following:
427
428                * file mode
429                * user ID
430                * group ID
431                * the file's beginning contents
432
433              A  6-character  string  defines  the  mode for a file. The first
434              character of this string defines the file  type.  The  character
435              range for this first character is -bcdpl.  A file may be a regu‐
436              lar file, a block special file, a character special file, direc‐
437              tory  files,  named  pipes (first-in, first out files), and sym‐
438              bolic links.  The second character of the mode string is used to
439              specify  setuserID  mode,  in  which case it is u.  If setuserID
440              mode is not specified, the second character  is  -.   The  third
441              character  of  the mode string is used to specify the setgroupID
442              mode, in which case it is g.  If setgroupID mode is  not  speci‐
443              fied, the third character is -.  The remaining characters of the
444              mode string are a three digit octal number.  This  octal  number
445              defines  the  owner,  group,  and other read, write, and execute
446              permissions for the file, respectively.  For more information on
447              file permissions, see the chmod(1) command.
448
449              Following  the  mode  character  string  are  two decimal number
450              tokens that specify the user and group IDs of the file's owner.
451
452              In a regular file, the next token specifies  the  pathname  from
453              which  the contents and size of the file are copied.  In a block
454              or character special file, the next token are two  decimal  num‐
455              bers  that  specify  the major and minor device numbers.  When a
456              file is a symbolic link, the next token specifies  the  contents
457              of the link.
458
459              When  the  file is a directory, the mkfs.xfs command creates the
460              entries dot (.) and dot-dot (..) and  then  reads  the  list  of
461              names  and  file specifications in a recursive manner for all of
462              the entries in the directory. A scan of the protofile is  always
463              terminated with the dollar ( $ ) token.
464
465       -q     Quiet  option.  Normally  mkfs.xfs  prints the parameters of the
466              filesystem to be constructed; the -q flag suppresses this.
467
468       -r realtime_section_options
469              These options specify the location, size, and  other  parameters
470              of  the  real-time  section  of  the filesystem. The valid real‐
471              time_section_options are:
472
473                   rtdev=device
474                          This is used to specify the device which should con‐
475                          tain  the  real-time section of the filesystem.  The
476                          suboption value is the name of a block device.
477
478                   extsize=value
479                          This is used to specify the size of  the  blocks  in
480                          the  real-time section of the filesystem. This value
481                          must be a multiple of the filesystem block size. The
482                          minimum allowed size is the filesystem block size or
483                          4 KiB (whichever is larger); the default size is the
484                          stripe  width for striped volumes or 64 KiB for non-
485                          striped volumes; the maximum allowed size is 1  GiB.
486                          The real-time extent size should be carefully chosen
487                          to match the parameters of the physical media used.
488
489                   size=value
490                          This is used to specify the size  of  the  real-time
491                          section.  This suboption is only needed if the real-
492                          time section of the filesystem  should  occupy  less
493                          space than the size of the partition or logical vol‐
494                          ume containing the section.
495
496       -s sector_size
497              This  option  specifies  the  fundamental  sector  size  of  the
498              filesystem.   The  sector_size is specified either as a value in
499              bytes with size=value or as a  base  two  logarithm  value  with
500              log=value.   The  default  sector_size is 512 bytes. The minimum
501              value for sector size is 512; the maximum is 32768 (32 KiB). The
502              sector_size  must be a power of 2 size and cannot be made larger
503              than the filesystem block size.
504
505       -L label
506              Set the filesystem label.  XFS filesystem labels can be at  most
507              12  characters  long;  if  label  is  longer than 12 characters,
508              mkfs.xfs will not proceed with creating the  filesystem.   Refer
509              to  the  mount(8) and xfs_admin(8) manual entries for additional
510              information.
511
512       -N     Causes the file system parameters  to  be  printed  out  without
513              really creating the file system.
514
515       -K     Do not attempt to discard blocks at mkfs time.
516

SEE ALSO

518       xfs(5), mkfs(8), mount(8), xfs_info(8), xfs_admin(8).
519

BUGS

521       With a prototype file, it is not possible to specify hard links.
522
523
524
525                                                                   mkfs.xfs(8)
Impressum