Getting Started With XFS RAID 0

XFS is a filesystem that excels in execution of parallel input/output (I/O) operations, and thus focuses on increased performance with scalability. Many benchmarks have shown that traditional EXT4 is better when using a single drive, however XFS will perform better as you add more drives to the filesystem.

Don't forget that RAID 0 is at a block-level, not a file level which is an important subtlety that explains how IOPS (not just bandwidth) can scale up as drives are added

Steps

Create lvm2 physical volume partitions on each of your physical drives. For this I used gparted.

Now run the following commands, ensuring to replace the [x] with the appropriate drive letters and any variables being denoted with $

sudo apt-get install xfsprogs -y
sudo vgcreate $VG_NAME /dev/sd[x]1 /dev/sd[x2]1 ...
lvcreate -i$NUM_DRIVES -I4 -l100%FREE -n$LV_NAME $VG_NAME
sudo mkfs.xfs /dev/$VG_NAME/$LV_NAME

You now have a RAID 0 volume. At this point it is probably a good idea to configure fstab to automatically mount your volume somewhere on boot.


Using Mdadm Instead

When I was initially creating this tutorial, I started with using software raid through mdadm. However, whenever I rebooted my computer, the raid would disappear as if it never existed. Here is how I did it for reference:

Below are the steps I ran to setup on ubuntu 14.04. Please remember to replace[x] and [x2] with the representative letters for specifying your physical drives. You can always find these out by using gparted.

# Install the necessary packages
sudo apt-get install xfsprogs mdadm -y

# Create the RAID 0 array.
mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sd[x] /dev/sd[x2]

# Create the XFS filesystem
sudo mkfs.xfs /dev/md0

No comments:

Post a Comment