xfsinvutil

title: xfsinvutil(8)

text:
# xfsinvutil(8)

## NAME
xfsinvutil - xfsdump inventory database checking and pruning utility

## SYNOPSIS

```
xfsinvutil [-F|-i] [-m media_label] -M mount_point mm/dd/yyyy
xfsinvutil [-F|-i] [-m media_label] -u UUID mm/dd/yyyy
xfsinvutil [-F] -s SESSION_ID
xfsinvutil -i
xfsinvutil -C
```

## DESCRIPTION
xfsdump maintains an online dump inventory in /var/lib/xfsdump/inventory. The -I option of xfsdump displays the inventory contents hierarchically. The levels of the hierarchy are: filesystem, dump session, stream, and media file.

xfsinvutil is a utility to check this inventory database for consistency, to remove entries of dump sessions which may no longer be of relevance, and to browse the contents of the inventory.

The following command line options are available:

-F

Don't prompt the operator. When xfsinvutil encounters a matching dump session, xfsinvutil will normally ask the operator for permission to delete the entry. With this option the deletion is performed, no questions asked.

-i

Interactive mode. Causes xfsinvutil to run in a mode that will allow the operator to browse and modify the contents of the inventory. Please refer to the Interactive Mode section below for more information.

-M mount_point mm/dd/yyyy

Prunes dump sessions identified by the given mount point which were created prior to the specified date. Optionally -m may be be specified to further limit the matching dump sessions by media label. xfsinvutil will prompt the operator prior to pruning a dump session unless the -F or -i options are given.

-u UUID mm/dd/yyyy

Like -M, except the matching filesystem is specified using its universally unique identifier (UUID) instead of its mount point.

-m media_label

If specified, only sessions with at least one media file whose label matches this value will be eligible for pruning. This restriction is in addition to those imposed by the date and the -M or -u options. This option allows the pruning of all inventory references to media which may have been overwritten or lost. Note that this option does not apply to sessions with no media files.

-s SESSION_ID

Prunes the dump session identified by the given session id. xfsinvutil will prompt the operator prior to pruning a dump session unless the -F option is given.

-C

With this option, xfsinvutil performs consistency checks for all entries in the inventory database. It fixes any problems found. If no consistent entries are found , the corresponding inventory database file is removed.

### Interactive Mode
When run with -i, xfsinvutil will present the operator with a hierarchical representation of the xfsdump inventory. In this mode, the operator can use the arrow keys (or the h j k l keys) to navigate the inventory and also use the following keys and functionality:

+

Expand a branch of the tree.

-

Collapse a branch of the tree.

*

Fully expand a branch of the tree.

%

Fully collapse a branch of the tree.

h

Move selection to the parent entry.

l

Move selection to the child entry.

j

Move selection to next entry.

k

Move selection to previous entry.

d

Mark the current record, and all sub-records, to be deleted.

u

Clear the current record and all parent records from being deleted.

i

Import another xfsdump inventory.

?

Show help window.

x

Commit any changes made to the inventory, and exit the program.

q

Exit the program without committing any changes to the inventory.

Inventories from other hosts can be imported to create a larger common inventory. It is recommended that the contents of /var/lib/xfsdump/inventory on the remote host be copied to a temporary local directory prior to running xfsinvutil. When xfsinvutil is run in interactive mode, and the operator hits i, they will be prompted for the path to the inventory to be imported. xfsinvutil will then add the contents of the imported inventory to the main window, and all entries will be marked as imported. The operator can then delete any of these entries that are not to be imported. When the operator commits the changes, xfsinvutil will import any entries which were not marked as deleted. Deleted entries are not actually deleted from the original imported inventory.

## NOTES

### Inventory
Each dump session updates an inventory database in /var/lib/xfsdump/inventory. xfsdump uses the inventory to determine the base of incremental and resumed dumps.

This database can be displayed by invoking xfsdump with the -I option. The display uses tabbed indentation to present the inventory hierarchically. The first level is filesystem. The second level is session. The third level is media stream (currently only one stream is supported). The fourth level lists the media files sequentially composing the stream.

## FILES
/var/lib/xfsdump/inventory

dump inventory database

## SEE ALSO
xfsdump(8), xfsrestore(8).


xfsrestore

package: xfsdump

title: xfsrestore(8)

text:
# xfsrestore(8)

## NAME
xfsrestore - XFS filesystem incremental restore utility

## SYNOPSIS

```
xfsrestore -h
xfsrestore [ options ] -f source [ -f source ... ] dest
xfsrestore [ options ] - dest
xfsrestore -I [ subopt=value ... ]
```

## DESCRIPTION
xfsrestore restores filesystems from dumps produced by xfsdump(8). Two modes of operation are available: simple and cumulative.

The default is simple mode. xfsrestore populates the specified destination directory, dest, with the files contained in the dump media.

The -r option specifies the cumulative mode. Successive invocations of xfsrestore are used to apply a chronologically ordered sequence of delta dumps to a base (level 0) dump. The contents of the filesystem at the time each dump was produced is reproduced. This can involve adding, deleting, renaming, linking, and unlinking files and directories.

A delta dump is defined as either an incremental dump (xfsdump -l option with level > 0) or a resumed dump (xfsdump -R option). The deltas must be applied in the order they were produced. Each delta applied must have been produced with the previously applied delta as its base.

xfsrestore keeps state information in the xfsrestorehousekeepingdir, to inform subsequent invocations when used in cumulative mode, or in the event a restore is interrupted. To ensure that the state information can be processed, a compatible version of xfsrestore must be used for each subsequent invocation. Additionally, each invocation must run on a system of the same endianness and page size.

The options to xfsrestore are:

-a housekeeping

Each invocation of xfsrestore creates a directory called xfsrestorehousekeepingdir. This directory is normally created directly under the dest directory. The -a option allows the operator to specify an alternate directory, housekeeping, in which xfsrestore creates the xfsrestorehousekeepingdir directory. When performing a cumulative (-r option) restore or resuming (-R option) a restore, each successive invocation must specify the same alternate directory.

-b blocksize

Specifies the blocksize, in bytes, to be used for the restore. For other drives such as DAT or 8 mm , the same blocksize used for the xfsdump operation must be specified to restore the tape. The default block size is 1Mb.

-c progname

Use the specified program to alert the operator when a media change is required. The alert program is typically a script to send a mail or flash a window to draw the operator's attention.

-e

Prevents xfsrestore from overwriting existing files in the dest directory.

-f source [ -f source ... ]

Specifies a source of the dump to be restored. This can be the pathname of a device (such as a tape drive), a regular file or a remote tape drive (see rmt(8)). This option must be omitted if the standard input option (a lone - preceding the dest specification) is specified.

-i

Selects interactive operation. Once the on-media directory hierarchy has been read, an interactive dialogue is begun. The operator uses a small set of commands to peruse the directory hierarchy, selecting files and subtrees for extraction. The available commands are given below. Initially nothing is selected, except for those subtrees specified with -s command line options.

ls [arg]

List the entries in the current directory or the specified directory, or the specified non-directory file entry. Both the entry's original inode number and name are displayed. Entries that are directories are appended with a `/'. Entries that have been selected for extraction are prepended with a `*'.

cd [arg]

Change the current working directory to the specified argument, or to the filesystem root directory if no argument is specified.

pwd

Print the pathname of the current directory, relative to the filesystem root.

add [arg]

The current directory or specified file or directory within the current directory is selected for extraction. If a directory is specified, then it and all its descendents are selected. Entries that are selected for extraction are prepended with a `*' when they are listed by ls.

delete [arg]

The current directory or specified file or directory within the current directory is deselected for extraction. If a directory is specified, then it and all its descendents are deselected. The most expedient way to extract most of the files from a directory is to select the directory and then deselect those files that are not needed.

extract

Ends the interactive dialogue, and causes all selected subtrees to be restored.

quit

xfsrestore ends the interactive dialogue and immediately exits, even if there are files or subtrees selected for extraction.

help

List a summary of the available commands.

-m

Use the minimal tape protocol. This option cannot be used without specifying a blocksize to be used (see -b option above).

-n file

Allows xfsrestore to restore only files newer than file. The modification time of file (i.e., as displayed with the ls -l command) is compared to the inode modification time of each file on the source media (i.e., as displayed with the ls -lc command). A file is restored from media only if its inode modification time is greater than or equal to the modification time of file.

-o

Restore file and directory owner/group even if not root. When run with an effective user id of root, xfsrestore restores owner and group of each file and directory. When run with any other effective user id it does not, unless this option is specified.

-p interval

Causes progress reports to be printed at intervals of interval seconds. The interval value is approximate, xfsrestore will delay progress reports to avoid undue processing overhead.

-q

Source tape drive is a QIC tape. QIC tapes only use a 512 byte blocksize, for which xfsrestore must make special allowances.

-r

Selects the cumulative mode of operation. The -a and destination options must be the same for each invocation.

-s subtree

Specifies a subtree to restore. Any number of -s options are allowed. The restore is constrained to the union of all subtrees specified. Each subtree is specified as a pathname relative to the restore dest. If a directory is specified, the directory and all files beneath that directory are restored.

-t

Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

-v verbosity

-v subsys=verbosity[,subsys=verbosity,...]

Specifies the level of detail used for messages displayed during the course of the restore. The verbosity argument can be passed as either a string or an integer. If passed as a string the following values may be used: silent, verbose, trace, debug, or nitty. If passed as an integer, values from 0-5 may be used. The values 0-4 correspond to the strings already listed. The value 5 can be used to produce even more verbose debug output. The first form of this option activates message logging across all restore subsystems. The second form allows the message logging level to be controlled on a per-subsystem basis. The two forms can be combined (see the example below). The argument subsys can take one of the following values: general, proc, drive, media, inventory, and tree.

For example, to restore the root filesystem with tracing activated for all subsystems:

```
# xfsrestore -v trace -f /dev/tape /
```

To enable debug-level tracing for drive and media operations:

```
# xfsrestore -v drive=debug,media=debug -f /dev/tape /
```

To enable tracing for all subsystems, and debug level tracing for drive operations only:

```
# xfsrestore -v trace,drive=debug -f /dev/tape /
```

-A

Do not restore extended file attributes. When restoring a filesystem managed within a DMF environment this option should not be used. DMF stores file migration status within extended attributes associated with each file. If these attributes are not preserved when the filesystem is restored, files that had been in migrated state will not be recallable by DMF. Note that dumping of extended file attributes is also optional.

-B

Change the ownership and permissions of the destination directory to match those of the root directory of the dump.

-D

Restore DMAPI (Data Management Application Programming Interface) event settings. If the restored filesystem will be managed within the same DMF environment as the original dump it is essential that the -D option be used. Otherwise it is not usually desirable to restore these settings.

-E

Prevents xfsrestore from overwriting newer versions of files. The inode modification time of the on-media file is compared to the inode modification time of corresponding file in the dest directory. The file is restored only if the on-media version is newer than the version in the dest directory. The inode modification time of a file can be displayed with the ls -lc command.

-F

Inhibit interactive operator prompts. This option inhibits xfsrestore from prompting the operator for verification of the selected dump as the restore target and from prompting for any media change.

-I

Causes the xfsdump inventory to be displayed (no restore is performed). Each time xfsdump is used, an online inventory in /var/lib/xfsdump/inventory is updated. This is used to determine the base for incremental dumps. It is also useful for manually identifying a dump session to be restored (see the -L and -S options). Suboptions to filter the inventory display are described later.

-J

Inhibits inventory update when on-media session inventory encountered during restore. xfsrestore opportunistically updates the online inventory when it encounters an on-media session inventory, but only if run with an effective user id of root and only if this option is not given.

-K

Force xfsrestore to use dump format 2 generation numbers. Normally the need for this is determined automatically, but this option is required on the first xfsrestore invocation in the rare case that a cumulative restore begins with a format 3 (or newer) dump and will be followed by a format 2 dump.

-L session_label

Specifies the label of the dump session to be restored. The source media is searched for this label. It is any arbitrary string up to 255 characters long. The label of the desired dump session can be copied from the inventory display produced by the -I option.

-O options_file

Insert the options contained in options_file into the beginning of the command line. The options are specified just as they would appear if typed into the command line. In addition, newline characters (\n) can be used as whitespace. The options are placed before all options actually given on the command line, just after the command name. Only one -O option can be used. Recursive use is ignored. The destination directory cannot be specified in options_file.

-Q

Force completion of an interrupted restore session. This option is required to work around one specific pathological scenario. When restoring a dump session which was interrupted due to an EOM condition and no online session inventory is available, xfsrestore cannot know when the restore of that dump session is complete. The operator is forced to interrupt the restore session. In that case, if the operator tries to subsequently apply a resumed dump (using the -r option), xfsrestore refuses to do so. The operator must tell xfsrestore to consider the base restore complete by using this option when applying the resumed dump.

-R

Resume a previously interrupted restore. xfsrestore can be interrupted at any time by pressing the terminal interrupt character (see stty(1)). Use this option to resume the restore. The -a and destination options must be the same.

-S session_id

Specifies the session UUID of the dump session to be restored. The source media is searched for this UUID. The UUID of the desired dump session can be copied from the inventory display produced by the -I option.

-T

Inhibits interactive dialogue timeouts. xfsrestore prompts the operator for media changes. This dialogue normally times out if no response is supplied. This option prevents the timeout.

-X subtree

Specifies a subtree to exclude. This is the converse of the -s option. Any number of -X options are allowed. Each subtree is specified as a pathname relative to the restore dest. If a directory is specified, the directory and all files beneath that directory are excluded.

-Y io_ring_length

Specify I/O buffer ring length. xfsrestore uses a ring of input buffers to achieve maximum throughput when restoring from tape drives. The default ring length is 3. However, this is not currently enabled on Linux yet, making this option benign.

-

A lone - causes the standard input to be read as the source of the dump to be restored. Standard input can be a pipe from another utility (such as xfsdump(8)) or a redirected file. This option cannot be used with the -f option. The - must follow all other options, and precede the dest specification.

The dumped filesystem is restored into the dest directory. There is no default; the dest must be specified.

## NOTES

### Cumulative Restoration
A base (level 0) dump and an ordered set of delta dumps can be sequentially restored, each on top of the previous, to reproduce the contents of the original filesystem at the time the last delta was produced. The operator invokes xfsrestore once for each dump. The -r option must be specified. The dest directory must be the same for all invocations. Each invocation leaves a directory named xfsrestorehousekeeping in the dest directory (however, see the -a option above). This directory contains the state information that must be communicated between invocations. The operator must remove this directory after the last delta has been applied.

xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

xfsrestore does not remove the orphanage after cumulative restores. Like the xfsrestorehousekeeping directory, the operator must remove it after applying all delta dumps.

### Media Management
A dump consists of one or more media files contained on one or more media objects. A media file contains all or a portion of the filesystem dump. Large filesystems are broken up into multiple media files to minimize the impact of media dropouts, and to accommodate media object boundaries (end-of-media).

A media object is any storage medium: a tape cartridge, a remote tape device (see rmt(8)), a regular file, or the standard input (currently other removable media drives are not supported). Tape cartridges can contain multiple media files, which are typically separated by (in tape parlance) file marks. If a dump spans multiple media objects, the restore must begin with the media object containing the first media file dumped. The operator is prompted when the next media object is needed.

Media objects can contain more than one dump. The operator can select the desired dump by specifying the dump label (-L option), or by specifying the dump UUID (-S option). If neither is specified, xfsrestore scans the entire media object, prompting the operator as each dump session is encountered.

The inventory display (-I option) is useful for identifying the media objects required. It is also useful for identifying a dump session. The session UUID can be copied from the inventory display to the -S option argument to unambiguously identify a dump session to be restored.

Dumps placed in regular files or the standard output do not span multiple media objects, nor do they contain multiple dumps.

### Inventory
Each dump session updates an inventory database in /var/lib/xfsdump/inventory. This database can be displayed by invoking xfsrestore with the -I option. The display uses tabbed indentation to present the inventory hierarchically. The first level is filesystem. The second level is session. The third level is media stream (currently only one stream is supported). The fourth level lists the media files sequentially composing the stream.

The following suboptions are available to filter the display.

-I depth=n

(where n is 1, 2, or 3) limits the hierarchical depth of the display. When n is 1, only the filesystem information from the inventory is displayed. When n is 2, only filesystem and session information are displayed. When n is 3, only filesystem, session and stream information are displayed.

-I level=n

(where n is the dump level) limits the display to dumps of that particular dump level.

The display may be restricted to media files contained in a specific media object.

-I mobjid=value

(where value is a media ID) specifies the media object by its media ID.

-I mobjlabel=value

(where value is a media label) specifies the media object by its media label.

Similarly, the display can be restricted to a specific filesystem.

-I mnt=mount_point

(that is, [hostname:]pathname), identifies the filesystem by mountpoint. Specifying the hostname is optional, but may be useful in a clustered environment where more than one host can be responsible for dumping a filesystem.

-I fsid=filesystem_id

identifies the filesystem by filesystem ID.

-I dev=device_pathname

(that is, [hostname:]device_pathname) identifies the filesystem by device. As with the mnt filter, specifying the hostname is optional.

More than one of these suboptions, separated by commas, may be specified at the same time to limit the display of the inventory to those dumps of interest. However, at most four suboptions can be specified at once: one to constrain the display hierarchy depth, one to constrain the dump level, one to constrain the media object, and one to constrain the filesystem.

For example, -I depth=1,mobjlabel="tape 1",mnt=host1:/test_mnt would display only the filesystem information (depth=1) for those filesystems that were mounted on host1:/test_mnt at the time of the dump, and only those filesystems dumped to the media object labeled "tape 1".

Dump records may be removed (pruned) from the inventory using the xfsinvutil program.

An additional media file is placed at the end of each dump stream. This media file contains the inventory information for the current dump session. If the online inventory files in /var/lib/xfsdump/inventory are missing information for the current dump session, then the inventory information in the media file is automatically added to the files in /var/lib/xfsdump/inventory. If you wish to incorporate the inventory information from the media file without restoring any data, you may do so using the -t option:

```
# xfsrestore -t -f /dev/tape
```

This is useful to rebuild the inventory database if it is ever lost or corrupted. The only caveat is that xfsrestore needs to read through the entire dump in order to reach the inventory media file. This could become time consuming for dump sessions with large media files.

### Media Errors
xfsdump is tolerant of media errors, but cannot do error correction. If a media error occurs in the body of a media file, the filesystem file represented at that point is lost. The bad portion of the media is skipped, and the restoration resumes at the next filesystem file after the bad portion of the media.

If a media error occurs in the beginning of the media file, the entire media file is lost. For this reason, large dumps are broken into a number of reasonably sized media files. The restore resumes with the next media file.

### Quotas
When xfsdump dumps a filesystem with user quotas, it creates a file in the root of the dump called xfsdump_quotas. xfsrestore can restore this file like any other file included in the dump. This file can be processed by the restore command of xfs_quota(8) to reactivate the quotas. However, the xfsdump_quotas file contains information which may first require modification; specifically the filesystem name and the user ids. If you are restoring the quotas for the same users on the same filesystem from which the dump was taken, then no modification will be necessary. However, if you are restoring the dump to a different filesystem, you will need to:

- ensure the new filesystem is mounted with the quota option

- modify the xfsdump_quotas file to contain the new filesystem name

- ensure the uids in the xfsdump_quotas file are correct

Once the quota information has been verified, the restore command of xfs_quota (8) can be used to apply the quota limits to the filesystem.

Group and project quotas are handled in a similar fashion and will be restored in files called xfsdump_quotas_group and xfsdump_quotas_proj, respectively.

## EXAMPLES
To restore the root filesystem from a locally mounted tape:

```
# xfsrestore -f /dev/tape /
```

To restore from a remote tape, specifying the dump session id:

```
# xfsrestore -L session_1 -f otherhost:/dev/tape /new
```

To restore the contents a of a dump to another subdirectory:

```
# xfsrestore -f /dev/tape /newdir
```

To copy the contents of a filesystem to another directory (see xfsdump(8)):

```
# xfsdump -J - / | xfsrestore -J - /new
```

## FILES
/var/lib/xfsdump/inventory

dump inventory database

## SEE ALSO
rmt(8), xfsdump(8), xfsinvutil(8), xfs_quota(8), attr_set(2).

## DIAGNOSTICS
The exit code is 0 on normal completion, and non-zero if an error occurred or the restore was terminated by the operator.

For all verbosity levels greater than 0 (silent) the final line of the output shows the exit status of the restore. It is of the form:

```
xfsdump: Restore Status: code
```

Where code takes one of the following values: SUCCESS (normal completion), INTERRUPT (interrupted), QUIT (media no longer usable), INCOMPLETE (restore incomplete), FAULT (software error), and ERROR (resource error). Every attempt will be made to keep both the syntax and the semantics of this log message unchanged in future versions of xfsrestore. However, it may be necessary to refine or expand the set of exit codes, or their interpretation at some point in the future.

## BUGS
Pathnames of restored non-directory files (relative to the dest directory) must be 1023 characters (MAXPATHLEN) or less. Longer pathnames are discarded and a warning message displayed.

There is no verify option to xfsrestore. This would allow the operator to compare a filesystem dump to an existing filesystem, without actually doing a restore.

The interactive commands (-i option) do not understand regular expressions.

When the minimal rmt option is specified, xfsrestore applies it to all remote tape sources. The same blocksize (specified by the -b option) is used for all these remote drives.

xfsrestore uses the alert program only when a media change is required.

Cumulative mode (-r option) requires that the operator invoke xfsrestore for the base and for each delta to be applied in sequence to the base. It would be better to allow the operator to identify the last delta in the sequence of interest, and let xfsrestore work backwards from that delta to identify and apply the preceding deltas and base dump, all in one invocation.


fsck.xfs

package: xfsprogs

title: fsck.xfs(8)

summary: do nothing, successfully

text:
# fsck.xfs(8)

## NAME
fsck.xfs - do nothing, successfully

## SYNOPSIS
fsck.xfs [ filesys ... ]

## DESCRIPTION
fsck.xfs is called by the generic Linux fsck(8) program at startup to check and repair an XFS filesystem. XFS is a journaling filesystem and performs recovery at mount(8) time if necessary, so fsck.xfs simply exits with a zero exit status.

If you wish to check the consistency of an XFS filesystem, or repair a damaged or corrupt XFS filesystem, see xfs_repair(8).

However, the system administrator can force fsck.xfs to run xfs_repair(8) at boot time by creating a /forcefsck file or booting the system with "fsck.mode=force" on the kernel command line.

## FILES
/etc/fstab.

## SEE ALSO
fsck(8), fstab(5), xfs(5), xfs_repair(8).


mkfs.xfs

title: mkfs.xfs(8)

summary: construct an XFS filesystem

text:
# 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 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
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 filesystem 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 option 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 default 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 before formatting the filesystem. If the test fails, the format will abort.

## 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.

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.

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.

-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 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.

-b block_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 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 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 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 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 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 inodes, allowing faster, more consistent inode allocation 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 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

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 mappings 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 reverse 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 physical block. If a program tries to write to a multiply-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 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

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 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 gquota option 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 pquota option 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 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 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:

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 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).

agsize=value

This is an alternative to using the agcount suboption. 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 adjusted to properly align with the stripe geometry. The agcount and agsize suboptions are mutually exclusive.

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 image. 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 specified in 512-byte block units. Use the su suboption 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.

su=value

This is an alternative to using sunit. The su suboption 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 suffixes). This value must be a multiple of the filesystem 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 suboption to specify the stripe width size in bytes. This suboption is required if -d sunit has been specified 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 logical volume configuration, or data disks in a RAID device.

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 alignment 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 default 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 directories.

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 compatible 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 device 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; 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

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 platforms) 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 significant bits.

maxpct=value

This specifies the maximum percentage of space in the filesystem that can be allocated to inodes. The default 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 format.

attr=value

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 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 compatibility with kernels older than version 2.6.16.

This option is only tunable on the deprecated V4 format.

projid32bit[=value]

This is used to enable 32bit quota project identifiers. 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 release version 3.2.0.)

This option is only tunable on the deprecated V4 format.

sparse[=value]

Enable sparse inode chunk allocation. The value is either 0 or 1, with 1 signifying that sparse allocation is enabled. If the value is omitted, 1 is 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 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 extents are large enough to accommodate 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]

Extend 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, 1 is assumed. This feature will be enabled when possible. This feature is only available for filesystems 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 rebuild 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.

max_atomic_write[=value]

When enabled, application programs can use the RWF_ATOMIC write flag to persist changes of up to this size without tearing. The default is chosen to allow a reasonable amount of scalability. This value must also be passed via mount option. This feature is only available for filesystems formatted with reflink.

-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 exclusive.

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 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 least 64MB in size. The log cannot 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 format.

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 performance 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 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 automatically 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 frequently 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 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 the size option. 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_options are:

size=value

The directory block size is specified with a value in bytes. 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 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 version 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 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.

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 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 either 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 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=]

The file= prefix is not required for this CLI argument for legacy reasons. If specified as a config file directive, the prefix is required.

[file=]directory

If the optional prototype argument is given, and it's a directory, mkfs.xfs will populate the root file system with the contents of the given directory tree. Content, timestamps (atime, mtime), attributes and extended attributes are preserved for all file types.

[file=]protofile

If the optional prototype argument is given, and points to a regular file, mkfs.xfs uses it 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 following discussion of the file contents.

```
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 bootfilename.) 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 immaterial since it is ignored.

Line 2 contains two numeric values (formerly the numbers 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 correctly parsed, but their values are immaterial 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 specified 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 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 special 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 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. 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 pathname 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 directory. A scan of the protofile is always terminated with the dollar ( $ ) token.

atime=value

If set to 1, mkfs will copy in access timestamps from the source files. Otherwise, access timestamps will be set to the current time.

slashes_are_spaces=value

If set to 1, slashes ("/") in the first token of each line of the prototype file are converted to spaces. This enables the creation of a filesystem containing filenames 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_section_options are:

rtdev=device

This is used to specify the device which should contain 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 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.

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 volume 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 allocation groups imply that more parallelism can be achieved when allocating blocks. The minimum allocation group size is 2 realtime extents; the maximum size is 2^31 blocks. The rt section of the filesystem 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 suboption. 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 realtime 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 rtgroups than would be created by the default configuration, nor will it create rtgroups smaller than 4GB. This option is not compatible with the rgcount or rgsize 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 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.

zoned=value

Controls if the zoned allocator is used for the realtime device. The value is either 0 to disable the feature, or 1 to enable it. Defaults to 1 for zoned block device, else 0.

start=value

Controls the start of the internal realtime section. Defaults to 0 for 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 used.

reserved=value

Controls the amount of space in the realtime section that is reserved for internal use by garbage collection and reorganization algorithms. Defaults to 0 if not set. This option is only valid if the zoned realtime allocator is used.

-s sector_size_options

Section Name: [sector]

This option specifies the fundamental sector size of the filesystem. 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 information.

-N

Causes the file system parameters to be printed out without really 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.


title: xfs_admin(8)

summary: change parameters of an XFS filesystem

text:
# xfs_admin(8)

## NAME
xfs_admin - change parameters of an XFS filesystem

## SYNOPSIS
xfs_admin [ -eflpu ] [ -O featurelist ] [ -c 0|1 ] [ -L label ] [ -U uuid ] [ -r rtdev ] device [ logdev ]

xfs_admin -V

## DESCRIPTION
xfs_admin uses the xfs_db(8) command to modify various parameters of a filesystem.

Devices that are mounted cannot be modified. Administrators must unmount filesystems before xfs_admin or xfs_db(8) can convert parameters. A number of parameters of a mounted filesystem can be examined and modified using the xfs_growfs(8) command.

The optional logdev parameter specifies the device special file where the filesystem's external log resides. This is required only for filesystems that use an external log. See the mkfs.xfs -l option, and refer to xfs(5) for a detailed description of the XFS log.

## OPTIONS
-e

Enables unwritten extent support on a filesystem that does not already have this enabled (for legacy filesystems, it can't be disabled anymore at mkfs time).

This option only applies to the deprecated V4 format.

-f

Specifies that the filesystem image to be processed is stored in a regular file at device (see the mkfs.xfs -d file option).

-j

Enables version 2 log format (journal format supporting larger log buffers).

This option only applies to the deprecated V4 format.

-l

Print the current filesystem label.

-p

Enable 32bit project identifier support (PROJID32BIT feature).

This option only applies to the deprecated V4 format.

-u

Print the current filesystem UUID (Universally Unique IDentifier).

-c 0|1

Enable (1) or disable (0) lazy-counters in the filesystem.

Lazy-counters may not be disabled on Version 5 superblock filesystems (i.e. those with metadata CRCs enabled).

In other words, this option only applies to the deprecated V4 format.

This operation may take quite a bit of time on large filesystems as the entire filesystem needs to be scanned when this option is changed.

With lazy-counters enabled, the superblock is not modified or logged on every change of the free-space and inode counters. Instead, enough information is kept in other parts of the filesystem to be able to maintain the counter values without needing to keep them in the superblock. This gives significant improvements in performance on some configurations and metadata intensive workloads.

-L label

Set the filesystem label to label. XFS filesystem labels can be at most 12 characters long; if label is longer than 12 characters, xfs_admin will truncate it and print a warning message. The filesystem label can be cleared using the special "--" value for label.

-O feature1=status,feature2=status...

Add or remove features on an existing V5 filesystem. The features should be specified as a comma-separated list. status should be either 0 to disable the feature or 1 to enable the feature. Note, however, that most features cannot be disabled.

NOTE: Administrators must ensure the filesystem is clean by running xfs_repair -n to inspect the filesystem before performing the upgrade. If corruption is found, recovery procedures (e.g. reformat followed by restoration from backup; or running xfs_repair without the -n) must be followed to clean the filesystem.

Supported features are as follows:

inobtcount

Keep a count the number of blocks in each inode btree in the AGI. This reduces mount time by speeding up metadata space reservation calculations. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be writable by older kernels. This feature was added to Linux 5.10.

bigtime

Upgrade a filesystem to support larger timestamps up to the year 2486. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be mountable by older kernels. This feature was added to Linux 5.10.

nrext64

Upgrade a filesystem to support large per-inode extent counters. The maximum data fork extent count will be 2^48 - 1, while the maximum attribute fork extent count will be 2^32 - 1. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be mountable by older kernels. This feature was added to Linux 5.19.

exchange

Upgrade a filesystem to support atomic file content exchanges through the XFS_IOC_EXCHANGE_RANGE ioctl, and to support online repairs of directories, extended attributes, symbolic links, and realtime free space metadata. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be mountable by older kernels.

-U uuid

Set the UUID of the filesystem to uuid. A sample UUID looks like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The uuid may also be nil, which will set the filesystem UUID to the null UUID. The uuid may also be generate, which will generate a new UUID for the filesystem. Note that on CRC-enabled filesystems, this will set an incompatible flag such that older kernels will not be able to mount the filesystem. To remove this incompatible flag, use restore, which will restore the original UUID and remove the incompatible feature flag as needed.

-r rtdev

Specifies the device special file where the filesystem's realtime section resides. Only for those filesystems which use a realtime section.

-V

Prints the version number and exits.

The mount(8) manual entry describes how to mount a filesystem using its label or UUID, rather than its block special device name.

## SEE ALSO
mkfs.xfs(8), mount(8), xfs_db(8), xfs_growfs(8), xfs_repair(8), xfs(5).


title: xfs_bmap(8)

summary: print block mapping for an XFS file

text:
# xfs_bmap(8)

## NAME
xfs_bmap - print block mapping for an XFS file

## SYNOPSIS
xfs_bmap [ -adelpv ] [ -n num_extents ] file

xfs_bmap -V

## DESCRIPTION
xfs_bmap prints the map of disk blocks used by files in an XFS filesystem. The map lists each extent used by the file, as well as regions in the file that do not have any corresponding blocks (holes). Each line of the listings takes the following form:

extent: [startoffset..endoffset]: startblock..endblock

Holes are marked by replacing the startblock..endblock with hole. All the file offsets and disk blocks are in units of 512-byte blocks, no matter what the filesystem's block size is.

## OPTIONS
-a

If this option is specified, information about the file's attribute fork is printed instead of the default data fork.

-e

If this option is used, xfs_bmap obtains all delayed allocation extents, and does not flush dirty pages to disk before querying extent data. With the -v option, the flags column will show which extents have not yet been allocated.

-l

If this option is used, then

<nblocks> blocks

will be appended to each line. nblocks is the length of the extent described on the line in units of 512-byte blocks.

This flag has no effect if the -v option is used.

-n num_extents

If this option is given, xfs_bmap will display at most num_extents extents. In the absence of -n, xfs_bmap will display all extents in the file.

-p

If this option is used, xfs_bmap obtains all unwritten (preallocated) extents that do not contain written data. With the -v option, the flags column will show which extents are preallocated/unwritten.

-v

Shows verbose information. When this flag is specified, additional AG specific information is appended to each line in the following form:

agno (startagoffset..endagoffset) nblocks flags

A second -v option will print out the flags legend.

-V

Prints the version number and exits.

## SEE ALSO
xfs_fsr(8), xfs(5).


title: xfs_copy(8)

summary: copy the contents of an XFS filesystem

text:
# xfs_copy(8)

## NAME
xfs_copy - copy the contents of an XFS filesystem

## SYNOPSIS
xfs_copy [ -bd ] [ -L log ] source target1 [ target2 ... ]

xfs_copy -V

## DESCRIPTION
xfs_copy copies an XFS filesystem to one or more targets in parallel (see xfs(5)). The first (source) argument must be the pathname of the device or file containing the XFS filesystem. The remaining arguments specify one or more target devices or file names. If the pathnames specify devices, a copy of the source XFS filesystem is created on each device. The target can also be the name of a regular file, in which case an image of the source XFS filesystem is created in that file. If the file does not exist, xfs_copy creates the file. The length of the resulting file is equal to the size of the source filesystem. However, if the file is created on an XFS filesystem, the file consumes roughly the amount of space actually used in the source filesystem by the filesystem and the XFS log. The space saving is because xfs_copy seeks over free blocks instead of copying them and the XFS filesystem supports sparse files efficiently.

xfs_copy should only be used to copy unmounted filesystems, read-only mounted filesystems, or frozen filesystems (see xfs_freeze(8)). Otherwise, the generated filesystem(s) would be inconsistent or corrupt.

xfs_copy does not alter the source filesystem in any way. Each new (target) filesystem is identical to the original filesystem except that new filesystems each have a new unique filesystem identifier (UUID). Therefore, if both the old and new filesystems will be used as separate distinct filesystems, xfs_copy or xfsdump(8)/xfsrestore(8) should be used to generate the new filesystem(s) instead of dd(1) or other programs that do block-by-block disk copying.

xfs_copy uses synchronous writes to ensure that write errors are detected.

xfs_copy uses pthreads(7) to perform simultaneous parallel writes. xfs_copy creates one additional thread for each target to be written. All threads die if xfs_copy terminates or aborts.

## OPTIONS
-d

Create a duplicate (true clone) filesystem. This should be done only if the new filesystem will be used as a replacement for the original filesystem (such as in the case of disk replacement).

-b

The buffered option can be used to ensure direct IO is not attempted to any of the target files. This is useful when the filesystem holding the target file does not support direct IO.

-L log

Specifies the location of the log if the default location of /var/tmp/xfs_copy.log.XXXXXX is not desired.

-V

Prints the version number and exits.

## DIAGNOSTICS
xfs_copy reports errors to both stderr and in more detailed form to a generated log file whose name is of the form /var/tmp/xfs_copy.log.XXXXXX or a log file specified by the -L option. If xfs_copy detects a write error on a target, the copy of that one target is aborted and an error message is issued to both stderr and the log file, but the rest of the copies continue. When xfs_copy terminates, all aborted targets are reported to both stderr and the log file.

If all targets abort or if there is an error reading the source filesystem, xfs_copy immediately aborts.

xfs_copy returns an exit code of 0 if all targets are successfully copied and an exit code of 1 if any target fails.

## NOTES
When moving filesystems from one disk to another, if the original filesystem is significantly smaller than the new filesystem, and will be made larger, we recommend that mkfs.xfs(8) and xfsdump(8)/xfsrestore(8) be used instead of using xfs_copy and xfs_growfs(8). The filesystem layout resulting from using xfs_copy/xfs_growfs is almost always worse than the result of using mkfs.xfs/xfsdump/xfsrestore but in the case of small filesystems, the differences can have a significant performance impact. This is due to the way xfs_growfs(8) works, and not due to any shortcoming in xfs_copy itself.

## CAVEATS
xfs_copy does not copy XFS filesystems that have a real-time section or XFS filesystems with external logs. In both cases, xfs_copy aborts with an error message.

## SEE ALSO
mkfs.xfs(8), xfsdump(8), xfsrestore(8), xfs_freeze(8), xfs_growfs(8), xfs(5).