mkfs.xfs(8)
β¨ NAME β¨
mkfs.xfs β construct an XFS filesystem π
hiii bestie, so this is the mkfs.xfs(8) page from the System Manager's Manual, and it is a lot, so grab a snack π
π SYNOPSIS π
mkfs.xfs [ -b block_size_options ] [ -c config_file_options ] [ -m global_metadata_options ] [ -d data_section_options ] [ -f ] [ -i inode_options ] [ -l log_section_options ] [ -n naming_options ] [ -p prototype_options ] [ -q ] [ -r realtime_section_options ] [ -s sector_size_options ] [ -L label ] [ -N ] [ -K ] device
mkfs.xfs -V
π¦ DESCRIPTION π¦
okay so mkfs.xfs builds an XFS filesystem by writing all over a special file, using the values it found in the arguments you gave it on the command line. and the cute part? you basically never call it yourself β mkfs(8) invokes it automatically when you hand it the -t xfs option π
In its simplest (and most commonly used!) form, the size of the filesystem just gets determined from the disk driver. like, it figures it out. as an example, to make a filesystem with an internal log on the first partition on the first SCSI disk, you go:
mkfs.xfs /dev/sda1
Now, the metadata log can also 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, you'd do:
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. same thing, different fit π
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-soption below).bβ multiply by filesystem block size (default = 4K, see-boption 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 you're 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 default sizes (block: 4KiB, sector: 512B) will be used. defaults stay defaulting π«Ά
Many feature options allow an optional argument of 0 or 1, to explicitly disable or enable the functionality.
β οΈ also! the correctness of the crc32c checksum implementation will be tested before formatting the filesystem. if the test fails, the format will abort. no filesystem for you, bestie π
π OPTIONS π
Options may be specified either on the command line or in a configuration file. Not all command line options can be specified in configuration files; only the command line options followed by a [section] label can be used in a configuration file. iykyk β¨
Options that can be used in configuration files are grouped into related sections containing multiple options. The command line options and configuration files use the same option sections and grouping. Configuration 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. consistent queen π
Options specified are the combined set of command line parameters and configuration file parameters. Duplicated options will result in a respecification error, regardless of the location they were specified at. so likeβ¦ don't do that π
-cconfiguration_file_option β This option specifies the files that mkfs configuration will be obtained from. The validconfiguration_file_optionsare:defaults=path β Default configuration options will be sourced from the file specified by the name option string. This option can be use either an absolute or relative path to the configuration file to be read. Options specified through the default configuration file can be overridden by a configuration file specified viaoptions=or by command line arguments, in that order.
Sample configuration files can be found in /usr/share/xfsprogs/mkfs. This option also accepts configuration files generated by the makecfg suboption below, or by the makecfg subcommand of xfs_db and xfs_spaceman. πΈ
makecfg=path β Write a configuration file to the file specified by the path option string. This file can be re-read bymkfs.xfsfor a future filesystem format attempt. This file will contain only user-visible features. Filesystem geometry information is not written to the configuration file.options=name β The configuration options will be sourced from the file specified by the name option string. This option can be use either an absolute or relative path to the configuration file to be read. Sample configuration files can be found in/usr/share/xfsprogs/mkfs.
-bblock_size_options β Section Name:[block]
This option specifies the fundamental block size of the filesystem. The valid block_size_option is:
size=value β The filesystem block size is specified with a value in bytes. The default value is4096bytes (4 KiB), the minimum is512, and the maximum is65536(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. so like, it'll let you, butβ¦ π
-mglobal_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 specific 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 either0to disable the feature, or1to 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. like, short king energy π
By default, mkfs.xfs will enable this feature. If the option -m crc=0 is used, the large timestamp feature 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 either0to disable the feature, or1to 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. ate, honestly π₯
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 either0to disable the feature, or1to 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 inodes, allowing faster, more consistent inode allocation performance as filesystems age. it's giving efficiency π
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 disabled.
inobtcount=value β This option causes the filesystem to record the number 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 directory feature is not supported and is disabled.
uuid=valueβ bestie, this is where you hand-pick the UUID for your shiny new filesystem. Whatevervalueyou give it? That's the UUID, no takebacks. If you don't say anything, it just generates a random one for you. π«rmapbt=valueβ turns on the creation of a reverse-mapping btree index in each allocation group. Setvalueto0to disable the feature, or1to actually build that btree. β¨
So what even is a reverse mapping btree, you ask? It maps filesystem blocks to the owner of the filesystem block. Most of those mappings point at an inode number plus an offset, but some of them point at filesystem metadata too. This secondary metadata is the moment fr β you can use it to validate the primary metadata, or to pinpoint exactly which data got lost when a disk error happens. π
By default, mkfs.xfs will create reverse mapping btrees when possible. Heads up though: this feature is only available for filesystems created with the (default) -m crc=1 option set. If you go with -m crc=0, the reverse mapping btree feature is not supported and gets disabled. Periodt.
reflink=valueβ enables a separate reference count btree index in each allocation group.valueis either0to disable the feature, or1to create a reference count btree in each allocation group. π¦
The reference count btree is what lets you share physical extents between the data forks of different files β you probably know this by its stage name, "reflink". Here's the tea: traditional Unix filesystems assume every inode and logical block pair maps to a unique physical block. A reflink-capable XFS filesystem says "not me" and removes that uniqueness requirement, letting up to four billion arbitrary inode/logical block pairs map to a physical block. π€― If a program tries to write to a multiply-referenced block in a file, that write gets redirected to a new block, and that file's logical-to-physical mapping gets changed to the new block β which is literally called "copy on write". This is the feature that gives you per-file snapshots and deduplication. It is only available for the data forks of regular files, though. π
By default, mkfs.xfs will create reference count btrees and therefore will enable the reflink feature. Same caveat as above: 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 reference count btree feature is not supported and reflink is disabled. π«Ά
autofsck=valueβ sets theautofsckfilesystem property to thisvalue. For the full rundown on what this property actually does, go check thexfs_scrub(8)manual page. Go read it, iykyk. πuquotaβ if the metadata directory feature is enabled, the-m uquotaoption will set up user quota accounting and enforcement 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. πgquotaβ if the metadata directory feature is enabled, the-m gquotaoption will set up group quota accounting and enforcement 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. πpquotaβ if the metadata directory feature is enabled, the-m pquotaoption will set up project quota accounting and enforcement 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. πuqnoenforceβ if the metadata directory feature is enabled, the-m uqnoenforceoption 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. (Note: accounting only, no enforcement. Chill quota vibes.) πΈgqnoenforceβ if the metadata directory feature is enabled, the-m gqnoenforceoption 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 pqnoenforceoption will set up project 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. πΈ
π -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_options are, bestie, a whole list β let's go: π
agcount=valueβ use this to specify the number of allocation groups. The data section of the filesystem gets divided into allocation groups to improve the performance of XFS. More allocation groups imply that more parallelism can be achieved when allocating blocks and inodes. The minimum allocation group size is16 MiB; the maximum size is just under1 TiB. The data section of the filesystem is divided intovalueallocation groups (default value is scaled automatically based on the underlying device size). π₯agsize=valueβ an alternative to using theagcountsuboption. Thevalueis the desired size of the allocation group expressed in bytes (usually using themorgsuffixes). This value must be a multiple of the filesystem block size, and must be at least16MiB, and no more than1TiB, and may be automatically adjusted to properly align with the stripe geometry. Theagcountandagsizesuboptions are mutually exclusive β pick one, not both. πcowextsize=valueβ set the copy-on-write extent size hint on all inodes created bymkfs.xfs. The value must be provided in units of filesystem blocks. If the value is zero, the default value (currently32blocks) will be used. Directories will pass on this hint to newly created regular files and directories. β¨name=valueβ use this 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-loption below) and there can be no real-time section. π«file[=value]β specifies that the file given by thenamesuboption is a regular file. The value is either0or1, with1signifying that the file is regular. This suboption is used only to make a filesystem image. If the value is omitted then1is assumed. πsize=valueβ specifies 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 300MiB in size. No tiny filesystems, sorry bestie. π€
sunit=valueβ specifies the stripe unit for a RAID device or a logical volume. The value has to be specified in512-byteblock units. Use thesusuboption to specify the stripe unit size in bytes instead. 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 than512KiB. Also, inode allocations and the internal log will be stripe unit aligned. π―su=valueβ an alternative to usingsunit. Thesusuboption specifies the stripe unit for a RAID device or a striped logical volume. The value has to be specified in bytes, (usually using themorgsuffixes). This value must be a multiple of the filesystem block size. πswidth=valueβ specifies the stripe width for a RAID device or a striped logical volume. The value has to be specified in512-byteblock units. Use theswsuboption to specify the stripe width size in bytes. This suboption is required if-d sunithas been specified, and it has to be a multiple of the-d sunitsuboption. βsw=value** β the alternate route toswidth, bestie π«. This is where you tell it the **stripe width** for a RAID device or a striped logical volume. The value is a *multiplier of the stripe unit* β usually the same number as the stripe members in your logical volume config, or the data disks in a RAID device. And get this: when you're creating a filesystem on a block device,mkfs.xfswill <pink>automatically query the block device</pink> for the appropriatesunitandswidth` values **if the block device and the filesystem size would be larger than 1GB. It just does that. Iconic behavior honestly π«Ά.noalignβ turns off automatic geometry detection β and creates the filesystem without stripe geometry alignment, even if the underlying storage device is out here volunteering that information. Not today, geometry.- *
rtinherit=value*** β set it to1and every inodemkfs.xfscreates gets the <cyan>realtime flag</cyan> set. Default is0`. Directories will pass this flag on to newly created regular files and directories, like a little inheritance chain π§¬. - *
projinherit=value*** β every inode created bymkfs.xfs` gets assigned the project quota id you hand over in value. And yes, directories pass the project id along to newly created regular files and directories. β¨ extszinherit=value** β every inode created bymkfs.xfs` gets this value as its extent size hint. Heads up: value has to be in units of **filesystem blocks. Directories pass the hint on to newly created regular files and directories. πdaxinherit=value** β set to1and all inodes created bymkfs.xfsget the <mint>DAX flag</mint> set. Default is0. Directories pass it on to newly created regular files and directories. But important: by default,mkfs.xfs` will **not enable DAX mode. You have to ask. π- *
concurrency=value*** β this one creates enough allocation groups to handle the level of concurrency you're dreaming of. The whole goal of this calculation scheme is to set the number of AGs to an <hotpink>integer multiple of the number of writer threads</hotpink> you want, so AG lock contention gets minimized. It will neither create fewer AGs than the default configuration would, nor will it create AGs smaller than <yellow>4GB</yellow>. Watch out tho: this option is **not compatible** with theagcountoragsize` options, bestie, pick a lane π.
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. And the magic value of 0 forces use of the older AG geometry calculations that get used for mechanical storage. Spinning rust rights π.
-fβ force overwrite when an existing filesystem is detected on the device. Because by default,mkfs.xfswill not write to the device if it suspects there's already a filesystem or partition table sitting on it. It's being polite.-fis you saying "I know, I know, do it anyway" π.-iinode_options
Section Name: [inode]
This option specifies the inode size of the filesystem, plus other inode allocation parameters π¦. So here's the lore: the XFS inode has a fixed-size part and a variable-size part. The variable-size part β whose size is what this option messes with β can contain:
- directory 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|perblock=*value*β you can specify the inode size either as a value in bytes withsize=, or as the number fitting in a filesystem block withperblock=. The minimum (and default) value is 256 bytes without crc, and 512 bytes with crc enabled. The maximum value is 2048 (2 KiB) β but subject to the restriction that the inode size cannot exceed one half of the filesystem block size. Periodt.
Okay so XFS uses 64-bit inode numbers internally, but 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 platforms) and most applications currently cannot 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. But if an inode size is specified, or if a filesystem is sufficiently large, mkfs.xfs will warn you if this will create inode numbers > 32 significant bits. It's looking out for you fr fr π.
maxpct=value` β this specifies the maximum percentage of space in the filesystem that can be allocated to inodes. Defaults are giving tiered: 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 β go peek at xfs(5) for the details π).
This value can be modified later with xfs_growfs(8).
align[=value]β used to specify that inode allocation is or is not aligned. The value is either0or1, with1meaning inodes are allocated aligned. If the value is omitted,1is assumed. The default is that inodes are aligned. Aligned inode access is normally more efficient than unaligned access, and 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). Old school π¦.
This option is only tunable on the deprecated V4 format.
- *
attr=value*** β specifies the version of extended attribute inline allocation policy to use. By default this is2, which uses an efficient algorithm for managing the available inline inode space between attribute and extent data. The previous version1`, which has fixed regions for attribute and extent data, is kept for backwards compatibility with kernels older than version 2.6.16. Vintage β¨.
This option is only tunable on the deprecated V4 format.
projid32bit[=value]β enables 32bit quota project identifiers. The value is either0or1, with1meaning 32bit projid are to be enabled. If the value is omitted,1is assumed. (This default changed in release version 3.2.0, fyi.)
This option is only tunable on the deprecated V4 format.
sparse[=value]β enables sparse inode chunk allocation. The value is either0or1, with1meaning sparse allocation is enabled. If the value is omitted,1is assumed. Sparse inode allocation is enabled by default. This feature is only available for filesystems formatted with-m crc=1.
When enabled, sparse inode allocation lets the filesystem allocate a chunk smaller than the standard 64-inode chunk when free space is severely limited. This is genuinely useful for filesystems that might fragment free space over time such that no free extents are large enough to fit a chunk of 64 inodes. Without this feature enabled, inode allocations can fail with out of space errors under severe fragmented free space conditions. π
nrext64[=value]β extends the maximum values of inode data and attr fork extent counters from 2^31 - 1 and 2^15 - 1 to 2^48 - 1 and 2^32 - 1 respectively. If the value is omitted,1is assumed. This feature will be enabled when possible. Only available for filesystems formatted with-m crc=1. Big numbers, big energy π₯.exchange[=value]β when enabled, application programs can exchange file contents atomically via theXFS_IOC_EXCHANGE_RANGEioctl. Online repair uses this functionality to rebuild extended attributes, directories, symbolic links, and realtime metadata files. This feature is disabled by default. And you guessed it β only available for filesystems formatted with-m crc=1. π
max_atomic_write[=value]β flip this on and application programs can use theRWF_ATOMICwrite flag to persist changes of up to this size without tearing π β¨. The default is chosen to allow a reasonable amount of scalability. Bestie, listen: this value must also be passed via mount option. And the whole feature is only available for filesystems formatted with reflink. No reflink, no atomic writes, periodt.
ποΈ -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. Pick your fav allocation group π―internal[=value]β this is how you say the log section is a piece of the data section instead of being another device or logical volume. The value is either0or1, with1meaning the log is internal. If you just omit the value,1is assumed π«Άlogdev=deviceβ this one says the log section should reside on a device separate from the data section. Heads up:internal=1andlogdevare mutually exclusive β it's giving pick-a-lane, you literally cannot have both πsize=valueβ this is how you 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 blocks.
The log must be at least64MiBin size. The log cannot be more than2GiBin size. Those are the vibes, that's the boundary, no exceptions π
version=valueβ this specifies the version of the log. The current default is2, which allows for larger log buffer sizes, as well as supporting stripe-aligned log writes (see thesunitandsuoptions, 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 format.
sunit=valueβ this specifies the alignment to be used for log writes. The value has to be specified in512-byte block units. Use thesusuboption 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 performance on some configurations such as software RAID5 when thesunitis 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 logsunitsuboption 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 thesorbsuffixes). This value must be a multiple of the filesystem block size. Version 2 logs are automatically selected if the logsusuboption 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 frequently enough that the superblock updates become a serialization point in the filesystem. The value can be either0or1.
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 needing 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.
This option is only tunable on the deprecated V4 format.
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 thesizeoption. This option is not compatible with thelogdevorsizeoptions. The magic valuenr_cpusor1or 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_options are:
size=valueβ the directory block size is specified with a value in bytes. The block size must be a power of2and cannot be less than the filesystem block size. The default size value for version2directories is4096bytes (4 KiB), unless the filesystem block size is larger than4096, in which case the default value is the filesystem block size. For version1directories the block size is the same as the filesystem block size.version=valueβ the naming (directory) version value can be either2or'ci', defaulting to2if unspecified. With version2directories, the directory block size can be any power of2size from the filesystem block size up to65536.
If the version=ci option is specified, the kernel will transform certain bytes in filenames before performing lookup-related operations. The byte sequence given to create a directory entry is persisted without alterations. The lookup transformations are defined as follows:
0x41-0x5a -> 0x61-0x7a
0xc0-0xd6 -> 0xe0-0xf6
0xd8-0xde -> 0xf8-0xfe
This transformation roughly corresponds to case insensitivity in ISO 8859-1. The transformations are not compatible with other encodings (e.g. UTF8). Do not enable this feature unless your entire environment 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. Gone. Not a thing. Don't ask bestie π
ftype=valueβ this feature allows the inode type to be stored in the directory structure so that thereaddir(3)andgetdents(2)do not need to look up the inode to determine 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 functionality 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 reconstruct broken directory files π οΈ The value is either0to disable the feature, or1to create parent pointers.
By default, mkfs.xfs will not create parent pointers. This feature is only available for filesystems created with the (default) -m crc=1 option set.
𧬠-p prototype_options π§¬
Section Name: [proto]
These options specify the prototype parameters for populating the filesystem. The valid prototype_options are:
[file=]β thefile=prefix is not required for this CLI argument for legacy reasons. If specified as a config file directive, the prefix is required. Legacy chaos, iconic honestly π[file=]directoryβ okay so if you pass a prototype argument and it happens to be a directory,mkfs.xfswill straight up fill your new root filesystem with everything inside that directory tree. And bestie, it doesn't just copy vibes β content, timestamps (atime,mtime), attributes and extended attributes are all preserved for all file types. full glow-up, nothing left behind π[file=]protofileβ and if that prototype argument points at a regular file instead? Thenmkfs.xfstreats it as a prototype file and takes all its orders from it, like a little instruction manual. The blocks and inodes specifiers in the protofile are there for backwards compatibility but are otherwise unused (aka decorative, king π ). The syntax of the protofile is a bunch of tokens separated by spaces or newlines. And heads up: the line numbers are not part of the syntax, they're just there to help you follow along in the yapping below.
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 used to be the bootfilename, rip to that era.) It's there purely for backward compatibility β boot blocks are not used on SGI systems. fr fr, it does nothing.
And listen: some string of characters must be present as the first line of the proto file for it to be parsed correctly. What you put there is immaterial because it's ignored. It's giving "showing up just to be counted" energy π«Ά
Line 2 holds two numeric values (formerly the numbers of blocks and inodes). These are also purely backward compatibility: two numeric values must appear at this point for the proto file to parse right, but their values are immaterial since they're ignored. placeholder icons, periodt β¨
Lines 3 through 11 are where you actually specify the files and directories you want in this filesystem. Line 3 defines the root directory. Other directories and files you want are indicated by lines 4 through 6 and lines 8 through 10. Line 11 contains symbolic link syntax.
Noticed the dollar sign ($) syntax on line 7? That little guy tells mkfs.xfs to terminate the branch of the filesystem it's currently on and then continue from the directory specified by the next line β in this case, line 8. It must be the last character on a line, no exceptions. The colon on line 12 introduces a comment; all characters up until the following newline are ignored. Which means... you cannot have a file in a prototype file whose name contains a colon. tragic, I know π 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, and its character range is -bcdpl. So a file may be a regular file, a block special file, a character special file, directory files, named pipes (first-in, first out files), and symbolic links. a whole alphabet of possibilities, iconic
The second character of the mode string specifies setuserID mode β in which case it's u. If setuserID mode is not specified, the second character is -. The third character specifies setgroupID mode β in which case it's g. If setgroupID mode is not specified, 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. Want the deep lore 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 pathname from which the contents and size of the file are copied. In a block or character special file, the next token is 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. each file type has its own little token ritual, obsessed πΈ
When the file is a directory, mkfs.xfs 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 directory. A scan of the protofile is always terminated with the dollar ($) token.
atime=valueβ if you set this to1,mkfswill copy in access timestamps from the source files. Otherwise, access timestamps get set to the current time. time travel: on or off β³slashes_are_spaces=valueβ if you set this to1, slashes ("/") in the first token of each line of the prototype file get converted to spaces. This is how you enable creating a filesystem containing filenames with spaces. By default, this is set to0. space-in-filename representation, we love to see it π
-qβ the quiet option. Normallymkfs.xfsprints the parameters of the filesystem to be constructed; the-qflag suppresses this. shhh, no spoilers π€«-rrealtime_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_section_options are:rtdev=deviceβ this specifies the device that should contain the real-time section of the filesystem. The suboption value is the name of a block device. point it at the real one πextsize=valueβ this specifies 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 or4 KiB(whichever is larger); the default size is the stripe width for striped volumes or64 KiBfor non-striped volumes; the maximum allowed size is1 GiB. The real-time extent size should be carefully chosen to match the parameters of the physical media used. pick wisely bestie, this one actually matters β¨size=valueβ this specifies the size of the real-time section. You only need this suboption if the real-time section of the filesystem should occupy less space than the size of the partition or logical volume containing the section.noalignβ this option disables stripe size detection, enforcing a realtime device with no stripe geometry. no geometry, no detection, just vibes πrgcount=valueβ this specifies 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 allocation groups imply that more parallelism can be achieved when allocating blocks. The minimum allocation group size is 2 realtime extents; the maximum size is2^31blocks. The rt section of the filesystem is divided into value allocation groups (default value is scaled automatically based on the underlying device size). parallelism era, go off πrgsize=valueβ this is an alternative to using thergcountsuboption. The value is the desired size of the realtime allocation group expressed in bytes (usually using themorgsuffixes). This value must be a multiple of the realtime extent size, must be at least two realtime extents, and no more than2^31blocks. Thergcountandrgsizesuboptions are mutually exclusive β pick one, not both. they cannot coexist, it's giving messy ex energy π
concurrency=valueβ bestie, this one creates enough realtime allocation groups to handle the level of concurrency you want π . The whole point of the math here is to make the number of rtgroups an integer multiple of the number of writer threads you're aiming for, so that contention on rtgroup locks stays low. Two things it will never do: it won't make fewer rtgroups than the default config would have made, and it won't make any rtgroups smaller than 4GB. Heads up though β this option is not compatible with thergcountorrgsizeoptions π«. The magic valuenr_cpus, or1, or no value at all, sets this parameter to the number of active processors in the system. And if the kernel says the realtime device is a non-mechanical storage device,mkfs.xfswill use this new geometry calculation scheme β¨. The magic value0forces the older rtgroups geometry calculations, the ones used for mechanical storage.zoned=valueβ controls whether the zoned allocator gets used for the realtime device π. Value is0to disable the feature or1to enable it. Defaults to1for a zoned block device, otherwise0.start=valueβ controls where the internal realtime section starts π. Defaults to0for conventional block devices, or the start of the first sequential required zone for zoned block devices. This option is only valid if the zoned realtime allocator is in use, k?reserved=valueβ controls how much space in the realtime section is reserved for internal use by the garbage collection and reorganization algorithms π§Ή. Defaults to0if you don't set it. Also only valid when the zoned realtime allocator is being used.
-ssector_size_options β Section Name:[sector]. This one sets the fundamental sector size of the filesystem πΈ. The valid sector_size_option is:size=valueβ the sector size, given as a value in bytes. The defaultsector_sizeis512bytes. The minimum value for sector size is512; the max is32768(32 KiB). It must be a power of 2, and you cannot make it larger than the filesystem block size β no cap, fr.
-Llabel β sets the filesystem label π·οΈ. XFS filesystem labels can be at most 12 characters long; if label is longer than 12 characters,mkfs.xfswill straight up not proceed with creating the filesystem π. Peep themount(8)andxfs_admin(8)manual entries for extra info.-Nβ causes the file system parameters to be printed out without actually creating the file system π. A little window-shopping moment, we love it.-Kβ do not attempt to discard blocks at mkfs time π.-Vβ prints the version number and exits. Short and iconic π .
π 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. And if your values contain whitespace, it has to be quoted, periodt.
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. That's just how it is, bestie π.
And that's a wrap on the whole page, my love π«Ά This was mkfs.xfs(8) β the source/version and date live down in the footer, so if you ever need to cite exactly which version you read, that little line at the bottom is your bestie π. Go format something iconic, mwah π
β¨
π¦ where this page comes from
- arch rolling: xfsprogs 7.2.0-1
- arch rolling: xfsprogs 7.2.1-1 Β· GPL-2.0-only AND LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms