Linux Man Page Viewer
The following form allows you to view linux man pages.
mkfs.xfs [ -b block_size ] [ -d data_section_options ] [ -f ] [ -i
inode_options ] [ -l log_section_options ] [ -n naming_options ] [ -p
protofile ] [ -q ] [ -r realtime_section_options ] [ -s sector_size ] [
-L label ] [ -N ] [ -K ] device
mkfs.xfs constructs an XFS filesystem by writing on a special file
using the values found in the arguments of the command line. It is
invoked automatically by mkfs(8) when it is given the -t xfs option.
In its simplest (and most commonly used form), the size of the filesys-
tem is determined from the disk driver. As an example, to make a
filesystem with an internal log on the first partition on the first
SCSI disk, use:
The metadata log can be placed on another device to reduce the number
of disk seeks. To create a filesystem on the first partition on the
first SCSI disk with a 10000 block log located on the first partition
on the second SCSI disk, use:
mkfs.xfs -l logdev=/dev/sdb1,size=10000b /dev/sda1
Each of the option elements in the argument list above can be given as
multiple comma-separated suboptions if multiple suboptions apply to the
same option. Equivalently, each main option can be given multiple
times with different suboptions. For example, -l internal,size=10000b
and -l internal -l size=10000b are equivalent.
In the descriptions below, sizes are given in sectors, bytes, blocks,
kilobytes, megabytes, gigabytes, etc. Sizes are treated as hexadecimal
if prefixed by 0x or 0X, octal if prefixed by 0, or decimal otherwise.
The following lists possible multiplication suffixes:
s - multiply by sector size (default = 512, see -s option
b - multiply by filesystem block size (default = 4K, see -b
k - multiply by one kilobyte (1,024 bytes).
m - multiply by one megabyte (1,048,576 bytes).
g - multiply by one gigabyte (1,073,741,824 bytes).
t - multiply by one terabyte (1,099,511,627,776 bytes).
p - multiply by one petabyte (1,024 terabytes).
e - multiply by one exabyte (1,048,576 terabytes).
This option specifies the fundamental block size of the filesys-
tem. The valid block_size_options are: log=value or size=value
and only one can be supplied. The block size is specified
either as a base two logarithm value with log=, or in bytes with
more parallelism can be achieved when allocating
blocks and inodes. The minimum allocation group size
is 16 MiB; the maximum size is just under 1 TiB.
The data section of the filesystem is divided into
value allocation groups (default value is scaled
automatically based on the underlying device size).
This is an alternative to using the agcount subop-
tion. The value is the desired size of the alloca-
tion group expressed in bytes (usually using the m
or g suffixes). This value must be a multiple of
the filesystem block size, and must be at least
16MiB, and no more than 1TiB, and may be automati-
cally adjusted to properly align with the stripe
geometry. The agcount and agsize suboptions are
This can be used to specify the name of the special
file containing the filesystem. In this case, the
log section must be specified as internal (with a
size, see the -l option below) and there can be no
This is used to specify that the file given by the
name suboption is a regular file. The value is
either 0 or 1, with 1 signifying that the file is
regular. This suboption is used only to make a
filesystem image. If the value is omitted then 1 is
This is used to specify the size of the data sec-
tion. This suboption is required if -d file[=1] is
given. Otherwise, it is only needed if the filesys-
tem should occupy less space than the size of the
This is used to specify the stripe unit for a RAID
device or a logical volume. The value has to be
specified in 512-byte block units. Use the su subop-
tion to specify the stripe unit size in bytes. This
suboption ensures that data allocations will be
stripe unit aligned when the current end of file is
being extended and the file size is larger than
512KiB. Also inode allocations and the internal log
will be stripe unit aligned.
suboption is an alternative to using swidth. The sw
suboption is used to specify the stripe width for a
RAID device or striped logical volume. The value is
expressed as a multiplier of the stripe unit, usu-
ally the same as the number of stripe members in the
logical volume configuration, or data disks in a
When a filesystem is created on a logical volume
device, mkfs.xfs will automatically query the logi-
cal volume for appropriate sunit and swidth values.
-f Force overwrite when an existing filesystem is detected on the
device. By default, mkfs.xfs will not write to the device if it
suspects that there is a filesystem or partition table on the
This option specifies the inode size of the filesystem, and
other inode allocation parameters. The XFS inode contains a
fixed-size part and a variable-size part. The variable-size
part, whose size is affected by this option, can contain: direc-
tory data, for small directories; attribute data, for small
attribute sets; symbolic link data, for small symbolic links;
the extent list for the file, for files with a small number of
extents; and the root of a tree describing the location of
extents for the file, for files with a large number of extents.
The valid inode_options are:
size=value | log=value | perblock=value
The inode size is specified either as a value in
bytes with size=, a base two logarithm value with
log=, or as the number fitting in a filesystem block
with perblock=. The mininum (and default) value is
256 bytes. The maximum value is 2048 (2 KiB) sub-
ject to the restriction that the inode size cannot
exceed one half of the filesystem block size.
XFS uses 64-bit inode numbers internally; however,
the number of significant bits in an inode number is
affected by filesystem geometry. In practice,
filesystem size and inode size are the predominant
factors. The Linux kernel (on 32 bit hardware plat-
forms) and most applications cannot currently handle
inode numbers greater than 32 significant bits, so
if no inode size is given on the command line,
mkfs.xfs will attempt to choose a size such that
inode numbers will be < 32 bits. If an inode size
lower portion of the filesystem. The data block
allocator will avoid these low blocks to accommodate
the specified maxpct, so a high value may result in
a filesystem with nothing but inodes in a signifi-
cant portion of the lower blocks of the filesystem.
(This restriction is not present when the filesystem
is mounted with the inode64 option on 64-bit plat-
Setting the value to 0 means that essentially all of
the filesystem can become inode blocks, subject to
This value can be modified with xfs_growfs(8).
This is used to specify that inode allocation is or
is not aligned. The value is either 0 or 1, with 1
signifying that inodes are allocated aligned. If
the value is omitted, 1 is assumed. The default is
that inodes are aligned. Aligned inode access is
normally more efficient than unaligned access;
alignment must be established at the time the
filesystem is created, since inodes are allocated at
that time. This option can be used to turn off
inode alignment when the filesystem needs to be
mountable by a version of IRIX that does not have
the inode alignment feature (any release of IRIX
before 6.2, and IRIX 6.2 without XFS patches).
This is used to specify the version of extended
attribute inline allocation policy to be used. By
default, this is 2, which uses an efficient algo-
rithm for managing the available inline inode space
between attribute and extent data.
The previous version 1, which has fixed regions for
attribute and extent data, is kept for backwards
compatibility with kernels older than version
This is used to enable 32bit quota project identi-
fiers. The value is either 0 or 1, with 1 signifying
that 32bit projid are to be enabled. If the value
is omitted, 0 is assumed.
These options specify the location, size, and other parameters
of the log section of the filesystem. The valid log_sec-
This is used to specify the size of the log section.
If the log is contained within the data section and
size isn't specified, mkfs.xfs will try to select a
suitable log size depending on the size of the
filesystem. The actual logsize depends on the
filesystem block size and the directory block size.
Otherwise, the size suboption is only needed if the
log section of the filesystem should occupy less
space than the size of the special file. The value
is specified in bytes or blocks, with a b suffix
meaning multiplication by the filesystem block size,
as described above. The overriding minimum value for
size is 512 blocks. With some combinations of
filesystem block size, inode size, and directory
block size, the minimum log size is larger than 512
This specifies the version of the log. The current
default is 2, which allows for larger log buffer
sizes, as well as supporting stripe-aligned log
writes (see the sunit and su options, below).
The previous version 1, which is limited to 32k log
buffers and does not support stripe-aligned writes,
is kept for backwards compatibility with very old
This specifies the alignment to be used for log
writes. The value has to be specified in 512-byte
block units. Use the su suboption to specify the log
stripe unit size in bytes. Log writes will be
aligned on this boundary, and rounded up to this
boundary. This gives major improvements in perfor-
mance on some configurations such as software RAID5
when the sunit is specified as the filesystem block
size. The equivalent byte value must be a multiple
of the filesystem block size. Version 2 logs are
automatically selected if the log sunit suboption is
The su suboption is an alternative to using sunit.
This is used to specify the log stripe. The value
has to be specified in bytes, (usually using the s
or b suffixes). This value must be a multiple of the
filesystem block size. Version 2 logs are automati-
tent counter values without needed to keep them in
the superblock. This gives significant improvements
in performance on some configurations. The default
value is 1 (on) so you must specify lazy-count=0 if
you want to disable this feature for older kernels
which don't support it.
These options specify the version and size parameters for the
naming (directory) area of the filesystem. The valid nam-
size=value | log=value
The block size is specified either as a value in
bytes with size=, or as a base two logarithm value
with log=. The block size must be a power of 2 and
cannot be less than the filesystem block size. The
default size value for version 2 directories is 4096
bytes (4 KiB), unless the filesystem block size is
larger than 4096, in which case the default value is
the filesystem block size. For version 1 directo-
ries the block size is the same as the filesystem
The naming (directory) version value can be either 2
or 'ci', defaulting to 2 if unspecified. With ver-
sion 2 directories, the directory block size can be
any power of 2 size from the filesystem block size
up to 65536.
The version=ci option enables ASCII only case-insen-
sitive filename lookup and version 2 directories.
Filenames are case-preserving, that is, the names
are stored in directories using the case they were
Note: Version 1 directories are not supported.
If the optional -p protofile argument is given, mkfs.xfs uses
protofile as a prototype file and takes its directions from that
file. The blocks and inodes specifiers in the protofile are
provided for backwards compatibility, but are otherwise unused.
The syntax of the protofile is defined by a number of tokens
separated by spaces or newlines. Note that the line numbers are
not part of the syntax but are meant to help you in the follow-
ing discussion of the file contents.
2 4872 110
3 d--777 3 1
used on SGI systems.
Note that some string of characters must be present as the first
line of the proto file to cause it to be parsed correctly; the
value of this string is immaterial since it is ignored.
Line 2 contains two numeric values (formerly the numbers of
blocks and inodes). These are also merely for backward compati-
bility: two numeric values must appear at this point for the
proto file to be correctly parsed, but their values are immate-
rial since they are ignored.
The lines 3 through 11 specify the files and directories you
want to include in this filesystem. Line 3 defines the root
directory. Other directories and files that you want in the
filesystem are indicated by lines 4 through 6 and lines 8
through 10. Line 11 contains symbolic link syntax.
Notice the dollar sign ($) syntax on line 7. This syntax directs
the mkfs.xfs command to terminate the branch of the filesystem
it is currently on and then continue from the directory speci-
fied by the next line, in this case line 8. It must be the last
character on a line. The colon on line 12 introduces a comment;
all characters up until the following newline are ignored. Note
that this means you cannot have a file in a prototype file whose
name contains a colon. The $ on lines 13 and 14 end the pro-
cess, since no additional specifications follow.
File specifications provide the following:
* file mode
* user ID
* group ID
* the file's beginning contents
A 6-character string defines the mode for a file. The first
character of this string defines the file type. The character
range for this first character is -bcdpl. A file may be a regu-
lar file, a block special file, a character special file, direc-
tory files, named pipes (first-in, first out files), and sym-
bolic links. The second character of the mode string is used to
specify setuserID mode, in which case it is u. If setuserID
mode is not specified, the second character is -. The third
character of the mode string is used to specify the setgroupID
mode, in which case it is g. If setgroupID mode is not speci-
fied, the third character is -. The remaining characters of the
mode string are a three digit octal number. This octal number
defines the owner, group, and other read, write, and execute
permissions for the file, respectively. For more information on
file permissions, see the chmod(1) command.
terminated with the dollar ( $ ) token.
-q Quiet option. Normally mkfs.xfs prints the parameters of the
filesystem to be constructed; the -q flag suppresses this.
These options specify the location, size, and other parameters
of the real-time section of the filesystem. The valid real-
This is used to specify the device which should con-
tain the real-time section of the filesystem. The
suboption value is the name of a block device.
This is used to specify the size of the blocks in
the real-time section of the filesystem. This value
must be a multiple of the filesystem block size. The
minimum allowed size is the filesystem block size or
4 KiB (whichever is larger); the default size is the
stripe width for striped volumes or 64 KiB for non-
striped volumes; the maximum allowed size is 1 GiB.
The real-time extent size should be carefully chosen
to match the parameters of the physical media used.
This is used to specify the size of the real-time
section. This suboption is only needed if the real-
time section of the filesystem should occupy less
space than the size of the partition or logical vol-
ume containing the section.
This option specifies the fundamental sector size of the
filesystem. The sector_size is specified either as a value in
bytes with size=value or as a base two logarithm value with
log=value. The default sector_size is 512 bytes. The minimum
value for sector size is 512; the maximum is 32768 (32 KiB). The
sector_size must be a power of 2 size and cannot be made larger
than the filesystem block size.
Set the filesystem label. XFS filesystem labels can be at most
12 characters long; if label is longer than 12 characters,
mkfs.xfs will not proceed with creating the filesystem. Refer
to the mount(8) and xfs_admin(8) manual entries for additional
-N Causes the file system parameters to be printed out without
really creating the file system.