2024-04-09

VM Storage with XFS for High I/O Operations

The efficiency of virtual machines (VMs) is often constrained by the underlying storage system’s ability to handle high volumes of read and write operations. For Fedora users setting up a VM that will experience intense I/O activities, formatting a disk with the XFS filesystem is a (more) than valid option. Let’s look at the process of preparing a disk with XFS on Fedora, especially tailored for VM storage that anticipates a high number of reads and writes.

XFS

XFS, known for its high performance and scalability, is a 64-bit journaling filesystem. Originally from Silicon Graphics, Inc (SGI) in 1993, it was engineered to support voluminous filesystems and deliver exceptional performance, particularly in environments that require managing large files and facilitating high scalability, all characteristics of VM storage.

XFS for VM Storage with High I/O Demand

1. Good I/O Throughput:

XFS’s architecture is optimised for high throughput, making it suitable for handling numerous simultaneous read and write operations. This is very important for VM environments where disk I/O operations are constant and performance is a known bottleneck.

2. Dynamic Scalability:

The ability to efficiently manage large files and filesystems ensures that VM storage can be scaled dynamically in response to the needs of the system, without compromising on performance.

3. Robust Journaling:

The journaling mechanism of XFS guarantees the integrity of the filesystem in the event of unexpected shutdowns or system crashes, protecting against data corruption during high I/O periods.

4. Advanced Management Features:

XFS includes features such as allocation groups for enhanced disk access, online defragmentation to maintain optimal performance, and online resizing to adjust resources dynamically — all of which are beneficial under heavy I/O load.

Preparing a Disk with XFS on Fedora

Before jumping in on formatting, make sure you back up any existing data on the disk to avoid loss. The following steps will guide you through preparing a disk with XFS for your VM on Fedora.

Step 1: Install XFS Utilities

Begin by installing the XFS utilities on Fedora (if you don’t have them already):

sudo dnf install xfsprogs

Step 2: Choose the Target Disk

Use the lsblk command to list all disks and identify the one intended for formatting:

lsblk

Look for the disk through its size or identifier, like /dev/sdX.

Step 3: Format the Disk

After locating your disk, format it to XFS:

sudo mkfs.xfs /dev/sdX

Replace /dev/sdX with the actual disk path.

Step 4: Mount the Formatted Disk

Create a mount point and mount the formatted disk:

sudo mkdir /mnt/vm_storage
sudo mount /dev/sdX /mnt/vm_storage

Step 5: Ensure Automatic Mount at Boot

To mount the disk automatically upon boot, modify the /etc/fstab file:

  1. Identify your disk’s UUID with blkid.
  2. Append the following line to /etc/fstab, substituting your-disk-uuid with the actual UUID:
UUID=your-disk-uuid /mnt/vm_storage xfs defaults 0 0

You can also read this in the Linux admin guide.