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