3 mkfs.xfs \- construct an XFS filesystem
6 \f3mkfs.xfs\f1 [ \f3\-b\f1 subopt=value ] [ \f3\-d\f1 subopt[=value] ]
7 [ \f3\-i\f1 subopt=value ] [ \f3\-l\f1 subopt[=value] ] [ \f3\-f\f1 ]
8 [ \f3\-n\f1 subopt[=value] ] [ \f3\-p\f1 protofile ] [ \f3\-q\f1 ]
9 [ \f3\-r\f1 subopt[=value] ] [ \f3\-s\f1 subopt[=value] ]
10 [ \f3\-N\f1 ] [ \f3\-L\f1 label ] device
14 constructs an XFS filesystem by writing on a special
15 file using the values found in the arguments of the command line.
16 It is invoked automatically by \f2mkfs\f1(8) when \f2mkfs\f1 is
17 given the \f3\-t xfs\f1 option.
19 In its simplest (and most commonly used form), the size of the
20 filesystem is determined from the disk driver. As an example, to make
21 a filesystem with an internal log on the first partition on the first
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 10000 block log located on the first partition
31 on the second SCSI disk, use:
34 mkfs.xfs \-l logdev=/dev/sdb1,size=10000b /dev/sda1
39 elements in the argument list above can be given as multiple comma-separated
41 suboptions if multiple suboptions apply to the same option.
42 Equivalently, each main option can be given multiple times with
45 .B \-l internal,size=10000b
47 .B \-l internal \-l size=10000b
50 In the descriptions below, sizes are given in sectors, bytes, blocks,
51 kilobytes, megabytes, or gigabytes.
52 Sizes are treated as hexadecimal if prefixed by 0x or 0X,
53 octal if prefixed by 0, or decimal otherwise.
54 If suffixed with \f3s\f1 then the size is converted by multiplying it
55 by the filesystems sector size (defaults to 512, see \f3\-s\f1 option below).
56 If suffixed with \f3b\f1 then the size is converted by multiplying it
57 by the filesystems block size (defaults to 4K, see \f3\-b\f1 option below).
58 If suffixed with \f3k\f1 then the size is converted by multiplying it by 1024.
59 If suffixed with \f3m\f1 then the size is converted by multiplying it by
60 one megabyte (1024 * 1024 bytes).
61 If suffixed with \f3g\f1 then the size is converted by multiplying it by
62 one gigabyte (1024 * 1024 * 1024 bytes).
63 If suffixed with \f3t\f1 then the size is converted by multiplying it by
64 one terabyte (1024 * 1024 * 1024 * 1024 bytes).
65 If suffixed with \f3p\f1 then the size is converted by multiplying it by
66 one petabyte (1024 * 1024 * 1024 * 1024 * 1024 bytes).
67 If suffixed with \f3e\f1 then the size is converted by multiplying it by
68 one exabyte (1024 * 1024 * 1024 * 1024 * 1024 * 1024 bytes).
73 This option specifies the fundamental block size of the filesystem.
74 The valid suboptions are:
77 \f3size=\f1\f2value\f1;
78 only one can be supplied.
79 The block size is specified either as a base two logarithm value with
83 The default value is 4096 bytes (4 KiB), the minimum is 512, and the
84 maximum is 65536 (64 KiB).
85 XFS on Linux currently only supports pagesize or smaller blocks.
90 These options specify the location, size, and other parameters of the
91 data section of the filesystem.
92 The valid suboptions are:
93 \f3agcount=\f1\f2value\f1,
94 \f3agsize=\f1\f2value\f1,
95 \f3file\f1[\f3=\f1\f2value\f1],
96 \f3name=\f1\f2value\f1,
97 \f3size=\f1\f2value\f1,
98 \f3sunit=\f1\f2value\f1,
99 \f3swidth=\f1\f2value\f1,
100 \f3su=\f1\f2value\f1,
101 \f3sw=\f1\f2value\f1,
103 \f3unwritten\f1[\f3=\f1\f2value\f1].
107 suboption is used to specify the number of allocation groups.
108 The data section of the filesystem is divided into allocation groups
109 to improve the performance of XFS.
110 More allocation groups imply that more parallelism can be achieved
111 when allocating blocks and inodes.
112 The minimum allocation group size is 16 MiB;
113 the maximum size is just under 1 TiB.
114 The data section of the filesystem is divided into
116 allocation groups (default value is scaled automatically based
117 on the underlying device size).
120 to a very large number should be avoided, since this causes an unreasonable
121 amount of CPU time to be used when the filesystem is close to full.
125 suboption is an alternative to using
127 The argument provided to
129 is the desired size of the allocation group expressed in bytes
130 (usually using the \f3m\f1 or \f3g\f1 suffixes).
131 This value must be a multiple of the filesystem block size, and
132 must be at least 16MiB, and no more than 1TiB, and may
133 be automatically adjusted to properly align with the stripe geometry.
138 suboption are mutually exclusive.
142 suboption can be used to specify the name of the special file containing
144 In this case, the log section must be specified as
146 (with a size, see the
148 option below) and there can be no real-time section.
152 suboption is used to specify that the file given by the
154 suboption is a regular file.
155 The suboption value is either 0 or 1,
156 with 1 signifying that the file is regular.
157 This suboption is used only to make a filesystem image.
158 If the value is omitted then 1 is assumed.
162 suboption is used to specify the size of the data section.
163 This suboption is required if
166 Otherwise, it is only needed if the filesystem should occupy
167 less space than the size of the special file.
171 suboption is used to specify the stripe unit for a RAID device or a
173 The suboption value has to be specified in 512-byte block units.
176 suboption to specify the stripe unit size in bytes.
177 This suboption ensures that data allocations will be stripe unit aligned
178 when the current end of file is being extended and the file size is larger
180 Also inode allocations and the internal log will be stripe unit aligned.
184 suboption is an alternative to using
188 suboption is used to specify the stripe unit for a RAID device or a
189 striped logical volume.
190 The suboption value has to be specified in bytes,
191 (usually using the \f3m\f1 or \f3g\f1 suffixes).
192 This value must be a multiple of the filesystem block size.
196 suboption is used to specify the stripe width for a RAID device or a
197 striped logical volume.
198 The suboption value has to be specified in 512-byte block units.
201 suboption to specify the stripe width size in bytes.
202 This suboption is required if
204 has been specified and it has to be a multiple of the
210 suboption is an alternative to using
214 suboption is used to specify the stripe width for a RAID device or
215 striped logical volume.
216 The suboption value is expressed as a multiplier of the stripe unit,
217 usually the same as the number of stripe members in the logical
218 volume configuration, or data disks in a RAID device.
220 When a filesystem is created on a logical volume device,
222 will automatically query the logical volume for appropriate
230 suboption is used to specify whether unwritten extents are flagged as such,
232 The suboption value is either 0 or 1, with 1 signifying that unwritten
233 extent flagging should occur.
234 If the suboption is omitted, unwritten extent flagging is enabled.
235 If unwritten extents are flagged, filesystem write performance
236 will be negatively affected for preallocated file extents, since
237 extra filesystem transactions are required to convert extent flags
238 for the range of the file written.
239 This suboption should be disabled if the filesystem
240 needs to be used on operating system versions which do not support the
244 Force overwrite when an existing filesystem is detected on the device.
247 will not write to the device if it suspects that there is a filesystem
248 or partition table on the device already.
253 This option specifies the inode size of the filesystem, and other
254 inode allocation parameters.
255 The XFS inode contains a fixed-size part and a variable-size part.
256 The variable-size part, whose size is affected by this option, can contain:
257 directory data, for small directories;
258 attribute data, for small attribute sets;
259 symbolic link data, for small symbolic links;
260 the extent list for the file, for files with a small number of extents;
261 and the root of a tree describing the location of extents for the file,
262 for files with a large number of extents.
264 The valid suboptions for specifying inode size are:
265 \f3log=\f1\f2value\f1,
266 \f3perblock=\f1\f2value\f1,
268 \f3size=\f1\f2value\f1;
269 only one can be supplied.
270 The inode size is specified either as a base two logarithm value with
274 or as the number fitting in a filesystem block with
276 The mininum (and default) value is 256 bytes.
277 The maximum value is 2048 (2 KiB) subject to the restriction that
278 the inode size cannot exceed one half of the filesystem block size.
280 XFS uses 64-bit inode numbers internally; however, the number of
281 significant bits in an inode number
282 is affected by filesystem geometry. In
283 practice, filesystem size and inode size are the predominant factors.
284 The Linux kernel (on 32 bit hardware platforms) and most applications
285 cannot currently handle inode numbers greater than 32 significant bits,
286 so if no inode size is given on the command line,
288 will attempt to choose a size
289 such that inode numbers will be < 32 bits. If an inode size
290 is specified, or if a filesystem is sufficently large,
292 will warn if this will create inode numbers > 32 significant
295 The option \f3maxpct=\f1\f2value\f1 specifies the maximum percentage
296 of space in the filesystem that can be allocated to inodes.
297 The default value is 25%.
298 Setting the value to 0 means that
299 essentially all of the filesystem can become inode blocks.
303 is used to specify that inode allocation is or is not aligned.
304 The value is either 0 or 1,
305 with 1 signifying that inodes are allocated aligned.
306 If the value is omitted, 1 is assumed.
307 The default is that inodes are aligned.
308 Aligned inode access is normally more efficient than unaligned access;
309 alignment must be established at the time the filesystem is created,
310 since inodes are allocated at that time.
311 This option can be used to turn off inode alignment when the
312 filesystem needs to be mountable by a version of IRIX
313 that does not have the inode alignment feature
314 (any release of IRIX before 6.2, and IRIX 6.2 without XFS patches).
318 is used to specify the version of extended attribute inline allocation
320 By default, this is zero. Once extended attributes are used for the
321 first time, the version will be set to either one or two.
322 The current version (two) uses a more efficient algorithm for managing
323 the available inline inode space than version one does, however, for
324 backward compatibility reasons (and in the absence of the \f3attr\f1=\f22\f1
325 mkfs option, or the \f2attr2\f1 mount option), version one will be selected
326 by default when attributes are first used on a filesystem.
331 These options specify the location, size, and other parameters of the
332 log section of the filesystem.
333 The valid suboptions are:
334 .BI internal[= value ],
335 \f3logdev=\f1\f2device\f1,
336 \f3size=\f1\f2value\f1,
337 \f3version=\f1\f2[1|2]\f1,
338 \f3sunit=\f1\f2value\f1,
339 \f3su=\f1\f2value\f1 and
340 \f3lazy-count=\f1\f2[0|1]\f1.
344 suboption is used to specify that the log section is a piece of
345 the data section instead of being another device or logical volume.
346 The suboption value is either 0 or 1,
347 with 1 signifying that the log is internal.
348 If the value is omitted, 1 is assumed.
352 suboption is used to specify that the log section should reside on a
353 device separate from the data section. The suboption value is the
354 name of a block device. The
358 options are mutually exclusive.
362 suboption is used to specify the size of the log section.
364 If the log is contained within the data section and
368 will try to select a suitable log size depending
369 on the size of the filesystem. The actual logsize depends on the
370 filesystem block size and the directory block size.
374 suboption is only needed if the log section of the filesystem
375 should occupy less space than the size of the special file.
376 The size is specified in bytes or blocks, with a \f3b\f1 suffix
377 meaning multiplication by the filesystem block size, as described above.
378 The overriding minimum value for size is 512 blocks.
379 With some combinations of filesystem block size, inode size,
380 and directory block size, the minimum log size is larger than 512 blocks.
384 suboption to specify a version 2 log enables the
386 suboption, and allows the logbsize to be increased beyond 32K.
387 Version 2 logs are automatically selected if a log stripe unit
388 is specified. See \f3sunit\f1 and \f3su\f1 suboptions, below.
392 suboption specifies the alignment to be used for log writes.
393 The suboption value has to be specified in 512-byte block units.
396 suboption to specify the log stripe unit size in bytes.
397 Log writes will be aligned on this boundary,
398 and rounded up to this boundary.
399 This gives major improvements in performance on some configurations
400 such as software raid5 when the sunit is specified as the filesystem
402 The equivalent byte value must be a multiple of the filesystem block
404 Version 2 logs are automatically selected if the log \f3su\f1
405 suboption is specified.
409 suboption is an alternative to using
413 suboption is used to specify the log stripe.
414 The suboption value has to be specified in bytes,
415 (usually using the \f3s\f1 or \f3b\f1 suffixes).
416 This value must be a multiple of the filesystem block size.
417 Version 2 logs are automatically selected if the log \f3su\f1
418 suboption is specified.
422 suboption changes the method of logging various persistent counters
423 in the superblock. Under metadata intensive workloads, these
424 counters are updated and logged frequently enough that the
425 superblock updates become a serialisation point in the filesystem.
429 the superblock is not modified or logged on every change of the
430 persistent counters. Instead, enough information is kept in
431 other parts of the filesystem to be able to maintain the persistent
432 counter values without needed to keep them in the superblock.
433 This gives significant improvements in performance on some configurations.
434 The default value is 0 (off) so you must specify
436 if you want to make use of this feature.
441 These options specify the version and size parameters for the naming
442 (directory) area of the filesystem.
443 The valid suboptions are:
444 \f3log=\f1\f2value\f1,
445 \f3size=\f1\f2value\f1,
447 \f3version=\f1\f2value\f1.
448 The naming (directory) version is 1 or 2,
449 defaulting to 2 if unspecified.
450 With version 2 directories,
451 the directory block size can be any power of 2 size
452 from the filesystem block size up to 65536.
453 The block size is specified either as a base two logarithm value with
457 The default size value for version 2 directories is 4096 bytes (4 KiB),
458 unless the filesystem block size is larger than 4096,
459 in which case the default value is the filesystem block size.
460 For version 1 directories the block size is the same as the
461 filesystem block size.
463 \f3\-p\f1 \f2protofile\f1
472 and takes its directions from that file.
473 The blocks and inodes
476 are provided for backwards compatibility, but are otherwise unused.
477 The syntax of the protofile is defined by a number of tokens separated by spaces
478 or newlines. Note that the line numbers are not part of the syntax but
479 are meant to help you in the
480 following discussion of the file
485 \f71 /stand/\f1\f2diskboot\f1\f7
489 5 sh \-\-\-755 3 1 /bin/sh
492 8 b0 b\-\-644 3 1 0 0
493 9 c0 c\-\-644 3 1 0 0
495 11 slink l\-\-644 3 1 /a/symbolic/link
496 12 : This is a comment line
502 Line 1 is a dummy string.
503 (It was formerly the bootfilename.)
504 It is present for backward
505 compatibility; boot blocks are not used on SGI systems.
507 Note that some string of characters must be present as the first line of
508 the proto file to cause it to be parsed correctly; the value
509 of this string is immaterial since it is ignored.
511 Line 2 contains two numeric values (formerly the numbers of blocks and inodes).
512 These are also merely for backward compatibility: two numeric values must
513 appear at this point for the proto file to be correctly parsed,
514 but their values are immaterial since they are ignored.
516 The lines 3 through 11 specify the files and directories you want to
517 include in this filesystem. Line 3 defines the
518 root directory. Other directories and
519 files that you want in the filesystem
520 are indicated by lines 4 through 6 and
521 lines 8 through 10. Line 11 contains
522 symbolic link syntax.
524 Notice the dollar sign (
526 ) syntax on line 7. This syntax directs the
528 command to terminate the branch of the filesystem it
529 is currently on and then continue
530 from the directory specified by
531 the next line,in this case line 8
532 It must be the last character
535 on line 12 introduces a comment; all characters up until the
536 following newline are ignored.
537 Note that this means you cannot
538 have a file in a prototype file whose name contains a colon.
541 on lines 13 and 14 end the process, since no additional
542 specifications follow.
544 File specifications provide the following:
552 * the file's beginning contents
555 A 6-character string defines the mode for
556 a file. The first character of this string
557 defines the file type. The character range
558 for this first character is
560 A file may be a regular file, a block special file,
561 a character special file, directory files, named
562 pipes (first-in, first out files), and symbolic
564 The second character of the mode string is
565 used to specify setuserID mode, in which case
568 If setuserID mode is not specified, the second character is
570 The third character of the mode string is
571 used to specify the setgroupID mode, in which
574 If setgroupID mode is not specified, the second character is
576 The remaining characters of the mode string are
577 a three digit octal number. This octal number
578 defines the owner, group, and other read, write,
579 and execute permissions for the file, respectively.
580 Form more information on file permissions, see the
584 Following the mode character string are two
585 decimal number tokens that specify the user and group IDs
588 In a regular file, the next token specifies the
589 pathname from which the contents and size of the
591 In a block or character special file, the next token
592 are two decimal numbers that specify the major and minor
594 When a file is a symbolic link, the next token
595 specifies the contents of the link.
597 When the file is a directory, the
599 command creates the entries
603 (..) and then reads the list of names and file specifications
604 in a recursive manner for all of the entries
605 in the directory. A scan of the protofile is
606 always terminated with the dollar (
615 prints the parameters of the filesystem
619 flag suppresses this.
622 Real-time section options.
624 These options specify the location, size, and other parameters of the
625 real-time section of the filesystem.
626 The valid suboptions are:
627 \f3rtdev=\f1\f2device\f1,
628 \f3extsize=\f1\f2value\f1,
630 \f3size=\f1\f2value\f1.
634 suboption is used to specify the device which should contain
635 the real-time section of the filesystem.
636 The suboption value is the name of a block device.
640 suboption is used to specify the size of the blocks in the real-time
641 section of the filesystem.
642 This size must be a multiple of the filesystem block size.
643 The minimum allowed value is the filesystem block size
644 or 4 KiB (whichever is larger);
645 the default value is the stripe width for striped volumes or 64 KiB for
647 the maximum allowed value is 1 GiB.
648 The real-time extent size should be carefully chosen to match the
649 parameters of the physical media used.
653 suboption is used to specify the size of the real-time section.
654 This suboption is only needed if the real-time section of the
655 filesystem should occupy less space than the size of the partition
656 or logical volume containing the section.
661 This option specifies the fundamental sector size of the filesystem.
662 The valid suboptions are:
665 \f3size=\f1\f2value\f1;
666 only one can be supplied.
667 The sector size is specified either as a base two logarithm value with
671 The default value is 512 bytes.
672 The minimum value for sector size is 512; the maximum is 32768 (32 KiB).
673 The sector size must be a power of 2 size and cannot be made larger
674 than the filesystem block size.
676 \f3\-L\f1 \f2label\f1
677 Set the filesystem label.
678 XFS filesystem labels can be at most 12 characters long; if
680 is longer than 12 characters,
682 will not proceed with creating the filesystem. Refer to the
686 manual entries for additional information.
689 Causes the file system parameters to be printed out without really
690 creating the file system.
698 With a prototype file, it is not possible to specify hard links.