1mkfs.xfs(8) System Manager's Manual mkfs.xfs(8)
2
3
4
6 mkfs.xfs - construct an XFS filesystem
7
9 mkfs.xfs [ -b block_size_options ] [ -c config_file_options ] [ -m
10 global_metadata_options ] [ -d data_section_options ] [ -f ] [ -i in‐
11 ode_options ] [ -l log_section_options ] [ -n naming_options ] [ -p
12 protofile ] [ -q ] [ -r realtime_section_options ] [ -s sector_size_op‐
13 tions ] [ -L label ] [ -N ] [ -K ] device
14 mkfs.xfs -V
15
17 mkfs.xfs constructs an XFS filesystem by writing on a special file us‐
18 ing the values found in the arguments of the command line. It is in‐
19 voked automatically by mkfs(8) when it is given the -t xfs option.
20
21 In its simplest (and most commonly used form), the size of the filesys‐
22 tem is determined from the disk driver. As an example, to make a
23 filesystem with an internal log on the first partition on the first
24 SCSI disk, use:
25
26 mkfs.xfs /dev/sda1
27
28 The metadata log can be placed on another device to reduce the number
29 of disk seeks. To create a filesystem on the first partition on the
30 first SCSI disk with a 10MiB log located on the first partition on the
31 second SCSI disk, use:
32
33 mkfs.xfs -l logdev=/dev/sdb1,size=10m /dev/sda1
34
35 Each of the option elements in the argument list above can be given as
36 multiple comma-separated suboptions if multiple suboptions apply to the
37 same option. Equivalently, each main option can be given multiple
38 times with different suboptions. For example, -l internal,size=10m and
39 -l internal -l size=10m are equivalent.
40
41 In the descriptions below, sizes are given in sectors, bytes, blocks,
42 kilobytes, megabytes, gigabytes, etc. Sizes are treated as hexadecimal
43 if prefixed by 0x or 0X, octal if prefixed by 0, or decimal otherwise.
44 The following lists possible multiplication suffixes:
45 s - multiply by sector size (default = 512, see -s option be‐
46 low).
47 b - multiply by filesystem block size (default = 4K, see -b op‐
48 tion below).
49 k - multiply by one kilobyte (1,024 bytes).
50 m - multiply by one megabyte (1,048,576 bytes).
51 g - multiply by one gigabyte (1,073,741,824 bytes).
52 t - multiply by one terabyte (1,099,511,627,776 bytes).
53 p - multiply by one petabyte (1,024 terabytes).
54 e - multiply by one exabyte (1,048,576 terabytes).
55
56 When specifying parameters in units of sectors or filesystem blocks,
57 the -s option or the -b option may be used to specify the size of the
58 sector or block. If the size of the block or sector is not specified,
59 the default sizes (block: 4KiB, sector: 512B) will be used.
60
61 Many feature options allow an optional argument of 0 or 1, to explic‐
62 itly disable or enable the functionality.
63
64 The correctness of the crc32c checksum implementation will be tested
65 before formatting the filesystem. If the test fails, the format will
66 abort.
67
69 Options may be specified either on the command line or in a configura‐
70 tion file. Not all command line options can be specified in configura‐
71 tion files; only the command line options followed by a [section] label
72 can be used in a configuration file.
73
74 Options that can be used in configuration files are grouped into re‐
75 lated sections containing multiple options. The command line options
76 and configuration files use the same option sections and grouping.
77 Configuration file section names are listed in the command line option
78 sections below. Option names and values are the same for both command
79 line and configuration file specification.
80
81 Options specified are the combined set of command line parameters and
82 configuration file parameters. Duplicated options will result in a re‐
83 specification error, regardless of the location they were specified at.
84
85 -c configuration_file_option
86 This option specifies the files that mkfs configuration will be
87 obtained from. The valid configuration_file_option is:
88
89 options=name
90 The configuration options will be sourced from the
91 file specified by the name option string. This op‐
92 tion can be use either an absolute or relative path
93 to the configuration file to be read. Sample con‐
94 figuration files can be found in /usr/share/xf‐
95 sprogs/mkfs.
96
97 -b block_size_options
98 Section Name: [block]
99 This option specifies the fundamental block size of the filesys‐
100 tem. The valid block_size_option is:
101
102 size=value
103 The filesystem block size is specified with a value
104 in bytes. The default value is 4096 bytes (4 KiB),
105 the minimum is 512, and the maximum is 65536 (64
106 KiB).
107
108 Although mkfs.xfs will accept any of these values
109 and create a valid filesystem, XFS on Linux can only
110 mount filesystems with pagesize or smaller blocks.
111
112 -m global_metadata_options
113 Section Name: [metadata]
114 These options specify metadata format options that either apply
115 to the entire filesystem or aren't easily characterised by a
116 specific functionality group. The valid global_metadata_options
117 are:
118
119 bigtime=value
120 This option enables filesystems that can handle in‐
121 ode timestamps from December 1901 to July 2486, and
122 quota timer expirations from January 1970 to July
123 2486. The value is either 0 to disable the feature,
124 or 1 to enable large timestamps.
125
126 If this feature is not enabled, the filesystem can
127 only handle timestamps from December 1901 to January
128 2038, and quota timers from January 1970 to February
129 2106.
130
131 By default, mkfs.xfs will not enable this feature.
132 If the option -m crc=0 is used, the large timestamp
133 feature is not supported and is disabled.
134
135 crc=value
136 This is used to create a filesystem which maintains
137 and checks CRC information in all metadata objects
138 on disk. The value is either 0 to disable the fea‐
139 ture, or 1 to enable the use of CRCs.
140
141 CRCs enable enhanced error detection due to hardware
142 issues, whilst the format changes also improves
143 crash recovery algorithms and the ability of various
144 tools to validate and repair metadata corruptions
145 when they are found. The CRC algorithm used is
146 CRC32c, so the overhead is dependent on CPU archi‐
147 tecture as some CPUs have hardware acceleration of
148 this algorithm. Typically the overhead of calculat‐
149 ing and checking the CRCs is not noticeable in nor‐
150 mal operation.
151
152 By default, mkfs.xfs will enable metadata CRCs.
153
154 Formatting a filesystem without CRCs selects the V4
155 format, which is deprecated and will be removed from
156 upstream in September 2030. Distributors may choose
157 to withdraw support for the V4 format earlier than
158 this date. Several other options, noted below, are
159 only tunable on V4 formats, and will be removed
160 along with the V4 format itself.
161
162 finobt=value
163 This option enables the use of a separate free inode
164 btree index in each allocation group. The value is
165 either 0 to disable the feature, or 1 to create a
166 free inode btree in each allocation group.
167
168 The free inode btree mirrors the existing allocated
169 inode btree index which indexes both used and free
170 inodes. The free inode btree does not index used in‐
171 odes, allowing faster, more consistent inode alloca‐
172 tion performance as filesystems age.
173
174 By default, mkfs.xfs will create free inode btrees
175 for filesystems created with the (default) -m crc=1
176 option set. When the option -m crc=0 is used, the
177 free inode btree feature is not supported and is
178 disabled.
179
180 inobtcount=value
181 This option causes the filesystem to record the num‐
182 ber of blocks used by the inode btree and the free
183 inode btree. This can be used to reduce mount times
184 when the free inode btree is enabled.
185
186 By default, mkfs.xfs will not enable this option.
187 This feature is only available for filesystems cre‐
188 ated with the (default) -m finobt=1 option set.
189 When the option -m finobt=0 is used, the inode btree
190 counter feature is not supported and is disabled.
191
192 uuid=value
193 Use the given value as the filesystem UUID for the
194 newly created filesystem. The default is to gener‐
195 ate a random UUID.
196
197 rmapbt=value
198 This option enables the creation of a reverse-map‐
199 ping btree index in each allocation group. The
200 value is either 0 to disable the feature, or 1 to
201 create the btree.
202
203 The reverse mapping btree maps filesystem blocks to
204 the owner of the filesystem block. Most of the map‐
205 pings will be to an inode number and an offset,
206 though there will also be mappings to filesystem
207 metadata. This secondary metadata can be used to
208 validate the primary metadata or to pinpoint exactly
209 which data has been lost when a disk error occurs.
210
211 By default, mkfs.xfs will not create reverse mapping
212 btrees. This feature is only available for filesys‐
213 tems created with the (default) -m crc=1 option set.
214 When the option -m crc=0 is used, the reverse map‐
215 ping btree feature is not supported and is disabled.
216
217 reflink=value
218 This option enables the use of a separate reference
219 count btree index in each allocation group. The
220 value is either 0 to disable the feature, or 1 to
221 create a reference count btree in each allocation
222 group.
223
224 The reference count btree enables the sharing of
225 physical extents between the data forks of different
226 files, which is commonly known as "reflink". Unlike
227 traditional Unix filesystems which assume that every
228 inode and logical block pair map to a unique physi‐
229 cal block, a reflink-capable XFS filesystem removes
230 the uniqueness requirement, allowing up to four bil‐
231 lion arbitrary inode/logical block pairs to map to a
232 physical block. If a program tries to write to a
233 multiply-referenced block in a file, the write will
234 be redirected to a new block, and that file's logi‐
235 cal-to-physical mapping will be changed to the new
236 block ("copy on write"). This feature enables the
237 creation of per-file snapshots and deduplication.
238 It is only available for the data forks of regular
239 files.
240
241 By default, mkfs.xfs will create reference count
242 btrees and therefore will enable the reflink fea‐
243 ture. This feature is only available for filesys‐
244 tems created with the (default) -m crc=1 option set.
245 When the option -m crc=0 is used, the reference
246 count btree feature is not supported and reflink is
247 disabled.
248
249 Note: the filesystem DAX mount option ( -o dax ) is
250 incompatible with reflink-enabled XFS filesystems.
251 To use filesystem DAX with XFS, specify the -m re‐
252 flink=0 option to mkfs.xfs to disable the reflink
253 feature.
254
255 -d data_section_options
256 Section Name: [data]
257 These options specify the location, size, and other parameters
258 of the data section of the filesystem. The valid data_sec‐
259 tion_options are:
260
261 agcount=value
262 This is used to specify the number of allocation
263 groups. The data section of the filesystem is di‐
264 vided into allocation groups to improve the perfor‐
265 mance of XFS. More allocation groups imply that more
266 parallelism can be achieved when allocating blocks
267 and inodes. The minimum allocation group size is 16
268 MiB; the maximum size is just under 1 TiB. The data
269 section of the filesystem is divided into value al‐
270 location groups (default value is scaled automati‐
271 cally based on the underlying device size).
272
273 agsize=value
274 This is an alternative to using the agcount subop‐
275 tion. The value is the desired size of the alloca‐
276 tion group expressed in bytes (usually using the m
277 or g suffixes). This value must be a multiple of
278 the filesystem block size, and must be at least
279 16MiB, and no more than 1TiB, and may be automati‐
280 cally adjusted to properly align with the stripe ge‐
281 ometry. The agcount and agsize suboptions are mutu‐
282 ally exclusive.
283
284 cowextsize=value
285 Set the copy-on-write extent size hint on all inodes
286 created by mkfs.xfs. The value must be provided in
287 units of filesystem blocks. If the value is zero,
288 the default value (currently 32 blocks) will be
289 used. Directories will pass on this hint to newly
290 created regular files and directories.
291
292 name=value
293 This can be used to specify the name of the special
294 file containing the filesystem. In this case, the
295 log section must be specified as internal (with a
296 size, see the -l option below) and there can be no
297 real-time section.
298
299 file[=value]
300 This is used to specify that the file given by the
301 name suboption is a regular file. The value is ei‐
302 ther 0 or 1, with 1 signifying that the file is reg‐
303 ular. This suboption is used only to make a filesys‐
304 tem image. If the value is omitted then 1 is as‐
305 sumed.
306
307 size=value
308 This is used to specify the size of the data sec‐
309 tion. This suboption is required if -d file[=1] is
310 given. Otherwise, it is only needed if the filesys‐
311 tem should occupy less space than the size of the
312 special file.
313
314 sunit=value
315 This is used to specify the stripe unit for a RAID
316 device or a logical volume. The value has to be
317 specified in 512-byte block units. Use the su subop‐
318 tion to specify the stripe unit size in bytes. This
319 suboption ensures that data allocations will be
320 stripe unit aligned when the current end of file is
321 being extended and the file size is larger than
322 512KiB. Also inode allocations and the internal log
323 will be stripe unit aligned.
324
325 su=value
326 This is an alternative to using sunit. The su sub‐
327 option is used to specify the stripe unit for a RAID
328 device or a striped logical volume. The value has to
329 be specified in bytes, (usually using the m or g
330 suffixes). This value must be a multiple of the
331 filesystem block size.
332
333 swidth=value
334 This is used to specify the stripe width for a RAID
335 device or a striped logical volume. The value has to
336 be specified in 512-byte block units. Use the sw
337 suboption to specify the stripe width size in bytes.
338 This suboption is required if -d sunit has been
339 specified and it has to be a multiple of the -d
340 sunit suboption.
341
342 sw=value
343 suboption is an alternative to using swidth. The sw
344 suboption is used to specify the stripe width for a
345 RAID device or striped logical volume. The value is
346 expressed as a multiplier of the stripe unit, usu‐
347 ally the same as the number of stripe members in the
348 logical volume configuration, or data disks in a
349 RAID device.
350
351 When a filesystem is created on a logical volume de‐
352 vice, mkfs.xfs will automatically query the logical
353 volume for appropriate sunit and swidth values.
354
355 noalign
356 This option disables automatic geometry detection
357 and creates the filesystem without stripe geometry
358 alignment even if the underlying storage device pro‐
359 vides this information.
360
361 rtinherit=value
362 If value is set to 1, all inodes created by mkfs.xfs
363 will be created with the realtime flag set. The de‐
364 fault is 0. Directories will pass on this flag to
365 newly created regular files and directories.
366
367 projinherit=value
368 All inodes created by mkfs.xfs will be assigned the
369 project quota id provided in value. Directories
370 will pass on the project id to newly created regular
371 files and directories.
372
373 extszinherit=value
374 All inodes created by mkfs.xfs will have this value
375 extent size hint applied. The value must be pro‐
376 vided in units of filesystem blocks. Directories
377 will pass on this hint to newly created regular
378 files and directories.
379
380 daxinherit=value
381 If value is set to 1, all inodes created by mkfs.xfs
382 will be created with the DAX flag set. The default
383 is 0. Directories will pass on this flag to newly
384 created regular files and directories. By default,
385 mkfs.xfs will not enable DAX mode.
386
387 -f Force overwrite when an existing filesystem is detected on the
388 device. By default, mkfs.xfs will not write to the device if it
389 suspects that there is a filesystem or partition table on the
390 device already.
391
392 -i inode_options
393 Section Name: [inode]
394 This option specifies the inode size of the filesystem, and
395 other inode allocation parameters. The XFS inode contains a
396 fixed-size part and a variable-size part. The variable-size
397 part, whose size is affected by this option, can contain: direc‐
398 tory data, for small directories; attribute data, for small at‐
399 tribute sets; symbolic link data, for small symbolic links; the
400 extent list for the file, for files with a small number of ex‐
401 tents; and the root of a tree describing the location of extents
402 for the file, for files with a large number of extents.
403
404 The valid inode_options are:
405
406 size=value | perblock=value
407 The inode size is specified either as a value in
408 bytes with size= or as the number fitting in a
409 filesystem block with perblock=. The minimum (and
410 default) value is 256 bytes without crc, 512 bytes
411 with crc enabled. The maximum value is 2048 (2 KiB)
412 subject to the restriction that the inode size can‐
413 not exceed one half of the filesystem block size.
414
415 XFS uses 64-bit inode numbers internally; however,
416 the number of significant bits in an inode number is
417 affected by filesystem geometry. In practice,
418 filesystem size and inode size are the predominant
419 factors. The Linux kernel (on 32 bit hardware plat‐
420 forms) and most applications cannot currently handle
421 inode numbers greater than 32 significant bits, so
422 if no inode size is given on the command line,
423 mkfs.xfs will attempt to choose a size such that in‐
424 ode numbers will be < 32 bits. If an inode size is
425 specified, or if a filesystem is sufficiently large,
426 mkfs.xfs will warn if this will create inode numbers
427 > 32 significant bits.
428
429 maxpct=value
430 This specifies the maximum percentage of space in
431 the filesystem that can be allocated to inodes. The
432 default value is 25% for filesystems under 1TB, 5%
433 for filesystems under 50TB and 1% for filesystems
434 over 50TB.
435
436 Setting the value to 0 means that essentially all of
437 the filesystem can become inode blocks (subject to
438 possible inode32 mount option restrictions, see
439 xfs(5) for details.)
440
441 This value can be modified with xfs_growfs(8).
442
443 align[=value]
444 This is used to specify that inode allocation is or
445 is not aligned. The value is either 0 or 1, with 1
446 signifying that inodes are allocated aligned. If
447 the value is omitted, 1 is assumed. The default is
448 that inodes are aligned. Aligned inode access is
449 normally more efficient than unaligned access;
450 alignment must be established at the time the
451 filesystem is created, since inodes are allocated at
452 that time. This option can be used to turn off in‐
453 ode alignment when the filesystem needs to be mount‐
454 able by a version of IRIX that does not have the in‐
455 ode alignment feature (any release of IRIX before
456 6.2, and IRIX 6.2 without XFS patches).
457
458 This option is only tunable on the deprecated V4
459 format.
460
461 attr=value
462 This is used to specify the version of extended at‐
463 tribute inline allocation policy to be used. By de‐
464 fault, this is 2, which uses an efficient algorithm
465 for managing the available inline inode space be‐
466 tween attribute and extent data.
467
468 The previous version 1, which has fixed regions for
469 attribute and extent data, is kept for backwards
470 compatibility with kernels older than version
471 2.6.16.
472
473 This option is only tunable on the deprecated V4
474 format.
475
476 projid32bit[=value]
477 This is used to enable 32bit quota project identi‐
478 fiers. The value is either 0 or 1, with 1 signifying
479 that 32bit projid are to be enabled. If the value
480 is omitted, 1 is assumed. (This default changed in
481 release version 3.2.0.)
482
483 This option is only tunable on the deprecated V4
484 format.
485
486 sparse[=value]
487 Enable sparse inode chunk allocation. The value is
488 either 0 or 1, with 1 signifying that sparse alloca‐
489 tion is enabled. If the value is omitted, 1 is as‐
490 sumed. Sparse inode allocation is disabled by de‐
491 fault. This feature is only available for filesys‐
492 tems formatted with -m crc=1.
493
494 When enabled, sparse inode allocation allows the
495 filesystem to allocate smaller than the standard
496 64-inode chunk when free space is severely limited.
497 This feature is useful for filesystems that might
498 fragment free space over time such that no free ex‐
499 tents are large enough to accommodate a chunk of 64
500 inodes. Without this feature enabled, inode alloca‐
501 tions can fail with out of space errors under severe
502 fragmented free space conditions.
503
504 -l log_section_options
505 Section Name: [log]
506 These options specify the location, size, and other parameters
507 of the log section of the filesystem. The valid log_section_op‐
508 tions are:
509
510 agnum=value
511 If the log is internal, allocate it in this AG.
512
513 internal[=value]
514 This is used to specify that the log section is a
515 piece of the data section instead of being another
516 device or logical volume. The value is either 0 or
517 1, with 1 signifying that the log is internal. If
518 the value is omitted, 1 is assumed.
519
520 logdev=device
521 This is used to specify that the log section should
522 reside on the device separate from the data section.
523 The internal=1 and logdev options are mutually ex‐
524 clusive.
525
526 size=value
527 This is used to specify the size of the log section.
528
529 If the log is contained within the data section and
530 size isn't specified, mkfs.xfs will try to select a
531 suitable log size depending on the size of the
532 filesystem. The actual logsize depends on the
533 filesystem block size and the directory block size.
534
535 Otherwise, the size suboption is only needed if the
536 log section of the filesystem should occupy less
537 space than the size of the special file. The value
538 is specified in bytes or blocks, with a b suffix
539 meaning multiplication by the filesystem block size,
540 as described above. The overriding minimum value for
541 size is 512 blocks. With some combinations of
542 filesystem block size, inode size, and directory
543 block size, the minimum log size is larger than 512
544 blocks.
545
546 version=value
547 This specifies the version of the log. The current
548 default is 2, which allows for larger log buffer
549 sizes, as well as supporting stripe-aligned log
550 writes (see the sunit and su options, below).
551
552 The previous version 1, which is limited to 32k log
553 buffers and does not support stripe-aligned writes,
554 is kept for backwards compatibility with very old
555 2.4 kernels.
556
557 This option is only tunable on the deprecated V4
558 format.
559
560 sunit=value
561 This specifies the alignment to be used for log
562 writes. The value has to be specified in 512-byte
563 block units. Use the su suboption to specify the log
564 stripe unit size in bytes. Log writes will be
565 aligned on this boundary, and rounded up to this
566 boundary. This gives major improvements in perfor‐
567 mance on some configurations such as software RAID5
568 when the sunit is specified as the filesystem block
569 size. The equivalent byte value must be a multiple
570 of the filesystem block size. Version 2 logs are au‐
571 tomatically selected if the log sunit suboption is
572 specified.
573
574 The su suboption is an alternative to using sunit.
575
576 su=value
577 This is used to specify the log stripe. The value
578 has to be specified in bytes, (usually using the s
579 or b suffixes). This value must be a multiple of the
580 filesystem block size. Version 2 logs are automati‐
581 cally selected if the log su suboption is specified.
582
583 lazy-count=value
584 This changes the method of logging various persis‐
585 tent counters in the superblock. Under metadata in‐
586 tensive workloads, these counters are updated and
587 logged frequently enough that the superblock updates
588 become a serialization point in the filesystem. The
589 value can be either 0 or 1.
590
591 With lazy-count=1, the superblock is not modified or
592 logged on every change of the persistent counters.
593 Instead, enough information is kept in other parts
594 of the filesystem to be able to maintain the persis‐
595 tent counter values without needed to keep them in
596 the superblock. This gives significant improvements
597 in performance on some configurations. The default
598 value is 1 (on) so you must specify lazy-count=0 if
599 you want to disable this feature for older kernels
600 which don't support it.
601
602 This option is only tunable on the deprecated V4
603 format.
604
605 -n naming_options
606 Section Name: [naming]
607 These options specify the version and size parameters for the
608 naming (directory) area of the filesystem. The valid naming_op‐
609 tions are:
610
611 size=value
612 The directory block size is specified with a value
613 in bytes. The block size must be a power of 2 and
614 cannot be less than the filesystem block size. The
615 default size value for version 2 directories is 4096
616 bytes (4 KiB), unless the filesystem block size is
617 larger than 4096, in which case the default value is
618 the filesystem block size. For version 1 directo‐
619 ries the block size is the same as the filesystem
620 block size.
621
622 version=value
623 The naming (directory) version value can be either 2
624 or 'ci', defaulting to 2 if unspecified. With ver‐
625 sion 2 directories, the directory block size can be
626 any power of 2 size from the filesystem block size
627 up to 65536.
628
629 The version=ci option enables ASCII only case-insen‐
630 sitive filename lookup and version 2 directories.
631 Filenames are case-preserving, that is, the names
632 are stored in directories using the case they were
633 created with.
634
635 Note: Version 1 directories are not supported.
636
637 ftype=value
638 This feature allows the inode type to be stored in
639 the directory structure so that the readdir(3) and
640 getdents(2) do not need to look up the inode to de‐
641 termine the inode type.
642
643 The value is either 0 or 1, with 1 signifying that
644 filetype information will be stored in the directory
645 structure. The default value is 1.
646
647 When CRCs are enabled (the default), the ftype func‐
648 tionality is always enabled, and cannot be turned
649 off.
650
651 In other words, this option is only tunable on the
652 deprecated V4 format.
653
654 -p protofile
655 If the optional -p protofile argument is given, mkfs.xfs uses
656 protofile as a prototype file and takes its directions from that
657 file. The blocks and inodes specifiers in the protofile are
658 provided for backwards compatibility, but are otherwise unused.
659 The syntax of the protofile is defined by a number of tokens
660 separated by spaces or newlines. Note that the line numbers are
661 not part of the syntax but are meant to help you in the follow‐
662 ing discussion of the file contents.
663
664 1 /stand/diskboot
665 2 4872 110
666 3 d--777 3 1
667 4 usr d--777 3 1
668 5 sh ---755 3 1 /bin/sh
669 6 ken d--755 6 1
670 7 $
671 8 b0 b--644 3 1 0 0
672 9 c0 c--644 3 1 0 0
673 10 fifo p--644 3 1
674 11 slink l--644 3 1 /a/symbolic/link
675 12 : This is a comment line
676 13 $
677 14 $
678
679 Line 1 is a dummy string. (It was formerly the bootfilename.)
680 It is present for backward compatibility; boot blocks are not
681 used on SGI systems.
682
683 Note that some string of characters must be present as the first
684 line of the proto file to cause it to be parsed correctly; the
685 value of this string is immaterial since it is ignored.
686
687 Line 2 contains two numeric values (formerly the numbers of
688 blocks and inodes). These are also merely for backward compati‐
689 bility: two numeric values must appear at this point for the
690 proto file to be correctly parsed, but their values are immate‐
691 rial since they are ignored.
692
693 The lines 3 through 11 specify the files and directories you
694 want to include in this filesystem. Line 3 defines the root di‐
695 rectory. Other directories and files that you want in the
696 filesystem are indicated by lines 4 through 6 and lines 8
697 through 10. Line 11 contains symbolic link syntax.
698
699 Notice the dollar sign ($) syntax on line 7. This syntax directs
700 the mkfs.xfs command to terminate the branch of the filesystem
701 it is currently on and then continue from the directory speci‐
702 fied by the next line, in this case line 8. It must be the last
703 character on a line. The colon on line 12 introduces a comment;
704 all characters up until the following newline are ignored. Note
705 that this means you cannot have a file in a prototype file whose
706 name contains a colon. The $ on lines 13 and 14 end the
707 process, since no additional specifications follow.
708
709 File specifications provide the following:
710
711 * file mode
712 * user ID
713 * group ID
714 * the file's beginning contents
715
716 A 6-character string defines the mode for a file. The first
717 character of this string defines the file type. The character
718 range for this first character is -bcdpl. A file may be a regu‐
719 lar file, a block special file, a character special file, direc‐
720 tory files, named pipes (first-in, first out files), and sym‐
721 bolic links. The second character of the mode string is used to
722 specify setuserID mode, in which case it is u. If setuserID
723 mode is not specified, the second character is -. The third
724 character of the mode string is used to specify the setgroupID
725 mode, in which case it is g. If setgroupID mode is not speci‐
726 fied, the third character is -. The remaining characters of the
727 mode string are a three digit octal number. This octal number
728 defines the owner, group, and other read, write, and execute
729 permissions for the file, respectively. For more information on
730 file permissions, see the chmod(1) command.
731
732 Following the mode character string are two decimal number to‐
733 kens that specify the user and group IDs of the file's owner.
734
735 In a regular file, the next token specifies the pathname from
736 which the contents and size of the file are copied. In a block
737 or character special file, the next token are two decimal num‐
738 bers that specify the major and minor device numbers. When a
739 file is a symbolic link, the next token specifies the contents
740 of the link.
741
742 When the file is a directory, the mkfs.xfs command creates the
743 entries dot (.) and dot-dot (..) and then reads the list of
744 names and file specifications in a recursive manner for all of
745 the entries in the directory. A scan of the protofile is always
746 terminated with the dollar ( $ ) token.
747
748 -q Quiet option. Normally mkfs.xfs prints the parameters of the
749 filesystem to be constructed; the -q flag suppresses this.
750
751 -r realtime_section_options
752 Section Name: [realtime]
753 These options specify the location, size, and other parameters
754 of the real-time section of the filesystem. The valid real‐
755 time_section_options are:
756
757 rtdev=device
758 This is used to specify the device which should con‐
759 tain the real-time section of the filesystem. The
760 suboption value is the name of a block device.
761
762 extsize=value
763 This is used to specify the size of the blocks in
764 the real-time section of the filesystem. This value
765 must be a multiple of the filesystem block size. The
766 minimum allowed size is the filesystem block size or
767 4 KiB (whichever is larger); the default size is the
768 stripe width for striped volumes or 64 KiB for non-
769 striped volumes; the maximum allowed size is 1 GiB.
770 The real-time extent size should be carefully chosen
771 to match the parameters of the physical media used.
772
773 size=value
774 This is used to specify the size of the real-time
775 section. This suboption is only needed if the real-
776 time section of the filesystem should occupy less
777 space than the size of the partition or logical vol‐
778 ume containing the section.
779
780 noalign
781 This option disables stripe size detection, enforc‐
782 ing a realtime device with no stripe geometry.
783
784 -s sector_size_options
785 Section Name: [sector]
786 This option specifies the fundamental sector size of the
787 filesystem. The valid sector_size_option is:
788
789 size=value
790 The sector size is specified with a value in bytes.
791 The default sector_size is 512 bytes. The minimum
792 value for sector size is 512; the maximum is 32768
793 (32 KiB). The sector_size must be a power of 2 size
794 and cannot be made larger than the filesystem block
795 size.
796
797 -L label
798 Set the filesystem label. XFS filesystem labels can be at most
799 12 characters long; if label is longer than 12 characters,
800 mkfs.xfs will not proceed with creating the filesystem. Refer
801 to the mount(8) and xfs_admin(8) manual entries for additional
802 information.
803
804 -N Causes the file system parameters to be printed out without re‐
805 ally creating the file system.
806
807 -K Do not attempt to discard blocks at mkfs time.
808
809 -V Prints the version number and exits.
810
812 The configuration file uses a basic INI format to specify sections and
813 options within a section. Section and option names are case sensitive.
814 Section names must not contain whitespace. Options are name-value
815 pairs, ended by the first whitespace in the line. Option names cannot
816 contain whitespace. Full line comments can be added by starting a line
817 with a # symbol. If values contain whitespace, then it must be quoted.
818
819 The following example configuration file sets the block size to 4096
820 bytes, turns on reverse mapping btrees and sets the inode size to 2048
821 bytes.
822
823 # Example mkfs.xfs configuration file
824
825 [block]
826 size=4k
827
828 [metadata]
829 rmapbt=1
830
831 [inode]
832 size=2048
833
834
836 xfs(5), mkfs(8), mount(8), xfs_info(8), xfs_admin(8).
837
839 With a prototype file, it is not possible to specify hard links.
840
841
842
843 mkfs.xfs(8)