mkfs.xfs   (8) manpage
mkfs.xfs
8
  • NAME
      mkfs.xfs - construct an XFS filesystem
  • SYNOPSIS
      
      <3>mkfs.xfs<1> [ <3>-b<1> subopt=value ] [ <3>-d<1> subopt[=value] ]
      	[ <3>-i<1> subopt=value ] [ <3>-l<1> subopt[=value] ] [ <3>-f<1> ]
      	[ <3>-n<1> subopt[=value] ] [ <3>-p<1> protofile ] [ <3>-q<1> ]
      	[ <3>-r<1> subopt[=value] ] [ <3>-s<1> subopt[=value] ]
      	[ <3>-N<1> ] [ <3>-L<1> label ] device
      
  • 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 <2>mkfs<1> is given the <3>-t xfs<1> 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 10000 block log located on the first partition on the second SCSI disk, use:

      
      	mkfs.xfs -l logdev=/dev/sdb1,size=10000b /dev/sda1
      


      Each of the subopt=value elements in the argument list above can be given as multiple comma-separated subopt=value suboptions if multiple suboptions apply to the same option. Equivalently, each main option can be given multiple times with different suboptions. For example, -l internal,size=10000b and -l internal -l size=10000b are equivalent.

      In the descriptions below, sizes are given in sectors, bytes, blocks, kilobytes, megabytes, or gigabytes. Sizes are treated as hexadecimal if prefixed by 0x or 0X, octal if prefixed by 0, or decimal otherwise. If suffixed with <3>s<1> then the size is converted by multiplying it by the filesystems sector size (defaults to 512, see <3>-s<1> option below). If suffixed with <3>b<1> then the size is converted by multiplying it by the filesystems block size (defaults to 4K, see <3>-b<1> option below). If suffixed with <3>k<1> then the size is converted by multiplying it by 1024. If suffixed with <3>m<1> then the size is converted by multiplying it by one megabyte (1024 * 1024 bytes). If suffixed with <3>g<1> then the size is converted by multiplying it by one gigabyte (1024 * 1024 * 1024 bytes). If suffixed with <3>t<1> then the size is converted by multiplying it by one terabyte (1024 * 1024 * 1024 * 1024 bytes). If suffixed with <3>p<1> then the size is converted by multiplying it by one petabyte (1024 * 1024 * 1024 * 1024 * 1024 bytes). If suffixed with <3>e<1> then the size is converted by multiplying it by one exabyte (1024 * 1024 * 1024 * 1024 * 1024 * 1024 bytes).
      -b
      Block size options. This option specifies the fundamental block size of the filesystem. The valid suboptions are: log= value and <3>size=<1><2>value<1>; only one can be supplied. The block size is specified either as a base two logarithm value with log= , or in bytes with size= . The default value is 4096 bytes (4 KiB), the minimum is 512, and the maximum is 65536 (64 KiB). XFS on Linux currently only supports pagesize or smaller blocks.
      -d
      Data section options. These options specify the location, size, and other parameters of the data section of the filesystem. The valid suboptions are: <3>agcount=<1><2>value<1>, <3>agsize=<1><2>value<1>, <3>file<1>[<3>=<1><2>value<1>], <3>name=<1><2>value<1>, <3>size=<1><2>value<1>, <3>sunit=<1><2>value<1>, <3>swidth=<1><2>value<1>, <3>su=<1><2>value<1>, <3>sw=<1><2>value<1>, and <3>unwritten<1>[<3>=<1><2>value<1>]. The agcount suboption 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 agcount allocation groups (default value is scaled automatically based on the underlying device size). Setting agcount to a very large number should be avoided, since this causes an unreasonable amount of CPU time to be used when the filesystem is close to full. The agsize suboption is an alternative to using agcount. The argument provided to agsize is the desired size of the allocation group expressed in bytes (usually using the <3>m<1> or <3>g<1> 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 suboption and the agsize suboption are mutually exclusive. The name suboption 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. The file suboption is used to specify that the file given by the name suboption is a regular file. The suboption 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. The size suboption 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 sunit suboption is used to specify the stripe unit for a RAID device or a logical volume. The suboption 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. The su suboption 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 suboption value has to be specified in bytes, (usually using the <3>m<1> or <3>g<1> suffixes). This value must be a multiple of the filesystem block size. The swidth suboption is used to specify the stripe width for a RAID device or a striped logical volume. The suboption 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. The sw 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 suboption 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 logical volume device, mkfs.xfs will automatically query the logical volume for appropriate sunit and swidth values. The unwritten suboption is used to specify whether unwritten extents are flagged as such, or not. The suboption value is either 0 or 1, with 1 signifying that unwritten extent flagging should occur. If the suboption is omitted, unwritten extent flagging is enabled. If unwritten extents are flagged, filesystem write performance will be negatively affected for preallocated file extents, since extra filesystem transactions are required to convert extent flags for the range of the file written. This suboption should be disabled if the filesystem needs to be used on operating system versions which do not support the flagging capability.
      -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. 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 suboptions for specifying inode size are: <3>log=<1><2>value<1>, <3>perblock=<1><2>value<1>, and <3>size=<1><2>value<1>; only one can be supplied. The inode size is specified either as a base two logarithm value with log= , in bytes with size= , or as the number fitting in a filesystem block with perblock= . The mininum (and default) value is 256 bytes. The maximum value is 2048 (2 KiB) 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 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 sufficently large, mkfs.xfs will warn if this will create inode numbers > 32 significant bits. The option <3>maxpct=<1><2>value<1> specifies the maximum percentage of space in the filesystem that can be allocated to inodes. The default value is 25%. Setting the value to 0 means that essentially all of the filesystem can become inode blocks. The option align[= value ] 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).
      -l
      Log section options. These options specify the location, size, and other parameters of the log section of the filesystem. The valid suboptions are: internal[= value ], <3>logdev=<1><2>device<1>, <3>size=<1><2>value<1>, <3>version=<1><2>[1|2]<1>, <3>sunit=<1><2>value<1>, and <3>su=<1><2>value<1>. The internal suboption is used to specify that the log section is a piece of the data section instead of being another device or logical volume. The suboption value is either 0 or 1, with 1 signifying that the log is internal. If the value is omitted, 1 is assumed. The logdev suboption is used to specify that the log section should reside on a device separate from the data section.  The suboption value is the name of a block device.  The internal=1 and logdev options are mutually exclusive. The size suboption 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 size is specified in bytes or blocks, with a <3>b<1> 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. Using the version suboption to specify a version 2 log enables the sunit suboption, and allows the logbsize to be increased beyond 32K. Version 2 logs are automatically selected if a log stripe unit is specified.  See <3>sunit<1> and <3>su<1> suboptions, below. The sunit suboption specifies the alignment to be used for log writes. The suboption 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 <3>su<1> suboption is specified. The su suboption is an alternative to using sunit. The su suboption is used to specify the log stripe. The suboption value has to be specified in bytes, (usually using the <3>s<1> or <3>b<1> suffixes). This value must be a multiple of the filesystem block size. Version 2 logs are automatically selected if the log <3>su<1> suboption is specified.
      -n
      Naming options. These options specify the version and size parameters for the naming (directory) area of the filesystem. The valid suboptions are: <3>log=<1><2>value<1>, <3>size=<1><2>value<1>, and <3>version=<1><2>value<1>. The naming (directory) version is 1 or 2, 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. The block size is specified either as a base two logarithm value with log= , or in bytes with 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.
      <3>-p<1> <2>protofile<1>
      If the optional -p protofile argument is given, mkfs.xfs uses protofile as a prototype file and takes its directions from that file. The blocks and inodes specifiers in the protofile are provided for backwards compatibility, but are otherwise unused. The syntax of the protofile is defined by a number of tokens separated by spaces or newlines. Note that the line numbers are not part of the syntax but are meant to help you in the following discussion of the file contents.
      
       .8v
      <7>1       /stand/<1><2>diskboot<1><7>
      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      $<1>
      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 second 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.
      Form 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.
      -q
      Quiet option.
      Normally
      mkfs.xfs
      prints the parameters of the filesystem
      to be constructed;
      the
      -q flag suppresses this.
      -r
      Real-time section options.
      These options specify the location, size, and other parameters of the
      real-time section of the filesystem.
      The valid suboptions are:
      <3>rtdev=<1><2>device<1>,
      <3>extsize=<1><2>value<1>,
      and
      <3>size=<1><2>value<1>.
      The
      rtdev suboption 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.
      The
      extsize suboption is used to specify the size of the blocks in the real-time
      section of the filesystem.
      This size must be a multiple of the filesystem block size.
      The minimum allowed value is the filesystem block size
      or 4 KiB (whichever is larger);
      the default value is the stripe width for striped volumes or 64 KiB for
      non-striped volumes;
      the maximum allowed value is 1 GiB.
      The real-time extent size should be carefully chosen to match the
      parameters of the physical media used.
      The
      size suboption 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.
      -s
      Sector size options.
      This option specifies the fundamental sector size of the filesystem.
      The valid suboptions are:
      log= value and
      <3>size=<1><2>value<1>;
      only one can be supplied.
      The sector size is specified either as a base two logarithm value with
      log= ,
      or in bytes with
      size= .
      The default value 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.
      <3>-L<1> <2>label<1>
      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.
  • SEE ALSO
  • BUGS
      With a prototype file, it is not possible to specify hard links.
Current Users: 38 © 1999-2006 Linux.com.hk PenguinSoft
All trademarks and copyrights on this page are owned by their respective companies. Linux is a trademark of Linus Torvalds.