search
top

Working With XFS Filesystems on RedHat 7

Introduction

In this post we will cover how to create, mount and manage the XFS filesystem on RedHat/CentOS 7. XFS is one of many filesystems available for use on RedHat / CentOS systems and is the default filesystem for RedHat / CentOS 7. The most commonly used filesystem is ext3/ext4 on RedHat / CentOS.

A Bit about XFS

XFS is a high-performance 64-bit journaling file system. It was introduced in the Linux kernel in 2001, XFS is supported by most Linux distributions. XFS excels in the execution of parallel input/output (I/O) operations due to its design, which is based on allocation groups, because of this, XFS enables extreme scalability of I/O threads, file system bandwidth, and size of files and of the file system itself when spanning multiple physical storage devices. A disadvantage of the XFS file system is that it cannot be shrunk, also metadata operations in have historically been slower than with other file systems, resulting in, for example, poor performance with operations such as deletions of large numbers of files.

Add a Disk and Format

So, lets go through a scenario to add a new volume and format it XFS.

Our new disk is /dev/sdb, create the physical disk by using pvcreate command.

$ sudo pvcreate /dev/sdb

Now we can create the volume group using vgcreate command

$ sudo vgcreate vgapp /dev/sdb

Next we create the logical volume

$ sudo lvcreate -n lvapp -L+9G /dev/vgapp

Format XFS

$ sudo mkfs.xfs /dev/vgapp/lvapp

You can now mount and use the newly created and formatted XFS volume.

Extending XFS filesystem

If while trying to run resizefs you get a bad superblock error you may have an xfs file system  Instead use the xfs_growfs command

$ sudo lvextend -L+1G /dev/vgapp/lvapp

Resize using the xfs_growfs command

$ sudo xfs_growfs /dev/vgapp/lvapp

And now you have extended your XFS filesystem by 1 GB.

Conclusion

As we can see managing XFS on RedHat is a straight forward process, easy to create and extend. There are many other specific XFS commands for other operations available.

Leave a Reply

Your email address will not be published. Required fields are marked *

top