mkfs.xfs(8) System Manager's Manual mkfs.xfs(8)
NAME
mkfs.xfs - construct an XFS filesystem
SYNOPSIS
mkfs.xfs [ -b block_size_options ] [ -c config_file_options ] [ -m
global_metadata_options ] [ -d data_section_options ] [ -f ] [ -i in-
ode_options ] [ -l log_section_options ] [ -n naming_options ] [ -p
protofile_options ] [ -q ] [ -r realtime_section_options ] [ -s sec-
tor_size_options ] [ -L label ] [ -N ] [ -K ] device
mkfs.xfs -V
DESCRIPTION
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:
mkfs.xfs /dev/sda1
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 100MiB log located on the first partition on the second
SCSI disk, use:
mkfs.xfs -l logdev=/dev/sdb1,size=100m /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=100m and -l
internal -l size=100m 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 below).
b - multiply by filesystem block size (default = 4K, see -b op-
tion below).
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).
When specifying parameters in units of sectors or filesystem blocks, the
-s option or the -b option may be used to specify the size of the sector
or block. If the size of the block or sector is not specified, the de-
fault sizes (block: 4KiB, sector: 512B) will be used.
Many feature options allow an optional argument of 0 or 1, to explicitly
disable or enable the functionality.
The correctness of the crc32c checksum implementation will be tested be-
fore formatting the filesystem. If the test fails, the format will
abort.
OPTIONS
Options may be specified either on the command line or in a configura-
tion file. Not all command line options can be specified in configura-
tion files; only the command line options followed by a [section] label
can be used in a configuration file.
Options that can be used in configuration files are grouped into related
sections containing multiple options. The command line options and con-
figuration files use the same option sections and grouping. Configura-
tion file section names are listed in the command line option sections
below. Option names and values are the same for both command line and
configuration file specification.
Options specified are the combined set of command line parameters and
configuration file parameters. Duplicated options will result in a re-
specification error, regardless of the location they were specified at.
-c configuration_file_option
This option specifies the files that mkfs configuration will be
obtained from. The valid configuration_file_option is:
options=name
The configuration options will be sourced from the
file specified by the name option string. This op-
tion can be use either an absolute or relative path
to the configuration file to be read. Sample config-
uration files can be found in /usr/share/xf-
sprogs/mkfs.
-b block_size_options
Section Name: [block]
This option specifies the fundamental block size of the filesys-
tem. The valid block_size_option is:
size=value
The filesystem block size is specified with a value
in bytes. The default value is 4096 bytes (4 KiB),
the minimum is 512, and the maximum is 65536 (64
KiB).
Although mkfs.xfs will accept any of these values and
create a valid filesystem, XFS on Linux can only
mount filesystems with pagesize or smaller blocks.
-m global_metadata_options
Section Name: [metadata]
These options specify metadata format options that either apply
to the entire filesystem or aren't easily characterised by a spe-
cific functionality group. The valid global_metadata_options are:
bigtime=value
This option enables filesystems that can handle inode
timestamps from December 1901 to July 2486, and quota
timer expirations from January 1970 to July 2486.
The value is either 0 to disable the feature, or 1 to
enable large timestamps.
If this feature is not enabled, the filesystem can
only handle timestamps from December 1901 to January
2038, and quota timers from January 1970 to February
2106.
By default, mkfs.xfs will enable this feature. If
the option -m crc=0 is used, the large timestamp fea-
ture is not supported and is disabled.
crc=value
This is used to create a filesystem which maintains
and checks CRC information in all metadata objects on
disk. The value is either 0 to disable the feature,
or 1 to enable the use of CRCs.
CRCs enable enhanced error detection due to hardware
issues, whilst the format changes also improves crash
recovery algorithms and the ability of various tools
to validate and repair metadata corruptions when they
are found. The CRC algorithm used is CRC32c, so the
overhead is dependent on CPU architecture as some
CPUs have hardware acceleration of this algorithm.
Typically the overhead of calculating and checking
the CRCs is not noticeable in normal operation.
By default, mkfs.xfs will enable metadata CRCs.
Formatting a filesystem without CRCs selects the V4
format, which is deprecated and will be removed from
upstream in September 2030. Distributors may choose
to withdraw support for the V4 format earlier than
this date. Several other options, noted below, are
only tunable on V4 formats, and will be removed along
with the V4 format itself.
finobt=value
This option enables the use of a separate free inode
btree index in each allocation group. The value is
either 0 to disable the feature, or 1 to create a
free inode btree in each allocation group.
The free inode btree mirrors the existing allocated
inode btree index which indexes both used and free
inodes. The free inode btree does not index used in-
odes, allowing faster, more consistent inode alloca-
tion performance as filesystems age.
By default, mkfs.xfs will create free inode btrees
for filesystems created with the (default) -m crc=1
option set. When the option -m crc=0 is used, the
free inode btree feature is not supported and is dis-
abled.
inobtcount=value
This option causes the filesystem to record the num-
ber of blocks used by the inode btree and the free
inode btree. This can be used to reduce mount times
when the free inode btree is enabled.
By default, mkfs.xfs will enable this option. This
feature is only available for filesystems created
with the (default) -m finobt=1 option set. When the
option -m finobt=0 is used, the inode btree counter
feature is not supported and is disabled.
metadir=value
This option creates an internal directory tree to
store filesystem metadata.
By default, mkfs.xfs will not enable this feature.
If the option -m crc=0 is used, the metadata direc-
tory feature is not supported and is disabled.
uuid=value
Use the given value as the filesystem UUID for the
newly created filesystem. The default is to generate
a random UUID.
rmapbt=value
This option enables the creation of a reverse-mapping
btree index in each allocation group. The value is
either 0 to disable the feature, or 1 to create the
btree.
The reverse mapping btree maps filesystem blocks to
the owner of the filesystem block. Most of the map-
pings will be to an inode number and an offset,
though there will also be mappings to filesystem
metadata. This secondary metadata can be used to
validate the primary metadata or to pinpoint exactly
which data has been lost when a disk error occurs.
By default, mkfs.xfs will create reverse mapping
btrees when possible. This feature is only available
for filesystems created with the (default) -m crc=1
option set. When the option -m crc=0 is used, the re-
verse mapping btree feature is not supported and is
disabled.
reflink=value
This option enables the use of a separate reference
count btree index in each allocation group. The value
is either 0 to disable the feature, or 1 to create a
reference count btree in each allocation group.
The reference count btree enables the sharing of
physical extents between the data forks of different
files, which is commonly known as "reflink". Unlike
traditional Unix filesystems which assume that every
inode and logical block pair map to a unique physical
block, a reflink-capable XFS filesystem removes the
uniqueness requirement, allowing up to four billion
arbitrary inode/logical block pairs to map to a phys-
ical block. If a program tries to write to a multi-
ply-referenced block in a file, the write will be
redirected to a new block, and that file's logical-
to-physical mapping will be changed to the new block
("copy on write"). This feature enables the creation
of per-file snapshots and deduplication. It is only
available for the data forks of regular files.
By default, mkfs.xfs will create reference count
btrees and therefore will enable the reflink feature.
This feature is only available for filesystems cre-
ated with the (default) -m crc=1 option set. When the
option -m crc=0 is used, the reference count btree
feature is not supported and reflink is disabled.
autofsck=value
Set the autofsck filesystem property to this value.
See the xfs_scrub(8) manual page for more information
on this property.
uquota If the metadata directory feature is enabled, the -m
uquota option will set up user quota accounting and
enforcement at format time; specifying the quota op-
tions in fstab is no longer unnecessary. If metadata
directories are not enabled, quotas must still be en-
abled via fstab.
gquota If the metadata directory feature is enabled, the -m
gquota option will set up group quota accounting and
enforcement at format time; specifying the quota op-
tions in fstab is no longer unnecessary. If metadata
directories are not enabled, quotas must still be en-
abled via fstab.
pquota If the metadata directory feature is enabled, the -m
pquota option will set up project quota accounting
and enforcement at format time; specifying the quota
options in fstab is no longer unnecessary. If meta-
data directories are not enabled, quotas must still
be enabled via fstab.
uqnoenforce
If the metadata directory feature is enabled, the -m
uqnoenforce option will set up user quota accounting
at format time; specifying the quota options in fstab
is no longer unnecessary. If metadata directories
are not enabled, quotas must still be enabled via
fstab.
gqnoenforce
If the metadata directory feature is enabled, the -m
gqnoenforce option will set up group quota accounting
at format time; specifying the quota options in fstab
is no longer unnecessary. If metadata directories
are not enabled, quotas must still be enabled via
fstab.
pqnoenforce
If the metadata directory feature is enabled, the -m
pqnoenforce option will set up project quota account-
ing at format time; specifying the quota options in
fstab is no longer unnecessary. If metadata directo-
ries are not enabled, quotas must still be enabled
via fstab.
-d data_section_options
Section Name: [data]
These options specify the location, size, and other parameters of
the data section of the filesystem. The valid data_section_op-
tions are:
agcount=value
This is used to specify the number of allocation
groups. The data section of the filesystem is divided
into allocation groups to improve the performance of
XFS. More allocation groups imply that more paral-
lelism can be achieved when allocating blocks and in-
odes. The minimum allocation group size is 16 MiB;
the maximum size is just under 1 TiB. The data sec-
tion of the filesystem is divided into value alloca-
tion groups (default value is scaled automatically
based on the underlying device size).
agsize=value
This is an alternative to using the agcount subop-
tion. The value is the desired size of the allocation
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 automatically ad-
justed to properly align with the stripe geometry.
The agcount and agsize suboptions are mutually exclu-
sive.
cowextsize=value
Set the copy-on-write extent size hint on all inodes
created by mkfs.xfs. The value must be provided in
units of filesystem blocks. If the value is zero,
the default value (currently 32 blocks) will be used.
Directories will pass on this hint to newly created
regular files and directories.
name=value
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 real-
time section.
file[=value]
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 im-
age. If the value is omitted then 1 is assumed.
size=value
This is used to specify the size of the data section.
This suboption is required if -d file[=1] is given.
Otherwise, it is only needed if the filesystem should
occupy less space than the size of the special file.
The data section must be at least 300MB in size.
sunit=value
This is used to specify the stripe unit for a RAID
device or a logical volume. The value has to be spec-
ified in 512-byte block units. Use the su suboption
to specify the stripe unit size in bytes. This subop-
tion 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.
su=value
This is an alternative to using sunit. The su subop-
tion is used to specify the stripe unit for a RAID
device or a striped logical volume. The value has to
be specified in bytes, (usually using the m or g suf-
fixes). This value must be a multiple of the filesys-
tem block size.
swidth=value
This is used to specify the stripe width for a RAID
device or a striped logical volume. The value has to
be specified in 512-byte block units. Use the sw sub-
option to specify the stripe width size in bytes.
This suboption is required if -d sunit has been spec-
ified and it has to be a multiple of the -d sunit
suboption.
sw=value
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, usually
the same as the number of stripe members in the logi-
cal volume configuration, or data disks in a RAID de-
vice.
When a filesystem is created on a block device,
mkfs.xfs will automatically query the block device
for appropriate sunit and swidth values if the block
device and the filesystem size would be larger than
1GB.
noalign
This option disables automatic geometry detection and
creates the filesystem without stripe geometry align-
ment even if the underlying storage device provides
this information.
rtinherit=value
If value is set to 1, all inodes created by mkfs.xfs
will be created with the realtime flag set. The de-
fault is 0. Directories will pass on this flag to
newly created regular files and directories.
projinherit=value
All inodes created by mkfs.xfs will be assigned the
project quota id provided in value. Directories will
pass on the project id to newly created regular files
and directories.
extszinherit=value
All inodes created by mkfs.xfs will have this value
extent size hint applied. The value must be provided
in units of filesystem blocks. Directories will pass
on this hint to newly created regular files and di-
rectories.
daxinherit=value
If value is set to 1, all inodes created by mkfs.xfs
will be created with the DAX flag set. The default
is 0. Directories will pass on this flag to newly
created regular files and directories. By default,
mkfs.xfs will not enable DAX mode.
concurrency=value
Create enough allocation groups to handle the desired
level of concurrency. The goal of this calculation
scheme is to set the number of allocation groups to
an integer multiple of the number of writer threads
desired, to minimize contention of AG locks. This
scheme will neither create fewer AGs than would be
created by the default configuration, nor will it
create AGs smaller than 4GB. This option is not com-
patible with the agcount or agsize options. The
magic value nr_cpus or 1 or no value at all will set
this parameter to the number of active processors in
the system. If the kernel advertises that the data
device is a non-mechanical storage device, mkfs.xfs
will use this new geometry calculation scheme. The
magic value of 0 forces use of the older AG geometry
calculations that is used for mechanical storage.
-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 de-
vice already.
-i inode_options
Section Name: [inode]
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: directory data, for
small directories; attribute data, for small attribute sets; sym-
bolic 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 | perblock=value
The inode size is specified either as a value in
bytes with size= or as the number fitting in a
filesystem block with perblock=. The minimum (and
default) value is 256 bytes without crc, 512 bytes
with crc enabled. The maximum value is 2048 (2 KiB)
subject 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 is specified, or
if a filesystem is sufficiently large, mkfs.xfs will
warn if this will create inode numbers > 32 signifi-
cant bits.
maxpct=value
This specifies the maximum percentage of space in the
filesystem that can be allocated to inodes. The de-
fault value is 25% for filesystems under 1TB, 5% for
filesystems under 50TB and 1% for filesystems over
50TB.
Setting the value to 0 means that essentially all of
the filesystem can become inode blocks (subject to
possible inode32 mount option restrictions, see
xfs(5) for details.)
This value can be modified with xfs_growfs(8).
align[=value]
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 option is only tunable on the deprecated V4 for-
mat.
attr=value
This is used to specify the version of extended at-
tribute inline allocation policy to be used. By de-
fault, this is 2, which uses an efficient algorithm
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 com-
patibility with kernels older than version 2.6.16.
This option is only tunable on the deprecated V4 for-
mat.
projid32bit[=value]
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, 1 is assumed. (This default changed in re-
lease version 3.2.0.)
This option is only tunable on the deprecated V4 for-
mat.
sparse[=value]
Enable sparse inode chunk allocation. The value is
either 0 or 1, with 1 signifying that sparse alloca-
tion is enabled. If the value is omitted, 1 is as-
sumed. Sparse inode allocation is enabled by default.
This feature is only available for filesystems for-
matted with -m crc=1.
When enabled, sparse inode allocation allows the
filesystem to allocate smaller than the standard
64-inode chunk when free space is severely limited.
This feature is useful for filesystems that might
fragment free space over time such that no free ex-
tents are large enough to accommodate a chunk of 64
inodes. Without this feature enabled, inode alloca-
tions can fail with out of space errors under severe
fragmented free space conditions.
nrext64[=value]
Extend maximum values of inode data and attr fork ex-
tent counters from 2^31 - 1 and 2^15 - 1 to 2^48 - 1
and 2^32 - 1 respectively. If the value is omitted,
1 is assumed. This feature will be enabled when pos-
sible. This feature is only available for filesys-
tems formatted with -m crc=1.
exchange[=value]
When enabled, application programs can exchange file
contents atomically via the XFS_IOC_EXCHANGE_RANGE
ioctl. Online repair uses this functionality to re-
build extended attributes, directories, symbolic
links, and realtime metadata files. This feature is
disabled by default. This feature is only available
for filesystems formatted with -m crc=1.
-l log_section_options
Section Name: [log]
These options specify the location, size, and other parameters of
the log section of the filesystem. The valid log_section_options
are:
agnum=value
If the log is internal, allocate it in this AG.
internal[=value]
This is used to specify that the log section is a
piece of the data section instead of being another
device or logical volume. The value is either 0 or 1,
with 1 signifying that the log is internal. If the
value is omitted, 1 is assumed.
logdev=device
This is used to specify that the log section should
reside on the device separate from the data section.
The internal=1 and logdev options are mutually exclu-
sive.
size=value
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 de-
scribed 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 blocks.
The log must be at least 64MB in size. The log can-
not be more than 2GB in size.
version=value
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 2.4
kernels.
This option is only tunable on the deprecated V4 for-
mat.
sunit=value
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 au-
tomatically selected if the log sunit suboption is
specified.
The su suboption is an alternative to using sunit.
su=value
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-
cally selected if the log su suboption is specified.
lazy-count=value
This changes the method of logging various persistent
counters in the superblock. Under metadata intensive
workloads, these counters are updated and logged fre-
quently enough that the superblock updates become a
serialization point in the filesystem. The value can
be either 0 or 1.
With lazy-count=1, the superblock is not modified or
logged on every change of the persistent counters.
Instead, enough information is kept in other parts of
the filesystem to be able to maintain the persistent
counter values without needed to keep them in the su-
perblock. 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.
This option is only tunable on the deprecated V4 for-
mat.
concurrency=value
Allocate a log that is estimated to be large enough
to handle the desired level of concurrency without
userspace program threads contending for log space.
This scheme will neither create a log smaller than
the minimum required, nor create a log larger than
the maximum possible. This option is only valid for
internal logs and is not compatible with the size op-
tion. This option is not compatible with the logdev
or size options. The magic value nr_cpus or 1 or no
value at all will set this parameter to the number of
active processors in the system.
-n naming_options
Section Name: [naming]
These options specify the version and size parameters for the
naming (directory) area of the filesystem. The valid naming_op-
tions are:
size=value
The directory block size is specified with a value in
bytes. The block size must be a power of 2 and can-
not be less than the filesystem block size. The de-
fault 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 directories
the block size is the same as the filesystem block
size.
version=value
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.
If the version=ci option is specified, the kernel
will transform certain bytes in filenames before per-
forming lookup-related operations. The byte sequence
given to create a directory entry is persisted with-
out alterations. The lookup transformations are de-
fined as follows:
0x41-0x5a -> 0x61-0x7a
0xc0-0xd6 -> 0xe0-0xf6
0xd8-0xde -> 0xf8-0xfe
This transformation roughly corresponds to case in-
sensitivity in ISO 8859-1. The transformations are
not compatible with other encodings (e.g. UTF8). Do
not enable this feature unless your entire environ-
ment has been coerced to ISO 8859-1. This feature is
deprecated and will be removed in September 2030.
Note: Version 1 directories are not supported.
ftype=value
This feature allows the inode type to be stored in
the directory structure so that the readdir(3) and
getdents(2) do not need to look up the inode to de-
termine the inode type.
The value is either 0 or 1, with 1 signifying that
filetype information will be stored in the directory
structure. The default value is 1.
When CRCs are enabled (the default), the ftype func-
tionality is always enabled, and cannot be turned
off.
In other words, this option is only tunable on the
deprecated V4 format.
parent=value
This feature creates back references from child files
to parent directories so that online repair can re-
construct broken directory files. The value is ei-
ther 0 to disable the feature, or 1 to create parent
pointers.
By default, mkfs.xfs will not create parent pointers.
This feature is only available for filesystems cre-
ated with the (default) -m crc=1 option set.
-p protofile_options
Section Name: [proto]
These options specify the protofile parameters for populating the
filesystem. The valid protofile_options are:
[file=]protofile
The file= prefix is not required for this CLI argu-
ment for legacy reasons. If specified as a config
file directive, the prefix is required.
If the optional protofile argument is given, mkfs.xfs
uses protofile as a prototype file and takes its di-
rections from that file. The blocks and inodes spec-
ifiers 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 following discussion of the file con-
tents.
1 /stand/diskboot
2 4872 110
3 d--777 3 1
4 usr d--777 3 1
5 sh ---755 3 1 /bin/sh
6 ken d--755 6 1
7 $
8 b0 b--644 3 1 0 0
9 c0 c--644 3 1 0 0
10 fifo p--644 3 1
11 slink l--644 3 1 /a/symbolic/link
12 : This is a comment line
13 $
14 $
Line 1 is a dummy string. (It was formerly the boot-
filename.) It is present for backward compatibility;
boot blocks are not 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 immate-
rial since it is ignored.
Line 2 contains two numeric values (formerly the num-
bers of blocks and inodes). These are also merely
for backward compatibility: two numeric values must
appear at this point for the proto file to be cor-
rectly parsed, but their values are immaterial since
they are ignored.
The lines 3 through 11 specify the files and directo-
ries 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 specified by the next
line, in this case line 8. It must be the last char-
acter on a line. The colon on line 12 introduces a
comment; all characters up until the following new-
line 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 process,
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 regular file, a block spe-
cial file, a character special file, directory files,
named pipes (first-in, first out files), and symbolic
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 char-
acters 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.
Following the mode character string are two decimal
number tokens that specify the user and group IDs of
the file's owner.
In a regular file, the next token specifies the path-
name from which the contents and size of the file are
copied. In a block or character special file, the
next token are two decimal numbers that specify the
major and minor device numbers. When a file is a
symbolic link, the next token specifies the contents
of the link.
When the file is a directory, the mkfs.xfs command
creates the entries dot (.) and dot-dot (..) and then
reads the list of names and file specifications in a
recursive manner for all of the entries in the direc-
tory. A scan of the protofile is always terminated
with the dollar ( $ ) token.
slashes_are_spaces=value
If set to 1, slashes ("/") in the first token of each
line of the protofile are converted to spaces. This
enables the creation of a filesystem containing file-
names with spaces. By default, this is set to 0.
-q Quiet option. Normally mkfs.xfs prints the parameters of the
filesystem to be constructed; the -q flag suppresses this.
-r realtime_section_options
Section Name: [realtime]
These options specify the location, size, and other parameters of
the real-time section of the filesystem. The valid realtime_sec-
tion_options are:
rtdev=device
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.
extsize=value
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 mini-
mum 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.
size=value
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.
noalign
This option disables stripe size detection, enforcing
a realtime device with no stripe geometry.
rgcount=value
This is used to specify the number of allocation
groups in the realtime section. The realtime section
of the filesystem can be divided into allocation
groups to improve the performance of XFS. More allo-
cation groups imply that more parallelism can be
achieved when allocating blocks. The minimum alloca-
tion group size is 2 realtime extents; the maximum
size is 2^31 blocks. The rt section of the filesys-
tem is divided into value allocation groups (default
value is scaled automatically based on the underlying
device size).
rgsize=value
This is an alternative to using the rgcount subop-
tion. The value is the desired size of the realtime
allocation group expressed in bytes (usually using
the m or g suffixes). This value must be a multiple
of the realtime extent size, must be at least two re-
altime extents, and no more than 2^31 blocks. The
rgcount and rgsize suboptions are mutually exclusive.
concurrency=value
Create enough realtime allocation groups to handle
the desired level of concurrency. The goal of this
calculation scheme is to set the number of rtgroups
to an integer multiple of the number of writer
threads desired, to minimize contention of rtgroup
locks. This scheme will neither create fewer rt-
groups than would be created by the default configu-
ration, nor will it create rtgroups smaller than 4GB.
This option is not compatible with the rgcount or rg-
size options. The magic value nr_cpus or 1 or no
value at all will set this parameter to the number of
active processors in the system. If the kernel ad-
vertises that the realtime device is a non-mechanical
storage device, mkfs.xfs will use this new geometry
calculation scheme. The magic value of 0 forces use
of the older rtgroups geometry calculations that is
used for mechanical storage.
-s sector_size_options
Section Name: [sector]
This option specifies the fundamental sector size of the filesys-
tem. The valid sector_size_option is:
size=value
The sector size is specified with a value in bytes.
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.
-L label
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 in-
formation.
-N Causes the file system parameters to be printed out without re-
ally creating the file system.
-K Do not attempt to discard blocks at mkfs time.
-V Prints the version number and exits.
Configuration File Format
The configuration file uses a basic INI format to specify sections and
options within a section. Section and option names are case sensitive.
Section names must not contain whitespace. Options are name-value
pairs, ended by the first whitespace in the line. Option names cannot
contain whitespace. Full line comments can be added by starting a line
with a # symbol. If values contain whitespace, then it must be quoted.
The following example configuration file sets the block size to 4096
bytes, turns on reverse mapping btrees and sets the inode size to 2048
bytes.
# Example mkfs.xfs configuration file
[block]
size=4k
[metadata]
rmapbt=1
[inode]
size=2048
SEE ALSO
xfs(5), mkfs(8), mount(8), xfs_info(8), xfs_admin(8).
BUGS
With a prototype file, it is not possible to specify hard links.
mkfs.xfs(8)
Generated by dwww version 1.16 on Sat Oct 3 04:55:20 CEST 2026.