]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - man/man8/mkfs.xfs.8
Userspace support for lazy superblock counters
[thirdparty/xfsprogs-dev.git] / man / man8 / mkfs.xfs.8
1 .TH mkfs.xfs 8
2 .SH NAME
3 mkfs.xfs \- construct an XFS filesystem
4 .SH SYNOPSIS
5 .nf
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
11 .fi
12 .SH DESCRIPTION
13 .I mkfs.xfs
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.
18 .PP
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
22 SCSI disk, use:
23 .PP
24 .nf
25 mkfs.xfs /dev/sda1
26 .fi
27 .PP
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:
32 .PP
33 .nf
34 mkfs.xfs \-l logdev=/dev/sdb1,size=10000b /dev/sda1
35 .fi
36 .PP
37 Each of the
38 .I subopt=value
39 elements in the argument list above can be given as multiple comma-separated
40 .I subopt=value
41 suboptions if multiple suboptions apply to the same option.
42 Equivalently, each main option can be given multiple times with
43 different suboptions.
44 For example,
45 .B \-l internal,size=10000b
46 and
47 .B \-l internal \-l size=10000b
48 are equivalent.
49 .PP
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).
69 .TP
70 .B \-b
71 Block size options.
72 .IP
73 This option specifies the fundamental block size of the filesystem.
74 The valid suboptions are:
75 .BI log= value
76 and
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
80 .BR log= ,
81 or in bytes with
82 .BR size= .
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.
86 .TP
87 .B \-d
88 Data section options.
89 .IP
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,
102 and
103 \f3unwritten\f1[\f3=\f1\f2value\f1].
104 .IP
105 The
106 .B agcount
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
115 .I agcount
116 allocation groups (default value is scaled automatically based
117 on the underlying device size).
118 Setting
119 .I agcount
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.
122 .IP
123 The
124 .B agsize
125 suboption is an alternative to using
126 .B agcount.
127 The argument provided to
128 .B agsize
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.
134 The
135 .B agcount
136 suboption and the
137 .B agsize
138 suboption are mutually exclusive.
139 .IP
140 The
141 .B name
142 suboption can be used to specify the name of the special file containing
143 the filesystem.
144 In this case, the log section must be specified as
145 .B internal
146 (with a size, see the
147 .B \-l
148 option below) and there can be no real-time section.
149 .IP
150 The
151 .B file
152 suboption is used to specify that the file given by the
153 .B name
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.
159 .IP
160 The
161 .B size
162 suboption is used to specify the size of the data section.
163 This suboption is required if
164 .B \-d file[=1]
165 is given.
166 Otherwise, it is only needed if the filesystem should occupy
167 less space than the size of the special file.
168 .IP
169 The
170 .B sunit
171 suboption is used to specify the stripe unit for a RAID device or a
172 logical volume.
173 The suboption value has to be specified in 512-byte block units.
174 Use the
175 .B su
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
179 than 512KiB.
180 Also inode allocations and the internal log will be stripe unit aligned.
181 .IP
182 The
183 .B su
184 suboption is an alternative to using
185 .B sunit.
186 The
187 .B su
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.
193 .IP
194 The
195 .B swidth
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.
199 Use the
200 .B sw
201 suboption to specify the stripe width size in bytes.
202 This suboption is required if
203 .B \-d sunit
204 has been specified and it has to be a multiple of the
205 .B \-d sunit
206 suboption.
207 .IP
208 The
209 .B sw
210 suboption is an alternative to using
211 .B swidth.
212 The
213 .B sw
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.
219 .IP
220 When a filesystem is created on a logical volume device,
221 .I mkfs.xfs
222 will automatically query the logical volume for appropriate
223 .B sunit
224 and
225 .B swidth
226 values.
227 .IP
228 The
229 .B unwritten
230 suboption is used to specify whether unwritten extents are flagged as such,
231 or not.
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
241 flagging capability.
242 .TP
243 .B \-f
244 Force overwrite when an existing filesystem is detected on the device.
245 By default,
246 .I mkfs.xfs
247 will not write to the device if it suspects that there is a filesystem
248 or partition table on the device already.
249 .TP
250 .B \-i
251 Inode options.
252 .IP
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.
263 .IP
264 The valid suboptions for specifying inode size are:
265 \f3log=\f1\f2value\f1,
266 \f3perblock=\f1\f2value\f1,
267 and
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
271 .BR log= ,
272 in bytes with
273 .BR size= ,
274 or as the number fitting in a filesystem block with
275 .BR perblock= .
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.
279 .IP
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,
287 .I mkfs.xfs
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,
291 .I mkfs.xfs
292 will warn if this will create inode numbers > 32 significant
293 bits.
294 .IP
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.
300 .IP
301 The option
302 .BI align[= value ]
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).
315 .IP
316 The option
317 .BI attr[= value ]
318 is used to specify the version of extended attribute inline allocation
319 policy to be used.
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.
327 .TP
328 .B \-l
329 Log section options.
330 .IP
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.
341 .IP
342 The
343 .B internal
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.
349 .IP
350 The
351 .B logdev
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
355 .B internal=1
356 and
357 .B logdev
358 options are mutually exclusive.
359 .IP
360 The
361 .B size
362 suboption is used to specify the size of the log section.
363 .IP
364 If the log is contained within the data section and
365 .B size
366 isn't specified,
367 .I mkfs.xfs
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.
371 .IP
372 Otherwise, the
373 .B 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.
381 .IP
382 Using the
383 .B version
384 suboption to specify a version 2 log enables the
385 .B sunit
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.
389 .IP
390 The
391 .B sunit
392 suboption specifies the alignment to be used for log writes.
393 The suboption value has to be specified in 512-byte block units.
394 Use the
395 .B su
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
401 block size.
402 The equivalent byte value must be a multiple of the filesystem block
403 size.
404 Version 2 logs are automatically selected if the log \f3su\f1
405 suboption is specified.
406 .IP
407 The
408 .B su
409 suboption is an alternative to using
410 .B sunit.
411 The
412 .B su
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.
419 .IP
420 The
421 .B lazy-count
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.
426 .IP
427 With
428 .BR lazy-count=1 ,
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
435 .B lazy-count=1
436 if you want to make use of this feature.
437 .TP
438 .B \-n
439 Naming options.
440 .IP
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,
446 and
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
454 .BR log= ,
455 or in bytes with
456 .BR size= .
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.
462 .TP
463 \f3\-p\f1 \f2protofile\f1
464 If the optional
465 .B \-p
466 .I protofile
467 argument is given,
468 .I mkfs.xfs
469 uses
470 .I protofile
471 as a prototype file
472 and takes its directions from that file.
473 The blocks and inodes
474 specifiers in the
475 .I protofile
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
481 contents.
482 .nf
483 .sp .8v
484 .in +5
485 \f71 /stand/\f1\f2diskboot\f1\f7
486 2 4872 110
487 3 d\-\-777 3 1
488 4 usr d\-\-777 3 1
489 5 sh \-\-\-755 3 1 /bin/sh
490 6 ken d\-\-755 6 1
491 7 $
492 8 b0 b\-\-644 3 1 0 0
493 9 c0 c\-\-644 3 1 0 0
494 10 fifo p\-\-644 3 1
495 11 slink l\-\-644 3 1 /a/symbolic/link
496 12 : This is a comment line
497 13 $
498 14 $\f1
499 .in -5
500 .fi
501 .IP
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.
506 .IP
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.
510 .IP
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.
515 .IP
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.
523 .IP
524 Notice the dollar sign (
525 .B $
526 ) syntax on line 7. This syntax directs the
527 .I mkfs.xfs
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
533 on a line.
534 The colon
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.
539 The
540 .B $
541 on lines 13 and 14 end the process, since no additional
542 specifications follow.
543 .IP
544 File specifications provide the following:
545 .IP
546 * file mode
547 .br
548 * user ID
549 .br
550 * group ID
551 .br
552 * the file's beginning contents
553 .P
554 .IP
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
559 .B \-bcdpl.
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
563 links.
564 The second character of the mode string is
565 used to specify setuserID mode, in which case
566 it is
567 .BR u .
568 If setuserID mode is not specified, the second character is
569 .BR \- .
570 The third character of the mode string is
571 used to specify the setgroupID mode, in which
572 case it is
573 .BR g .
574 If setgroupID mode is not specified, the second character is
575 .BR \- .
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
581 .IR chmod(1)
582 command.
583 .IP
584 Following the mode character string are two
585 decimal number tokens that specify the user and group IDs
586 of the file's owner.
587 .IP
588 In a regular file, the next token specifies the
589 pathname from which the contents and size of the
590 file are copied.
591 In a block or character special file, the next token
592 are two decimal numbers that specify the major and minor
593 device numbers.
594 When a file is a symbolic link, the next token
595 specifies the contents of the link.
596
597 When the file is a directory, the
598 .I mkfs.xfs
599 command creates the entries
600 .B dot
601 (.) and
602 .B dot-dot
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 (
607 .B $
608 ) token.
609 .TP
610 .B \-q
611 Quiet option.
612 .IP
613 Normally
614 .I mkfs.xfs
615 prints the parameters of the filesystem
616 to be constructed;
617 the
618 .B \-q
619 flag suppresses this.
620 .TP
621 .B \-r
622 Real-time section options.
623 .IP
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,
629 and
630 \f3size=\f1\f2value\f1.
631 .IP
632 The
633 .B rtdev
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.
637 .IP
638 The
639 .B extsize
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
646 non-striped volumes;
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.
650 .IP
651 The
652 .B size
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.
657 .TP
658 .B \-s
659 Sector size options.
660 .IP
661 This option specifies the fundamental sector size of the filesystem.
662 The valid suboptions are:
663 .BI log= value
664 and
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
668 .BR log= ,
669 or in bytes with
670 .BR size= .
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.
675 .TP
676 \f3\-L\f1 \f2label\f1
677 Set the filesystem label.
678 XFS filesystem labels can be at most 12 characters long; if
679 .I label
680 is longer than 12 characters,
681 .I mkfs.xfs
682 will not proceed with creating the filesystem. Refer to the
683 .IR mount (8)
684 and
685 .IR xfs_admin (8)
686 manual entries for additional information.
687 .TP
688 .B \-N
689 Causes the file system parameters to be printed out without really
690 creating the file system.
691 .SH SEE ALSO
692 xfs(5),
693 mkfs(8),
694 mount(8),
695 xfs_info(8),
696 xfs_admin(8).
697 .SH BUGS
698 With a prototype file, it is not possible to specify hard links.