mkfs.xfs

Creating an XFS filesystem can use a partition or the logical device directly.

mkfs.xfs /dev/sda1
mkfs.xfs /dev/sdb

Do a dry-run and see what filesystem attributes it would set:

mkfs.xfs -N /dev/sda1

If the device already has another filesystem, mkfs will stop. You can safely force it to run:

mkfs.xfs -Nf /dev/sda1

Performance

For the sake of clarity (and not making mistakes) when using additional arguments, use mkfs.xfs -d name=/dev/sda syntax when creating filesystems instead of mkfs.xfs /dev/sda

External Log

The journal log can be put on a separate device to improve performance.

mkfs.xfs -d name=/dev/sda -l logdev=/dev/sdb
mount -o logdev=/dev/sdb /dev/sda /mnt/xfs

External Metadata

In addition to having the journal log on a separate device, the metadata and file data can be split up as well.

Create the new XFS filesystem and separate log journal at the same time:

mkfs.xfs -d name=/dev/sda -l logdev=/dev/sdb -r rtdev=/dev/sdc
mount -o logdev=/dev/sdb,rtdev=/dev/sdc /dev/sda /mnt/xfs

Internal Log Block Sizes

In both cases, the logdev option will want a block size. See man mkfs.xfs for syntax, suggestions.

Alternatively, see what mkfs.xfs would use by default, and use that:

mkfs.xfs -Nf -d name=/dev/sda
meta-data=/dev/sda               isize=256    agcount=4, agsize=524288 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=2097152, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mkfs.xfs -d name=/dev/sda -l logdev=/dev/sdb,size=2560b