Thursday, March 25, 2010

How-to (Part 2): Full read/write access to ReiserFS in Windows 7

A few years ago I did a good bit of hacking and wrote this article: How-to: Full read/write access to ReiserFS in Windows Server 2008 x64

This St. Patrick's day I was at a bar with a friend of mine from my old Community College days and we were discussion virtualization software.  Yes.  I am that nerdy.  I was bemoaning my usual complaint that VMWare Server 1.x, which I used in the original article since it supported raw disk access, takes an absurdly long time to start a VM on Windows Server 2008, and also Windows 7 (presumably Windows Vista as well).  This startup time is on the order of 6-8 minutes during which the entire system is hung and unusable.  He was curious why I didn't use something like VirtualBox.  I had been under the impression that VirtualBox didn't do this since it wasn't in the GUI or listed as a feature.  However, I was wrong.

My enlightened friend shared with me this manual page. So I finally had some options, it seemed.  It took a few hours of poking but I finally got everything working with VirtualBox and it is absolutely wonderful.

So here is how I did it on Windows 7:
  1. Install VirtualBox as normal.
  2. I copied the .vmdk files I'd used to set this up with VMWare.  If you don't have these files to copy then create a new VM in VirtualBox of the appropriate flavor of linux and do the installation as per the original article.
    1. You will need to support ReiserFS and Samba, make sure your setup includes these.
    2. Create the new .vmdk as per the linked page from the VirtualBox.  You can find the drive # by populating volume properties from the device manager.
  3. In order for the raw disk access to work under Windows 7 you will need to set the compatibility options on C:\Program Files\Sun\VirtualBox\VirtualBox.exe to run it as administrator.
  4. Link the new vmdk first to VirtualBox with the Virtual Media Manager, open the VMM and click "Add" to add the vmdk(s)
  5. Create a new virtual machine of the appropriate flavor of linux. If you copied files from a VMWare installation you will need to add a SATA bus to the VM's storage configuration and add the vmdk's to that controller.  If you installed from scratch in VirtualBox don't do this now, it will only complicate your life.
At this point you should have everything installed and be able to boot your VM, and share your files back to Windows.  The only problem with this is that VirtualBox is geared more to run as a consumer level virtualizer.  If you close the window the machine starts in, the machine will be forced to shut down.  This means that you would need to keep a window open, wasting space in your taskbar, just to access your files.  Fortunately, there's a way around that as well.

  1. Set the options on C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe to run as administrator.
  2. Create a new text file on your desktop, name it "Start VM.vbs"
  3. In the file, paste:



    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run chr(34) & "C:\Program Files\Sun\VirtualBox\VBoxHeadless.exe" & chr(34) & " --startvm VBoxReiser", 0
    Set WshShell = Nothing
  4. Replace VBoxReiser with the name of the VM you created above
  5. Save this file
This is why you need to set VBoxHeadless to run as administrator.  You will be prompted to allow the program to run as admin, but then you will see no further windows.  Your VM will be running in the background without.  Since you've started this headlessly you will not be able to use the standard GUI to shut down the VM later, so you will need to create another VBS or BAT file, executing:
 
VBoxManage controlvm VMNAME acpipowerbutton

This will shut the VM down, assuming it is responding to ACPI signals.
    Any network configurations you had in VMWare should be relatively simple to set back up in VirtualBox.

    I've been running this for a few days now and it is so much better.  I no longer need to dread rebooting because of the horrifying start times from VMWare.  It was fun to do a nice bit of tech stuff out of work.

    --PXA

    No comments: