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_options ] [ -q ] [ -r realtime_section_options ] [ -s sec‐
13 tor_size_options ] [ -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 100MiB log located on the first partition on the
31 second SCSI disk, use:
32
33 mkfs.xfs -l logdev=/dev/sdb1,size=100m /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=100m
39 and -l internal -l size=100m 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 enable this feature. If
132 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 enable this option. This
187 feature is only available for filesystems created
188 with the (default) -m finobt=1 option set. When the
189 option -m finobt=0 is used, the inode btree counter
190 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 The data section must be at least 300MB in size.
315
316 sunit=value
317 This is used to specify the stripe unit for a RAID
318 device or a logical volume. The value has to be
319 specified in 512-byte block units. Use the su subop‐
320 tion to specify the stripe unit size in bytes. This
321 suboption ensures that data allocations will be
322 stripe unit aligned when the current end of file is
323 being extended and the file size is larger than
324 512KiB. Also inode allocations and the internal log
325 will be stripe unit aligned.
326
327 su=value
328 This is an alternative to using sunit. The su sub‐
329 option is used to specify the stripe unit for a RAID
330 device or a striped logical volume. The value has to
331 be specified in bytes, (usually using the m or g
332 suffixes). This value must be a multiple of the
333 filesystem block size.
334
335 swidth=value
336 This is used to specify the stripe width for a RAID
337 device or a striped logical volume. The value has to
338 be specified in 512-byte block units. Use the sw
339 suboption to specify the stripe width size in bytes.
340 This suboption is required if -d sunit has been
341 specified and it has to be a multiple of the -d
342 sunit suboption.
343
344 sw=value
345 suboption is an alternative to using swidth. The sw
346 suboption is used to specify the stripe width for a
347 RAID device or striped logical volume. The value is
348 expressed as a multiplier of the stripe unit, usu‐
349 ally the same as the number of stripe members in the
350 logical volume configuration, or data disks in a
351 RAID device.
352
353 When a filesystem is created on a block device,
354 mkfs.xfs will automatically query the block device
355 for appropriate sunit and swidth values if the block
356 device and the filesystem size would be larger than
357 1GB.
358
359 noalign
360 This option disables automatic geometry detection
361 and creates the filesystem without stripe geometry
362 alignment even if the underlying storage device pro‐
363 vides this information.
364
365 rtinherit=value
366 If value is set to 1, all inodes created by mkfs.xfs
367 will be created with the realtime flag set. The de‐
368 fault is 0. Directories will pass on this flag to
369 newly created regular files and directories.
370
371 projinherit=value
372 All inodes created by mkfs.xfs will be assigned the
373 project quota id provided in value. Directories
374 will pass on the project id to newly created regular
375 files and directories.
376
377 extszinherit=value
378 All inodes created by mkfs.xfs will have this value
379 extent size hint applied. The value must be pro‐
380 vided in units of filesystem blocks. Directories
381 will pass on this hint to newly created regular
382 files and directories.
383
384 daxinherit=value
385 If value is set to 1, all inodes created by mkfs.xfs
386 will be created with the DAX flag set. The default
387 is 0. Directories will pass on this flag to newly
388 created regular files and directories. By default,
389 mkfs.xfs will not enable DAX mode.
390
391 -f Force overwrite when an existing filesystem is detected on the
392 device. By default, mkfs.xfs will not write to the device if it
393 suspects that there is a filesystem or partition table on the
394 device already.
395
396 -i inode_options
397 Section Name: [inode]
398 This option specifies the inode size of the filesystem, and
399 other inode allocation parameters. The XFS inode contains a
400 fixed-size part and a variable-size part. The variable-size
401 part, whose size is affected by this option, can contain: direc‐
402 tory data, for small directories; attribute data, for small at‐
403 tribute sets; symbolic link data, for small symbolic links; the
404 extent list for the file, for files with a small number of ex‐
405 tents; and the root of a tree describing the location of extents
406 for the file, for files with a large number of extents.
407
408 The valid inode_options are:
409
410 size=value | perblock=value
411 The inode size is specified either as a value in
412 bytes with size= or as the number fitting in a
413 filesystem block with perblock=. The minimum (and
414 default) value is 256 bytes without crc, 512 bytes
415 with crc enabled. The maximum value is 2048 (2 KiB)
416 subject to the restriction that the inode size can‐
417 not exceed one half of the filesystem block size.
418
419 XFS uses 64-bit inode numbers internally; however,
420 the number of significant bits in an inode number is
421 affected by filesystem geometry. In practice,
422 filesystem size and inode size are the predominant
423 factors. The Linux kernel (on 32 bit hardware plat‐
424 forms) and most applications cannot currently handle
425 inode numbers greater than 32 significant bits, so
426 if no inode size is given on the command line,
427 mkfs.xfs will attempt to choose a size such that in‐
428 ode numbers will be < 32 bits. If an inode size is
429 specified, or if a filesystem is sufficiently large,
430 mkfs.xfs will warn if this will create inode numbers
431 > 32 significant bits.
432
433 maxpct=value
434 This specifies the maximum percentage of space in
435 the filesystem that can be allocated to inodes. The
436 default value is 25% for filesystems under 1TB, 5%
437 for filesystems under 50TB and 1% for filesystems
438 over 50TB.
439
440 Setting the value to 0 means that essentially all of
441 the filesystem can become inode blocks (subject to
442 possible inode32 mount option restrictions, see
443 xfs(5) for details.)
444
445 This value can be modified with xfs_growfs(8).
446
447 align[=value]
448 This is used to specify that inode allocation is or
449 is not aligned. The value is either 0 or 1, with 1
450 signifying that inodes are allocated aligned. If
451 the value is omitted, 1 is assumed. The default is
452 that inodes are aligned. Aligned inode access is
453 normally more efficient than unaligned access;
454 alignment must be established at the time the
455 filesystem is created, since inodes are allocated at
456 that time. This option can be used to turn off in‐
457 ode alignment when the filesystem needs to be mount‐
458 able by a version of IRIX that does not have the in‐
459 ode alignment feature (any release of IRIX before
460 6.2, and IRIX 6.2 without XFS patches).
461
462 This option is only tunable on the deprecated V4
463 format.
464
465 attr=value
466 This is used to specify the version of extended at‐
467 tribute inline allocation policy to be used. By de‐
468 fault, this is 2, which uses an efficient algorithm
469 for managing the available inline inode space be‐
470 tween attribute and extent data.
471
472 The previous version 1, which has fixed regions for
473 attribute and extent data, is kept for backwards
474 compatibility with kernels older than version
475 2.6.16.
476
477 This option is only tunable on the deprecated V4
478 format.
479
480 projid32bit[=value]
481 This is used to enable 32bit quota project identi‐
482 fiers. The value is either 0 or 1, with 1 signifying
483 that 32bit projid are to be enabled. If the value
484 is omitted, 1 is assumed. (This default changed in
485 release version 3.2.0.)
486
487 This option is only tunable on the deprecated V4
488 format.
489
490 sparse[=value]
491 Enable sparse inode chunk allocation. The value is
492 either 0 or 1, with 1 signifying that sparse alloca‐
493 tion is enabled. If the value is omitted, 1 is as‐
494 sumed. Sparse inode allocation is enabled by de‐
495 fault. This feature is only available for filesys‐
496 tems formatted with -m crc=1.
497
498 When enabled, sparse inode allocation allows the
499 filesystem to allocate smaller than the standard
500 64-inode chunk when free space is severely limited.
501 This feature is useful for filesystems that might
502 fragment free space over time such that no free ex‐
503 tents are large enough to accommodate a chunk of 64
504 inodes. Without this feature enabled, inode alloca‐
505 tions can fail with out of space errors under severe
506 fragmented free space conditions.
507
508 nrext64[=value]
509 Extend maximum values of inode data and attr fork
510 extent counters from 2^31 - 1 and 2^15 - 1 to 2^48 -
511 1 and 2^32 - 1 respectively. If the value is omit‐
512 ted, 1 is assumed. This feature is disabled by de‐
513 fault. This feature is only available for filesys‐
514 tems formatted with -m crc=1.
515
516
517 -l log_section_options
518 Section Name: [log]
519 These options specify the location, size, and other parameters
520 of the log section of the filesystem. The valid log_section_op‐
521 tions are:
522
523 agnum=value
524 If the log is internal, allocate it in this AG.
525
526 internal[=value]
527 This is used to specify that the log section is a
528 piece of the data section instead of being another
529 device or logical volume. The value is either 0 or
530 1, with 1 signifying that the log is internal. If
531 the value is omitted, 1 is assumed.
532
533 logdev=device
534 This is used to specify that the log section should
535 reside on the device separate from the data section.
536 The internal=1 and logdev options are mutually ex‐
537 clusive.
538
539 size=value
540 This is used to specify the size of the log section.
541
542 If the log is contained within the data section and
543 size isn't specified, mkfs.xfs will try to select a
544 suitable log size depending on the size of the
545 filesystem. The actual logsize depends on the
546 filesystem block size and the directory block size.
547
548 Otherwise, the size suboption is only needed if the
549 log section of the filesystem should occupy less
550 space than the size of the special file. The value
551 is specified in bytes or blocks, with a b suffix
552 meaning multiplication by the filesystem block size,
553 as described above. The overriding minimum value for
554 size is 512 blocks. With some combinations of
555 filesystem block size, inode size, and directory
556 block size, the minimum log size is larger than 512
557 blocks.
558
559 The log must be at least 64MB in size. The log can‐
560 not be more than 2GB in size.
561
562 version=value
563 This specifies the version of the log. The current
564 default is 2, which allows for larger log buffer
565 sizes, as well as supporting stripe-aligned log
566 writes (see the sunit and su options, below).
567
568 The previous version 1, which is limited to 32k log
569 buffers and does not support stripe-aligned writes,
570 is kept for backwards compatibility with very old
571 2.4 kernels.
572
573 This option is only tunable on the deprecated V4
574 format.
575
576 sunit=value
577 This specifies the alignment to be used for log
578 writes. The value has to be specified in 512-byte
579 block units. Use the su suboption to specify the log
580 stripe unit size in bytes. Log writes will be
581 aligned on this boundary, and rounded up to this
582 boundary. This gives major improvements in perfor‐
583 mance on some configurations such as software RAID5
584 when the sunit is specified as the filesystem block
585 size. The equivalent byte value must be a multiple
586 of the filesystem block size. Version 2 logs are au‐
587 tomatically selected if the log sunit suboption is
588 specified.
589
590 The su suboption is an alternative to using sunit.
591
592 su=value
593 This is used to specify the log stripe. The value
594 has to be specified in bytes, (usually using the s
595 or b suffixes). This value must be a multiple of the
596 filesystem block size. Version 2 logs are automati‐
597 cally selected if the log su suboption is specified.
598
599 lazy-count=value
600 This changes the method of logging various persis‐
601 tent counters in the superblock. Under metadata in‐
602 tensive workloads, these counters are updated and
603 logged frequently enough that the superblock updates
604 become a serialization point in the filesystem. The
605 value can be either 0 or 1.
606
607 With lazy-count=1, the superblock is not modified or
608 logged on every change of the persistent counters.
609 Instead, enough information is kept in other parts
610 of the filesystem to be able to maintain the persis‐
611 tent counter values without needed to keep them in
612 the superblock. This gives significant improvements
613 in performance on some configurations. The default
614 value is 1 (on) so you must specify lazy-count=0 if
615 you want to disable this feature for older kernels
616 which don't support it.
617
618 This option is only tunable on the deprecated V4
619 format.
620
621 -n naming_options
622 Section Name: [naming]
623 These options specify the version and size parameters for the
624 naming (directory) area of the filesystem. The valid naming_op‐
625 tions are:
626
627 size=value
628 The directory block size is specified with a value
629 in bytes. The block size must be a power of 2 and
630 cannot be less than the filesystem block size. The
631 default size value for version 2 directories is 4096
632 bytes (4 KiB), unless the filesystem block size is
633 larger than 4096, in which case the default value is
634 the filesystem block size. For version 1 directo‐
635 ries the block size is the same as the filesystem
636 block size.
637
638 version=value
639 The naming (directory) version value can be either 2
640 or 'ci', defaulting to 2 if unspecified. With ver‐
641 sion 2 directories, the directory block size can be
642 any power of 2 size from the filesystem block size
643 up to 65536.
644
645 If the version=ci option is specified, the kernel
646 will transform certain bytes in filenames before
647 performing lookup-related operations. The byte se‐
648 quence given to create a directory entry is per‐
649 sisted without alterations. The lookup transforma‐
650 tions are defined as follows:
651
652 0x41-0x5a -> 0x61-0x7a
653
654 0xc0-0xd6 -> 0xe0-0xf6
655
656 0xd8-0xde -> 0xf8-0xfe
657
658 This transformation roughly corresponds to case in‐
659 sensitivity in ISO 8859-1. The transformations are
660 not compatible with other encodings (e.g. UTF8). Do
661 not enable this feature unless your entire environ‐
662 ment has been coerced to ISO 8859-1. This feature
663 is deprecated and will be removed in September 2030.
664
665 Note: Version 1 directories are not supported.
666
667 ftype=value
668 This feature allows the inode type to be stored in
669 the directory structure so that the readdir(3) and
670 getdents(2) do not need to look up the inode to de‐
671 termine the inode type.
672
673 The value is either 0 or 1, with 1 signifying that
674 filetype information will be stored in the directory
675 structure. The default value is 1.
676
677 When CRCs are enabled (the default), the ftype func‐
678 tionality is always enabled, and cannot be turned
679 off.
680
681 In other words, this option is only tunable on the
682 deprecated V4 format.
683
684 -p protofile_options
685 Section Name: [proto]
686 These options specify the protofile parameters for populating
687 the filesystem. The valid protofile_options are:
688
689 [file=]protofile
690 The file= prefix is not required for this CLI argu‐
691 ment for legacy reasons. If specified as a config
692 file directive, the prefix is required.
693
694 If the optional protofile argument is given,
695 mkfs.xfs uses protofile as a prototype file and
696 takes its directions from that file. The blocks and
697 inodes specifiers in the protofile are provided for
698 backwards compatibility, but are otherwise unused.
699 The syntax of the protofile is defined by a number
700 of tokens separated by spaces or newlines. Note that
701 the line numbers are not part of the syntax but are
702 meant to help you in the following discussion of the
703 file contents.
704
705 1 /stand/diskboot
706 2 4872 110
707 3 d--777 3 1
708 4 usr d--777 3 1
709 5 sh ---755 3 1 /bin/sh
710 6 ken d--755 6 1
711 7 $
712 8 b0 b--644 3 1 0 0
713 9 c0 c--644 3 1 0 0
714 10 fifo p--644 3 1
715 11 slink l--644 3 1 /a/symbolic/link
716 12 : This is a comment line
717 13 $
718 14 $
719
720 Line 1 is a dummy string. (It was formerly the
721 bootfilename.) It is present for backward compati‐
722 bility; boot blocks are not used on SGI systems.
723
724 Note that some string of characters must be present
725 as the first line of the proto file to cause it to
726 be parsed correctly; the value of this string is im‐
727 material since it is ignored.
728
729 Line 2 contains two numeric values (formerly the
730 numbers of blocks and inodes). These are also
731 merely for backward compatibility: two numeric val‐
732 ues must appear at this point for the proto file to
733 be correctly parsed, but their values are immaterial
734 since they are ignored.
735
736 The lines 3 through 11 specify the files and direc‐
737 tories you want to include in this filesystem. Line
738 3 defines the root directory. Other directories and
739 files that you want in the filesystem are indicated
740 by lines 4 through 6 and lines 8 through 10. Line 11
741 contains symbolic link syntax.
742
743 Notice the dollar sign ($) syntax on line 7. This
744 syntax directs the mkfs.xfs command to terminate the
745 branch of the filesystem it is currently on and then
746 continue from the directory specified by the next
747 line, in this case line 8. It must be the last
748 character on a line. The colon on line 12 intro‐
749 duces a comment; all characters up until the follow‐
750 ing newline are ignored. Note that this means you
751 cannot have a file in a prototype file whose name
752 contains a colon. The $ on lines 13 and 14 end the
753 process, since no additional specifications follow.
754
755 File specifications provide the following:
756
757 * file mode
758 * user ID
759 * group ID
760 * the file's beginning contents
761
762 A 6-character string defines the mode for a file.
763 The first character of this string defines the file
764 type. The character range for this first character
765 is -bcdpl. A file may be a regular file, a block
766 special file, a character special file, directory
767 files, named pipes (first-in, first out files), and
768 symbolic links. The second character of the mode
769 string is used to specify setuserID mode, in which
770 case it is u. If setuserID mode is not specified,
771 the second character is -. The third character of
772 the mode string is used to specify the setgroupID
773 mode, in which case it is g. If setgroupID mode is
774 not specified, the third character is -. The re‐
775 maining characters of the mode string are a three
776 digit octal number. This octal number defines the
777 owner, group, and other read, write, and execute
778 permissions for the file, respectively. For more
779 information on file permissions, see the chmod(1)
780 command.
781
782 Following the mode character string are two decimal
783 number tokens that specify the user and group IDs of
784 the file's owner.
785
786 In a regular file, the next token specifies the
787 pathname from which the contents and size of the
788 file are copied. In a block or character special
789 file, the next token are two decimal numbers that
790 specify the major and minor device numbers. When a
791 file is a symbolic link, the next token specifies
792 the contents of the link.
793
794 When the file is a directory, the mkfs.xfs command
795 creates the entries dot (.) and dot-dot (..) and
796 then reads the list of names and file specifications
797 in a recursive manner for all of the entries in the
798 directory. A scan of the protofile is always termi‐
799 nated with the dollar ( $ ) token.
800
801 slashes_are_spaces=value
802 If set to 1, slashes ("/") in the first token of
803 each line of the protofile are converted to spaces.
804 This enables the creation of a filesystem containing
805 filenames with spaces. By default, this is set to
806 0.
807
808 -q Quiet option. Normally mkfs.xfs prints the parameters of the
809 filesystem to be constructed; the -q flag suppresses this.
810
811 -r realtime_section_options
812 Section Name: [realtime]
813 These options specify the location, size, and other parameters
814 of the real-time section of the filesystem. The valid real‐
815 time_section_options are:
816
817 rtdev=device
818 This is used to specify the device which should con‐
819 tain the real-time section of the filesystem. The
820 suboption value is the name of a block device.
821
822 extsize=value
823 This is used to specify the size of the blocks in
824 the real-time section of the filesystem. This value
825 must be a multiple of the filesystem block size. The
826 minimum allowed size is the filesystem block size or
827 4 KiB (whichever is larger); the default size is the
828 stripe width for striped volumes or 64 KiB for non-
829 striped volumes; the maximum allowed size is 1 GiB.
830 The real-time extent size should be carefully chosen
831 to match the parameters of the physical media used.
832
833 size=value
834 This is used to specify the size of the real-time
835 section. This suboption is only needed if the real-
836 time section of the filesystem should occupy less
837 space than the size of the partition or logical vol‐
838 ume containing the section.
839
840 noalign
841 This option disables stripe size detection, enforc‐
842 ing a realtime device with no stripe geometry.
843
844 -s sector_size_options
845 Section Name: [sector]
846 This option specifies the fundamental sector size of the
847 filesystem. The valid sector_size_option is:
848
849 size=value
850 The sector size is specified with a value in bytes.
851 The default sector_size is 512 bytes. The minimum
852 value for sector size is 512; the maximum is 32768
853 (32 KiB). The sector_size must be a power of 2 size
854 and cannot be made larger than the filesystem block
855 size.
856
857 -L label
858 Set the filesystem label. XFS filesystem labels can be at most
859 12 characters long; if label is longer than 12 characters,
860 mkfs.xfs will not proceed with creating the filesystem. Refer
861 to the mount(8) and xfs_admin(8) manual entries for additional
862 information.
863
864 -N Causes the file system parameters to be printed out without re‐
865 ally creating the file system.
866
867 -K Do not attempt to discard blocks at mkfs time.
868
869 -V Prints the version number and exits.
870
872 The configuration file uses a basic INI format to specify sections and
873 options within a section. Section and option names are case sensitive.
874 Section names must not contain whitespace. Options are name-value
875 pairs, ended by the first whitespace in the line. Option names cannot
876 contain whitespace. Full line comments can be added by starting a line
877 with a # symbol. If values contain whitespace, then it must be quoted.
878
879 The following example configuration file sets the block size to 4096
880 bytes, turns on reverse mapping btrees and sets the inode size to 2048
881 bytes.
882
883 # Example mkfs.xfs configuration file
884
885 [block]
886 size=4k
887
888 [metadata]
889 rmapbt=1
890
891 [inode]
892 size=2048
893
894
896 xfs(5), mkfs(8), mount(8), xfs_info(8), xfs_admin(8).
897
899 With a prototype file, it is not possible to specify hard links.
900
901
902
903 mkfs.xfs(8)