Ext4 support in XCP-ng

Features Jan 15, 2019

Ext4 has been around for a while now, but for various reasons, it was never implemented in XenServer for local storage. We fixed that in XCP-ng!

Local SR

Despite the fact that shared SRs are the most common way to store your VMs (mainly because you can migrate a VM without migrating their storage), there is still a lot of use cases for local SRs: fast local SSD, unused local space, only individual hosts, or finally if you have no NFS/iSCSI share available.

When you create a local SR, you have 2 choices:

  • LVM based (thick provisioned)
  • File based (thin provisioned, using `.vhd` files)

Obviously, as soon you use snapshot functionality, a thin provisioned SR is always better (a snapshot on a LVM based SR will double the whole VM disk size!). But local SRs are only available in ext3.

Ext3 limitations

The main problem with ext3 is the ultra slow fsck, and the bigger the filesystem, the longer the check:

Source: Wikipedia

But another limitation is the max filesystem size, which is 16TiB. However, it's more and more common to encounter a disk this large (or a local virtual disk under a local RAID card). And finally, the list of all the other issues with ext3 can be read here.

DIY solutions?

Until now, people usually used some tricks to switch to ext4: after the SR creation, they changed the file system, or modified a line in the driver, but this has a few inherent risks (an upgrade replacing the file for example).

We could also modify the ext3 driver but we didn't want that. What about the behavior in a current ext3 SR? What about upgrades? So many questions, so the best way to go was to create a new available SR type: ext4!

Dedicated ext4 driver

We created a dedicated ext4 driver. This way, people can test it (you can give your feedback here) on a specific disk/RAID array, and play without the risk of converting something that already exists. Obviously, this driver is fully Open Source and available on GitHub.

Right now, this driver is still in the experimental repository: it's tested on our side and everything works (snapshot, delta export…), but before going into production, we'll let it run a bit and get community feedback just in case.

Want to use it now?

You have a disk or a local RAID array where you want to test ext4? Go ahead. In your pool, on each host:

  1. yum install sm-additional-drivers --enablerepo='xcp-ng-updates_testing' (installing the driver)
  2. xe-toolstack-restart (toolstack restart to register the new driver)

Then you can create your SR:

xe sr-create type=ext4 name-label=mySR host-uuid=<host_UUID> device-config:device=/dev/sdX

With sdX as your target disk or RAID array. This will format it and automatically create a new SR where you can store your VMs!

Future

After a while, we'll maybe switch to the ext4 driver as the default during an XCP-ng install for local SRs. This way, the old limitation of ext3 will disappear in the meantime. Also, it will allow users to get the driver without extra packages to install if it's already bundled in the ISO itself!

Tags

Olivier Lambert

Vates CEO & co-founder, Xen Orchestra and XCP-ng project creator. Enthusiast entrepreneur and Open Source advocate. A very happy Finnish Lapphund owner.