Jun 21 2009

Reading XFS partition from Windows

Published by perrygeo at 8:09 am under Linux

When I was setting up my linux system a few years ago, I did some research into filesystems and determined that the XFS file system, being particularly proficient in dealing with large files, would be ideal for my home directory. And it was. But the one factor I didn’t consider was portability. Turns out that there is basically no support for XFS in windows.

So how do you access your files from Windows if they are on an XFS partition? I had just shy of 1 TB of data to transfer so using my other linux box and transferring across the network would have taken forever. The solution I came up with is a bit convoluted but it has some real advantages:

1) Install Sun’s VirtualBox.
2) Download an iso for your favorite linux distribution (mine being Ubuntu 9.04)
3) Create a virtual machine from the linux iso
4) Install the VBOxGuestAdditions in the linux virtual machine.
5) Create a Share folder on the windows host and register it with the virtual machine. This will allow you to transfer files from the guest (linux) to the host(windows) You may have to manually mount the drive in the linux guest:

mount -t vboxsf share_name /mnt/share_name

6) Using the windows host cmd line, create a vmdk from the physical drive that your XFS partition resides on. In this case, PhysicalDrive1 corresponds to the second SATA connector. This will allow your guest OS to talk directly with the drive:

cd C:\Program Files\Sun\xVM VirtualBox
VBoxManage.exe internalcommands createrawvmdk
  -filename "C:\Documents and Settings\perry\.VirtualBox\HardDisks\Physical1.vmdk"
  -rawdisk \\.\PhysicalDrive1 -register

Once completed, you should see:

RAW host disk access VMDK file
C:\Documents and Settings\perry\.VirtualBox\HardDisks\Physical1.vmdk created successfully.

7) Make sure to add the physical drive to your list of hard drives in the linux guest options. Restart the linux guest virtual machine and your XFS partition should already be mounted. Now you can begin transfering files between your XFS partition and the shared folder on the windows host.

Whew. Lots of hassle for a simple file transfer, right! But the side benefit is that now you have a fully functional linux virtual machine with a shared folder set up to the windows host. Very useful - even when you must run windows, it helps to have a linux VM standing by!

21 Responses to “Reading XFS partition from Windows”

  1. Brian Wilsonon 22 Jun 2009 at 9:02 am

    You don’t actually say what you are trying to do (other than access files on an XFS partition) before you dive into the convolutions.
    It looks like you dual boot. You might want to say that up front.

    I don’t bother dual booting any more. I just run my Windows XP machine as a guest and run Samba on the (Linux) host. I upgraded my PC to 8 GB and run 64 bit Ubuntu with VMWare Workstation. (I have not tried VirtualBox yet.) Performance on the guest os is just fine and any loss there is more than offset by all the other benefits of virtualizing Windows such as snapshots.

    I have no reason to transfer files into the XP virtual machine, wasting disk space by keeping two copies of everything. My GIS data stays on the Linux server and is visible as a mapped drive on the XP side.

    Going your route with dual boot + a virtual Linux machine you could skip creating your own virtual machine and installing Linux in it by using one of the many virtual machine images floating around, prebuilt. For example, Ubuntu 9.04 http://www.vmware.com/appliances/directory/147323

    You could also simply leave a Linux guest running and sharing the files when you are booted into Windows so that you could avoid the disk copy step; that machine could be very small since all it need to do is act as a Samba file server. Around 128MB to 256MB would work fine. This one is built to use 512
    http://www.vmware.com/appliances/directory/70918

    Brian

  2. perrygeoon 22 Jun 2009 at 9:20 am

    Nope. No dual Boot. Just trying to read an XFS partition from windows. Seeing as how the posts’ title was “Reading XFS partition from Windows”, I think my intent was fairly clear ;-)

    This particular XP machine needed these files on the local hard drive. Period. I found a way to do and thought i should post the details in case anyone else was having the same problem. Jeez.

  3. Laser21on 23 Jun 2009 at 10:16 am

    Cool, I just have the same problem, will try it!

  4. STHon 28 Jun 2009 at 11:22 am

    Just curious - can you write an article explaining why to use XFS when working with large images? (typically orthophotos with files of sizes 0,1 - 1 TB)

  5. perrygeoon 28 Jun 2009 at 6:17 pm

    STH - I think this article covers the advantages of XFS nicely, particularly regarding I/O performance on large files:

    http://www.ibm.com/developerworks/linux/library/l-fs9.html

  6. Frank Giacobbeon 22 Nov 2009 at 5:01 pm

    Wow! This article is perfect. This is exactly what I have been looking to do with an old, dead NAS drive — drive is fine but the NAS hardware is fried. Thanks for the info!

  7. Frank Giacobbeon 25 Nov 2009 at 3:02 pm

    Maybe someone can give me some assistance with this. Let me explain the situation.

    I have XFS (Linux) drive from a Buffalo LinkStation Live 500BG NAS. The NAS has a hardware issue but the drive itself is fine.

    I’ve taken the XFS drive out of the NAS box and installed in my old Windows XP box. So now, the XP box has both my primary drive and the XFS drive installed via SATA cables.

    When I boot up the XP machine, it boots to Windows fine, but I get a message that a primary drive wasn’t found (PhysicalDrive1).

    Anyway, once booted, I start VirtualBox and start a machine using Ubuntu 9.10 ISO off of my first CD drive. I then try to Install GuestAdditions (clicked from the Ubuntu machine. When I do, nothing seems to mappen. I have the VBOxGuestAdditions ISO in my second CD drive.

    I’m also able to set up a share from the Ubuntu machine to my primary NTFS XP drive (Windows C:) Then, following step 6, I tried to create a vmdk to the second SATA. That fails.

    So it looks like both at startup and via CMD in Windows, it can’t see the PhysicalDrive1. Any ideas what I could be doing wrong? Note that I’ve had a local data recovery company verify that the XFS drive does not have an issue.

  8. Frank Giacobbeon 25 Nov 2009 at 3:28 pm

    As a follow up to my last comment, would it work just as well to put the XFS drive into an external HD enclosure and run it via USB instead of SATA? Sorry if these are basic questions…I’m very new to this and just trying to save data recovery costs.

  9. Patrickon 08 Dec 2009 at 8:55 pm

    Hi there,

    Thanks for this detailed tutorial. I’m in a bit of a predicament that I hope can be resolved this way. I have a BuffaloTech NAS media sever recently die on me. As far as I can tell the drives inside the NAS are fine, just the front-end software took a hit. The drives are XFS, so I’m trying to mount them on something else to get the data. I’m running Windows 7 Ultimate (x64). I installed Virtualbox Ubuntu and followed all the instructions above, but when I add the vmdk files to the virtual guest, I can no longer boot the Ubuntu VM, it just hangs. I can see that the drive is there under the settings tab in Vitual Box, but can’t boot.

    Any ideas?

  10. Patrickon 09 Dec 2009 at 5:39 pm

    Well I figured that last part out - My partition was physically mounted on the SATA bus, which if you read the Virtual Box manual you’ll discover that typically SATA defaults to IDE compatibility mode. When I added the drive to VB as IDE it came right up.

    Now I can see the XFS partitions on my drive in Linux using the disk utility, it shows up mounted under Places, but when I try to navigate to it I get the error “Unable to scan DRIVE for media changes - Device not active”

    Is there a way to ‘activate’ the partition?

  11. Patrickon 13 Dec 2009 at 11:14 pm

    Figured out how to mount the partition using a downloadable utility called Mount Manager.

    All is working.

    Thanks again for posting this, it’s a lifesaver.

  12. Wayne K.on 24 Dec 2009 at 11:58 pm

    Perry, great article. I used it as my base guideline for reading XFS partition from Windows. But having only dabbled in Linux, there was a bit of research necessary at some of the steps. Nonetheless, I could not have accomplished it without your article. Many kudos!

    Here is my take on the steps needed to accomplish the task specific to my situation (XP host with Ubuntu guest). I had rearrange the sequence and add some steps in order to get everything to work:

    1) Install Sun’s VirtualBox v3.1.2 (closed source version - not the open source version).
    2) Download an iso for Ubuntu 9.10.
    3) Create a virtual machine in VirtualBox from the linux iso.
    4) Install the VBOxGuestAdditions in the linux virtual machine (32-bit installation of VBoxLinuxAdditions).

    1. In VirtualBox - Devices > Install Guest Additions.
    2. In linux guest - Wait for CD image to appear (or mount image).
    2. In linux guest - Applications > Accessories > Terminal.
    3. cd /media/cdrom
    4. sudo sh VBoxLinuxAdditions-x86.run

    5) Using the windows host cmd line, create a vmdk from the physical drive (in my case it is physical drive 5) that your XFS partition resides on. This will allow your guest OS to talk directly with the drive:

    1. cd “C:\Program Files\Sun\VirtualBox”
    2. VBoxManage.exe internalcommands createrawvmdk -filename “K:\VirtualBox\HardDisks\Physical5.vmdk” -rawdisk \\.\PhysicalDrive5 -register

    Once completed, you should see:

    RAW host disk access VMDK file
    K:\VirtualBox\HardDisks\Physical5.vmdk created successfully.

    6) Shut down linux guest.
    7) Add the physical drive to your list of hard drives in the linux guest options.
    8) Restart the linux guest virtual machine and your XFS partition should already be mounted.
    9) Create a Share folder on the windows host (I named it U_DRIVE which is referenced in the next step).
    10) Mount it in the linux guest.

    1. Applications > Accessories > Terminal.
    2. sudo mount -t vboxsf U_DRIVE /media/windows-share

    Now you can begin transfering files between your XFS partition and the shared folder on the windows host.

  13. Brad Allenon 05 Feb 2010 at 12:32 pm

    This may work cleanly for a single drive XFS filesystem, but what if your NAS was running a 4-drive RAID5 config? I can only assume each drive is not a unique XFS filesystem and that large files would get striped across multiple disks…

  14. ma2on 13 Apr 2010 at 9:21 am

    @ Wayne K.

    that was EXACTLY what i needed! a more detailed tut. thank you x)

  15. Stavy Pon 11 May 2010 at 9:01 am

    Thank you so much - saved my ass big time!

  16. DJon 15 May 2010 at 12:22 pm

    Had the problem with my Lacie ED Mini NAS. It died, but I needed my info off of its XFS partition. I found a program that will do this easily called XFS Explorer. It is small and installs in windows and will read many various file systems including XFS. I just opened the NAS and put the drive into a usb hard drive enclosure, connected to windows computer, and in a minute I was copying my files from the drive to my system. Sure, the program costs money but for me it was worth it to avoid the hassle of the above-mentioned process. Hope this helps someone.

  17. steveon 20 Jun 2010 at 2:05 am

    For Ext2 and Ext3 partitions (sadly not XFS) then there is a Windows utility here:

    http://www.fs-driver.org/download.html

    called Ext2IFS_1_11a.exe

    Steve

  18. Kajikion 30 Jul 2010 at 3:52 am

    Download UFS Explorer for Windows http://www.ufsexplorer.com/

    I just recovered a colleague’s files from a Buffalo Linkstation with this.

  19. Kerenskyon 10 Aug 2010 at 11:25 am

    Hi all, funny to see that there are so many former Buffalo NAS users trying to get to their XFS drives after these *#+** Buffalo NAS went down on them. But to get to the issue:

    I mounted the XFS drive into an external USB enclosure, downloaded UFS Explorer (trial version) and the Explorer cannot find the external drive. The hard disk itself just doesn´t show up in the UFS Explorer! However, it does show up correctly in the windows disk managent. And it works, I can see/hear it spinning.

    Does anyone know why UFS Explorer can´t see the disk? Is the trial version limited to internal hard disks?

    And: this blog entry with the virtual machine step-by-step manual is great, thank yo so much for posting it!!!

    Best wishes!

  20. Scotton 17 Aug 2010 at 10:10 am

    Why go through all of that trouble? Why not just boot to a Ubuntu CD and run it off the CD? You can still access the local hard drive and NTFS write support has been included in Ubuntu since 2007.

  21. perrygeoon 17 Aug 2010 at 10:39 am

    I simply do not trust NTFS support in Linux. I’m sure its gotten better but I have had pretty bad luck with it in the past; severe data loss, file corruption, etc. The data was valuable and I was not about to trust it to a process which has failed catastrophically in the past.

Trackback URI | Comments RSS

Leave a Reply