Read and write XFS, ReiserFS, ext3, ext4, btrfs or any other linux filesystem from Windows
This thread belongs to

2011-03-17 10:27 GMT   |   #1

Comments: 42
I was looking for a way to have at least read access to my XFS filesystem from windows, and I found this article:
This is a pretty good solution but you are confined inside the virtual machine, with a few modifications it can be made perfect:
  1. Install Virtualbox. I currently have version 4.0.4
  2. If you run Windows7 then right-click on your virtualbox shortcut, select Preferences/Compatibility, check Run as Administrator. This will trigger the UAC every time you start Virtualbox. (Which is pretty stupid if you ask me, it should trigger the UAC only when you set the privilege, but whatever...)
  3. Download and install your favourite linux. If you have no preference I recommend the latest Ubuntu LTS server edition. There is no need for a desktop environment, it just makes things slower. Install nothing but a samba (smb) server, not even the guest additions are necessary.
  4. Using VBoxManage create a VMDK file from you hard disk. The syntax of that command changes from time to time, currently you should do like this:
    • start a command prompt as administrator (for example in win 7 pop up the start menu, type cmd in the search box, it will find the command prompt, right click, run as admin)
    • drag the VBoxManage.exe file from an explorer window so you won't have to type the full path yourself
    • add the necessary paramters, currently they are: internalcommands createrawvmdk -filename "C:\some path\some file.vmdk" -rawdisk \\.\PhysicalDrive0
    • for older versions you may also need to add the following parameter: -register
    • press enter to run the command
  5. Attach the vmdk to your virtual machine's SATA controller from the virtual machine settings/Storage/Storage Tree
  6. On the Network settings change the "Attached to" setting to: "Bridged Adapter" and select one of your network interfaces a line below
  7. Boot up linux on your virtual machine and mount your XFS (or whatever) partition, you probably want to put it in /etc/fstab for example like this:
    /dev/sdb2 /media/myshare xfs noatime,nodiratime,logbufs=8,logbsize=256k 0 0
    I BEG YOU do not mount a partition that is already in use by windows, or you will mess up your partition.
  8. Reconfigure your linux's ethernet interface. It should be configured in the same way as your windows network interface but with a different IP. If you have a DHCP server and it is unable to give you two different IPs then configure your linux's eth0 to a static address outside your DHCP's range.
  9. Create a samba user:
    smbpasswd -a your_windows_username
    I recommend you to use the same user/pass as your windows account however it is not a criteria, because you can log in from your windows machine with different credentials
  10. Add a samba share to your XFS partition like this (then restart samba):
    comment = myShare
    writable = yes
    path = /media/myshare
  11. On your windows start an explorer, click on map network drive, select the linux share and there you go. You have full access to you XFS partition just like a normal hard disk. Uncheck the reconnect at logon, because it will not work anyway, it will just make your next login slower.
Just one final note: this works beautifully as long as you have something plugged in in your ethernet card even if it is just a switch. As soon as your network interface's link is down you won't be able to access your linux, because Windows 7 thinks that you are not connected to any networks. HOW STUPID IS THAT! But hey, Bill Gates knows better than you...
Maybe I'm just used to work differently. You see I hardly ever use windows, I use Linux for may everyday activities, and if you find something as stupid as this, chances are that someone already found it and at least there is a workaround. If not you can always file a bug report and people will respond to it.

So there you go, you have just wasted about 1.3GB hard disk space but that's a small sacrifice for having a fully accessible XFS partition. And if you install a minimal linux with nothing but an smb server, Virtualbox will be pretty lightweight, you can just leave it to run in the background.