XFS is one of the fastest filesystems around, especially in combination with RAID volumes. But, this comes with a cost: you’ll need at least 1 GB of memory in your virtual machine if you want to use XFS. And if you want to be able to repair the filesystem, you’ll need at least 2 GB of memory.
Another nice feature of XFS is that you can quiesce the traffic to the filesystem to create consistent backups off, for instance, a database server.
The most important utilities are:
- mkfs.xfs: Format the filesystem
- xfs_admin: Change the parameters of the filesystem
- xfs_growfs: Decrease the size of the filesystem
- xfs_repair: Check and repair the filesystem
- xfs_freeze: Suspend access to an XFS filesystem; this makes consistent backups easier
- xfs_copy: Fast copy the contents of an XFS filesystem
To create an XFS filesystem, use:
$ sudo mkfs.xfs -L [label] [partition]
The label is optional but makes it easier to recognize a filesystem.
If you get the below error while running the mkfs.xfs command:
mkfs.xfs: command not found
you may try installing the below package as per your choice of distribution.
|Debian||apt-get install xfsprogs|
|Ubuntu||apt-get install xfsprogs|
|Alpine||apk add xfsprogs|
|Arch Linux||pacman -S xfsprogs|
|Kali Linux||apt-get install xfsprogs|
|CentOS||yum install xfsprogs|
|Fedora||dnf install xfsprogs|
|Raspbian||apt-get install xfsprogs|
Resizing XFS filesystem
XFS should be treated differently from a comparable ext3- or ext4-based system. However, if you need to extend the filesystem, then you will be happy to know that XFS comes complete with a standard tool known as xfs_growfs that can be used in the following way:
# xfs_growfs -d /mount/point
Assuming that you have reviewed the man pages, it would be obvious to state that your syntax would use the -d option to grow the filesystem to the maximum size supported by the device.
Running repairs on XFS
XFS was created to support extremely large filesystems. It performs incredibly well under a heavy load and scales with large files, but as a result, it is also susceptible to damage, and it is with this in mind that we now consider a set of tools that will enable us to troubleshoot the server and restore the filesystem.
Known as xfs_repair, this tool is used to confirm filesystem consistency and repair any problems that are found. This process will not restore lost data but should restore the filesystem on the device in question.
The basic syntax used by xfs_repair is as follows:
# xfs_repair /mount/point
However, to avoid any error messages, the procedure will require you to initially umount the device in question. In this respect, the entire procedure will be as follows:
# umount /mount/point # xfs_repair /mount/point