How to read an XFS drive on Windows

…with Linux and VirtualBox

If you have an USB drive or an hard disk with a XFS filesystem, you’ll discover that Windows cannot read it. When you plug the drive, you’ll get a not-so-nice popup asking you to format the disk.

That’s because XFS is a file system adopted by Linux, and Windows doesn’t have support for it.

If you’d like to avoid spending money on software that is able to read the XFS file system, you can think about installing any distribution of Linux on your computer.

Here are the steps for doing it with an Ubuntu virtual machine on VirtualBox. We are going to setup the virtual machine and then mount the drive as a VM drive. You may use another Linux distribution, if you’d like to.

The virtual machine

First of all, let’s setup the virtual machine.

  • Download an ISO of Ubuntu 14.05 from the official website
  • Install VirtualBox, if you haven’t done it already
  • Create a new Ubuntu virtual machine with the settings that better suit your physical machine
  • Mount the Ubuntu ISO and install the OS
  • Install VirtualBox Guest Additions
  • In VirtualBox settings, create a new shared folder with the name share, and map it to a folder, whichever you prefer (in my case C:\share). Make sure that the “readonly” checkbox is unchecked
  • Launch the VM and type in the terminal mount -t vboxsf share /home/username/share to make sure the shared folder is mounted in a directory you have access to

Mapping the physycal drive to a virtual disk

Now connect your physical drive with the XFS file system. We are going to mount it as an external drive in the Linux virtual machine, bypassing Windows.

  • On Windows, launch the command prompt with elevated privileges (Win+X on Windows >8, then choose from the list)
  • Type wmic diskdrive list brief and identify from the list the XFS drive. Take note of the DeviceID. It will look something like \\.\PHYSICALDRIVE6
  • Now change directory to “C:\Program Files\Oracle\VirtualBox\”
  • Run this command, making sure that you change the “PhysicalDrive” DeviceID and the path to the file that will be created
    VBoxManage.exe internalcommands createrawvmdk -filename C:\myxfsdrive.vmdk -rawdisk \\.\PhysicalDrive6

Now you have a vmdk file, which is a “Virtual Machine Disk”. It is basically a text file (size =~ 1 KB) that you can open with a text editor, that defines a mapping of a fullDevice between that file and the PhysicalDrive

Mounting the virtual disk

We are now going to mount the disk we’ve just created on the VirtualBox virtual machine, so that we can read the contents from within the Ubuntu system.

  • Go back in the VM settings (shut it down first), in the Storage tab
  • In the tree, click on the second object, the “SATA controller”
  • Click the add disk icon at the right of that row, and select the vmdk file that you’ve created in the previous section
  • Launch the VM again

Transfer your files

In the virtual machine, the new disk will be automatically mounted. Open it and start transferring the files you need from the mounted drive to the mounted share folder, located in /home/username/share

You will then find all the files on Windows in the directory mapped to your share folder.

Yay!

You should now be done, with all your files!

I hope this helped, and if it did, share the article to let anyone know :)

P.S.
I’m not a Linux expert, so let me know if I’ve wrote something wrong I probably don’t know about. Thanks!