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

SEE ALSO

532       xfs(5), mkfs(8), mount(8), xfs_info(8), xfs_admin(8).
533

BUGS

535       With a prototype file, it is not possible to specify hard links.
536
537
538
539                                                                   mkfs.xfs(8)
Impressum