This article mainly talks about how to format / reformat USB flash drive to FAT32, exFAT, NTFS or EXT4 file system in Windows 10/8/7/XP. Formatting a USB drive can repair corrupt partition as well as change file system format, thus we may need to format USB flash drive from time to time.

mkfs.xfs: construct an XFS filesystem

Command to display mkfs.xfs manual in Linux: $ man 8 mkfs.xfs

NAME

mkfs.xfs - construct an XFS filesystem

SYNOPSIS

mkfs.xfs[-bblock_size] [-mglobal_metadata_options] [-ddata_section_options] [-f] [-iinode_options] [-llog_section_options] [-nnaming_options] [-pprotofile] [-q] [-rrealtime_section_options] [-ssector_size] [-Llabel] [-N] [-K]device
mkfs.xfs -V

DESCRIPTION

mkfs.xfsconstructs an XFS filesystem by writing on a specialfile using the values found in the arguments of the command line.It is invoked automatically bymkfs(8)when it is given the-t xfsoption.

In its simplest (and most commonly used form), the size of thefilesystem is determined from the disk driver. As an example, to makea filesystem with an internal log on the first partition on the firstSCSI disk, use:

OPTIONS

-b block_size_options
This option specifies the fundamental block size of the filesystem.The validblock_size_optionsare:log=valueorsize=valueand only one can be supplied.The block size is specified either as a base two logarithm value withlog=,or in bytes withsize=.The default value is 4096 bytes (4 KiB), the minimum is 512, and themaximum is 65536 (64 KiB).
To specify any options on the command line in units of filesystem blocks, thisoption must be specified first so that the filesystem block size isapplied consistently to all options.
Althoughmkfs.xfswill 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
These options specify metadata format options that either apply to the entirefilesystem or aren't easily characterised by a specific functionality group. Thevalidglobal_metadata_optionsare:
crc=value
This is used to create a filesystem which maintains and checks CRC informationin 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 formatchanges also improves crash recovery algorithms and the ability of various toolsto validate and repair metadata corruptions when they are found. The CRCalgorithm used is CRC32c, so the overhead is dependent on CPU architecture assome CPUs have hardware acceleration of this algorithm. Typically the overheadof calculating and checking the CRCs is not noticeable in normal operation.
By default,mkfs.xfswill enable metadata CRCs.
finobt=value
This option enables the use of a separate free inode btree index in eachallocation group. The value is either 0 to disable the feature, or 1 to createa free inode btree in each allocation group.
The free inode btree mirrors the existing allocated inode btree index whichindexes both used and free inodes. The free inode btree does not index usedinodes, allowing faster, more consistent inode allocation performance asfilesystems age.
By default,mkfs.xfswill create free inode btrees for filesystems created with the (default)-m crc=1option set. When the option-m crc=0is used, the free inode btree 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 eachallocation group. The value is either 0 to disable the feature, or 1 tocreate the btree.
The reverse mapping btree maps filesystem blocks to the owner of thefilesystem block. Most of the mappings will be to an inode number and anoffset, though there will also be mappings to filesystem metadata. Thissecondary metadata can be used to validate the primary metadata or topinpoint exactly which data has been lost when a disk error occurs.
By default,mkfs.xfswill not create reverse mapping btrees. This feature is only availablefor filesystems created with the (default)-m crc=1option set. When the option-m crc=0is 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 eachallocation group. The value is either 0 to disable the feature, or 1 to createa reference count btree in each allocation group.
The reference count btree enables the sharing of physical extents betweenthe data forks of different files, which is commonly known as 'reflink'.Unlike traditional Unix filesystems which assume that every inode andlogical block pair map to a unique physical block, a reflink-capableXFS filesystem removes the uniqueness requirement, allowing up to fourbillion 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 writewill be redirected to a new block, and that file's logical-to-physicalmapping will be changed to the new block ('copy on write'). This featureenables the creation of per-file snapshots and deduplication. It is onlyavailable for the data forks of regular files.
By default,mkfs.xfswill not create reference count btrees and therefore will not enable thereflink feature. This feature is only available for filesystems created withthe (default)-m crc=1option set. When the option-m crc=0is used, the reference count btree feature is not supported and reflink isdisabled.
-d data_section_options
These options specify the location, size, and other parameters of thedata section of the filesystem. The validdata_section_optionsare:
agcount=value
This is used to specify the number of allocation groups. The data sectionof the filesystem is divided into allocation groups to improve theperformance of XFS. More allocation groups imply that more parallelismcan be achieved when allocating blocks and inodes. The minimumallocation group size is 16 MiB; the maximum size is just under 1 TiB.The data section of the filesystem is divided intovalueallocation groups (default value is scaled automatically basedon the underlying device size).
agsize=value
This is an alternative to using theagcountsuboption. Thevalueis the desired size of the allocation group expressed in bytes(usually using them or gsuffixes).This value must be a multiple of the filesystem block size, andmust be at least 16MiB, and no more than 1TiB, and maybe automatically adjusted to properly align with the stripe geometry.Theagcountandagsizesuboptions are mutually exclusive.
name=value
This can be used to specify the name of the special file containingthe filesystem. In this case, the log section must be specified asinternal(with a size, see the-loption below) and there can be no real-time section.
file[=value]
This is used to specify that the file given by thenamesuboption is a regular file. Thevalueis either 0 or 1, with 1 signifying that the file is regular. Thissuboption is used only to make a filesystem image. If thevalueis omitted then 1 is assumed.
size=value
This is used to specify the size of the data section. This suboptionis required if-d file[=1]is given. Otherwise, it is only needed if the filesystem should occupyless space than the size of the special file.
sunit=value
This is used to specify the stripe unit for a RAID device or alogical volume. Thevaluehas to be specified in 512-byte block units. Use thesusuboption to specify the stripe unit size in bytes. This suboptionensures that data allocations will be stripe unit aligned when thecurrent end of file is being extended and the file size is largerthan 512KiB. Also inode allocations and the internal log will bestripe unit aligned.
su=value
This is an alternative to usingsunit.Thesusuboption is used to specify the stripe unit for a RAID device or astriped logical volume. Thevaluehas to be specified in bytes, (usually using them or gsuffixes). Thisvaluemust be a multiple of the filesystem block size.
swidth=value
This is used to specify the stripe width for a RAID device or astriped logical volume. Thevaluehas to be specified in 512-byte block 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
suboption is an alternative to usingswidth.Theswsuboption is used to specify the stripe width for a RAID device orstriped logical volume. Thevalueis expressed as a multiplier of the stripe unit,usually the same as the number of stripe members in the logicalvolume configuration, or data disks in a RAID device.
When a filesystem is created on a logical volume device,mkfs.xfswill automatically query the logical volume for appropriatesunitandswidthvalues.
noalign
This option disables automatic geometry detection and creates the filesystemwithout stripe geometry alignment even if the underlying storage device providesthis information.
-f
Force overwrite when an existing filesystem is detected on the device.By default,mkfs.xfswill not write to the device if it suspects that there is a filesystemor partition table on the device already.
-i inode_options
This option specifies the inode size of the filesystem, and otherinode 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 validinode_optionsare:
size=value | log=value | perblock=value
The inode size is specified either as avaluein bytes withsize=,a base two logarithmvaluewithlog=,or as the number fitting in a filesystem block withperblock=.The minimum (and default)valueis 256 bytes without crc, 512 bytes with crc enabled.The maximumvalueis 2048 (2 KiB) subject to the restriction thatthe inode size cannot exceed one half of the filesystem block size.
XFS uses 64-bit inode numbers internally; however, the number ofsignificant bits in an inode numberis affected by filesystem geometry. Inpractice, filesystem size and inode size are the predominant factors.The Linux kernel (on 32 bit hardware platforms) and most applicationscannot currently handle inode numbers greater than 32 significant bits,so if no inode size is given on the command line,mkfs.xfswill attempt to choose a sizesuch that inode numbers will be < 32 bits. If an inode sizeis specified, or if a filesystem is sufficiently large,mkfs.xfswill warn if this will create inode numbers > 32 significantbits.
maxpct=value
This specifies the maximum percentage of space in the filesystem thatcan be allocated to inodes. The defaultvalueis 25% for filesystems under 1TB, 5% for filesystems under 50TB and 1%for filesystems over 50TB.
In the default inode allocation mode, inode blocks are chosen suchthat inode numbers will not exceed 32 bits, which restricts the inodeblocks to the lower portion of the filesystem. The data blockallocator will avoid these low blocks to accommodate the specifiedmaxpct, so a high value may result in a filesystem with nothing butinodes in a significant portion of the lower blocks of the filesystem.(This restriction is not present when the filesystem is mounted withtheinode64option on 64-bit platforms).
Setting the value to 0 means that essentially all of the filesystemcan become inode blocks, subject to inode32 restrictions.
This value can be modified withxfs_growfs(8).
align[=value]
This is used to specify that inode allocation is or is not aligned. Thevalueis either 0 or 1, with 1 signifying that inodes are allocated aligned.If thevalueis 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 thefilesystem needs to be mountable by a version of IRIXthat does not have the inode alignment feature(any release of IRIX before 6.2, and IRIX 6.2 without XFS patches).
attr=value
This is used to specify the version of extended attribute inlineallocation policy to be used. By default, this is 2, which uses anefficient algorithm for managing the available inline inode spacebetween attribute and extent data.
The previous version 1, which has fixed regions for attribute andextent data, is kept for backwards compatibility with kernels olderthan version 2.6.16.
projid32bit[=value]
This is used to enable 32bit quota project identifiers. Thevalueis either 0 or 1, with 1 signifying that 32bit projid are to be enabled.If the value is omitted, 1 is assumed. (This default changedin release version 3.2.0.)
sparse[=value]
Enable sparse inode chunk allocation. Thevalueis either 0 or 1, with 1 signifying that sparse allocation is enabled.If the value is omitted, 1 is assumed. Sparse inode allocation isdisabled by default. This feature is only available for filesystemsformatted with-m crc=1.
When enabled, sparse inode allocation allows the filesystem to allocatesmaller than the standard 64-inode chunk when free space is severelylimited. This feature is useful for filesystems that might fragment freespace over time such that no free extents are large enough toaccommodate a chunk of 64 inodes. Without this feature enabled, inodeallocations can fail with out of space errors under severe fragmentedfree space conditions.
-l log_section_options
These options specify the location, size, and other parameters of thelog section of the filesystem. The validlog_section_optionsare:
internal[=value]
This is used to specify that the log section is a piece of the datasection instead of being another device or logical volume. Thevalueis either 0 or 1, with 1 signifying that the log is internal. If thevalueis omitted, 1 is assumed.
logdev=device
This is used to specify that the log section should reside on thedeviceseparate from the data section. Theinternal=1andlogdevoptions 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 andsizeisn't specified,mkfs.xfswill try to select a suitable log size dependingon the size of the filesystem. The actual logsize depends on thefilesystem block size and the directory block size.
Otherwise, thesizesuboption is only needed if the log section of the filesystemshould occupy less space than the size of the special file. Thevalueis specified in bytes or blocks, with absuffix meaning multiplication by the filesystem block size, asdescribed 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.
version=value
This specifies the version of the log. The current default is 2,which allows for larger log buffer sizes, as well as supportingstripe-aligned log writes (see the sunit and su options, below).
The previous version 1, which is limited to 32k log buffers and doesnot support stripe-aligned writes, is kept for backwards compatibilitywith very old 2.4 kernels.
sunit=value
This specifies the alignment to be used for log writes. Thevaluehas to be specified in 512-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 configurationssuch as software RAID5 when thesunitis specified as the filesystem block size.The equivalent byte value must be a multiple of the filesystem blocksize. Version 2 logs are automatically selected if the logsunitsuboption is specified.
Thesusuboption is an alternative to usingsunit.
su=value
This is used to specify the log stripe. Thevaluehas to be specified in bytes, (usually using thes or bsuffixes). 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 countersin the superblock. Under metadata intensive workloads, thesecounters are updated and logged frequently enough that the superblockupdates become a serialization point in the filesystem. Thevaluecan be either 0 or 1.
Withlazy-count=1,the superblock is not modified or logged on every change of thepersistent counters. Instead, enough information is kept inother parts of the filesystem to be able to maintain the persistentcounter values without needed to keep them in the superblock.This gives significant improvements in performance on some configurations.The defaultvalueis 1 (on) so you must specifylazy-count=0if you want to disable this feature for older kernels which don't supportit.
-n naming_options
These options specify the version and size parameters for the naming(directory) area of the filesystem. The validnaming_optionsare:
size=value | log=value
The block size is specified either as avaluein bytes withsize=,or as a base two logarithmvaluewith log=.The block size must be a power of 2 and cannot be less than thefilesystem block size.The default sizevaluefor version 2 directories is 4096 bytes (4 KiB),unless the filesystem block size is larger than 4096,in which case the defaultvalueis the filesystem block size.For version 1 directories the block size is the same as thefilesystem block size.
version=value
The naming (directory) versionvaluecan be either 2 or 'ci', defaulting to 2 if unspecified.With version 2 directories, the directory block size can beany power of 2 size from the filesystem block size up to 65536.
Theversion=cioption enables ASCII only case-insensitive filename lookup and version2 directories. Filenames are case-preserving, that is, the namesare stored in directories using the case they were created with.
Note: Version 1 directories are not supported.
ftype=value
This feature allows the inode type to be stored in the directorystructure so that thereaddir(3)andgetdents(2)do not need to look up the inode to determine the inode type.

Thevalueis either 0 or 1, with 1 signifying that filetype informationwill be stored in the directory structure. The default value is 1.

When CRCs are enabled (the default), the ftype functionality is alwaysenabled, and cannot be turned off.

-p protofile
If the optional-p protofileargument is given,mkfs.xfsusesprotofileas a prototype file and takes its directions from that file.The blocks and inodes specifiers in theprotofileare provided for backwards compatibility, but are otherwise unused.The syntax of the protofile is defined by a number of tokens separatedby spaces or newlines. Note that the line numbers are not part of thesyntax but are meant to help you in the following discussion of the filecontents.
Line 1 is a dummy string.(It was formerly the bootfilename.)It is present for backwardcompatibility; boot blocks are not used on SGI systems.
Note that some string of characters must be present as the first line ofthe proto file to cause it to be parsed correctly; the valueof 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 mustappear 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 toinclude in this filesystem. Line 3 defines theroot directory. Other directories andfiles that you want in the filesystemare indicated by lines 4 through 6 andlines 8 through 10. Line 11 containssymbolic link syntax.
Notice the dollar sign($)syntax on line 7. This syntax directs themkfs.xfscommand to terminate the branch of the filesystem itis currently on and then continuefrom the directory specified bythe next line, in this case line 8.It must be the last characteron a line.The colonon line 12 introduces a comment; all characters up until thefollowing newline are ignored.Note that this means you cannothave a file in a prototype file whose name contains a colon.The$on lines 13 and 14 end the process, since no additionalspecifications follow.

Xfs Format Windows

File specifications provide the following:

* file mode
* user ID
* group ID
* the file's beginning contents
A 6-character string defines the mode fora file. The first character of this stringdefines the file type. The character rangefor this first character is-bcdpl.A file may be a regular file, a block special file,a character special file, directory files, namedpipes (first-in, first out files), and symboliclinks.The second character of the mode string isused to specify setuserID mode, in which caseit isu.If setuserID mode is not specified, the second character is-.The third character of the mode string isused to specify the setgroupID mode, in whichcase it isg.If setgroupID mode is not specified, the third character is-.The remaining characters of the mode string area three digit octal number. This octal numberdefines the owner, group, and other read, write,and execute permissions for the file, respectively.For more information on file permissions, see thechmod(1)command.
Following the mode character string are twodecimal number tokens that specify the user and group IDsof the file's owner.

Format Ext4 Windows 10

In a regular file, the next token specifies thepathname from which the contents and size of thefile are copied.In a block or character special file, the next tokenare two decimal numbers that specify the major and minordevice numbers.When a file is a symbolic link, the next tokenspecifies the contents of the link.

When the file is a directory, themkfs.xfscommand creates the entriesdot(.) anddot-dot(..) and then reads the list of names and file specificationsin a recursive manner for all of the entriesin the directory. A scan of the protofile isalways terminated with the dollar ($) token.

-q
Quiet option. Normallymkfs.xfsprints the parameters of the filesystemto be constructed;the-qflag suppresses this.
-r realtime_section_options
These options specify the location, size, and other parameters of thereal-time section of the filesystem. The validrealtime_section_optionsare:
rtdev=device
This is used to specify thedevicewhich 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-timesection of the filesystem. Thisvaluemust be a multiple of the filesystem block size. The minimum allowedsize is the filesystem block size or 4 KiB (whichever is larger); thedefault size is the stripe width for striped volumes or 64 KiB fornon-striped volumes; the maximum allowed size is 1 GiB. The real-timeextent size should be carefully chosen to match the parameters of thephysical 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 thefilesystem should occupy less space than the size of the partitionor logical volume containing the section.
noalign
This option disables stripe size detection, enforcing a realtime device with nostripe geometry.
-s sector_size
This option specifies the fundamental sector size of the filesystem.Thesector_sizeis specified either as a value in bytes withsize=valueor as a base two logarithm value withlog=value.The defaultsector_sizeis 512 bytes. The minimum value for sector size is512; the maximum is 32768 (32 KiB). Thesector_sizemust be a power of 2 size and cannot be made larger than thefilesystem block size.
To specify any options on the command line in units of sectors, thisoption must be specified first so that the sector size isapplied consistently to all options.
-L label
Set the filesystemlabel.XFS filesystem labels can be at most 12 characters long; iflabelis longer than 12 characters,mkfs.xfswill not proceed with creating the filesystem. Refer to themount(8) and xfs_admin(8)manual entries for additional information.
-N
Causes the file system parameters to be printed out without reallycreating the file system.
-K
Do not attempt to discard blocks at mkfs time.
-V
Prints the version number and exits.

BUGS

With a prototype file, it is not possible to specify hard links.

SEE ALSO

xfs(5),mkfs(8),mount(8),xfs_info(8),xfs_admin

Xfs Format Windows 10

(8).

Pages related to mkfs.xfs

  • mkfs.bfs (8) - make an SCO bfs filesystem
  • mkfs.btrfs (8) - create a btrfs filesystem
  • mkfs.cramfs (8) - make compressed ROM file system
  • mkfs.exfat (8) - create an exFAT file system
  • mkfs.ext2 (8) - create an ext2/ext3/ext4 filesystem
  • mkfs.ext3 (8) - create an ext2/ext3/ext4 filesystem
  • mkfs.ext4 (8) - create an ext2/ext3/ext4 filesystem
  • mkfs.ext4dev (8) - create an ext2/ext3/ext4 filesystem
  • mkfs.fat (8) - create an MS-DOS filesystem under Linux
Linux man pages generated by: SysTutorials. Linux Man Pages Copyright Respective Owners. Site Copyright © SysTutorials. All Rights Reserved.