Tuesday, July 29, 2008

How-to: Full read/write access to ReiserFS in Windows Server 2008 x64

Yes, I am fully aware of the ReiserFS IFSD project. However due to the somewhat draconic driver signing requirements of 64 Bit Server 2008 this driver doesn't load. I have heard you can convince it to in 32 bit versions of the OS. There's something about the image hash integrity that prevents it from working. I may try to recompile this in 64 bit but that is a project for another week.

However, it's still possible to gain access to your ReiserFS (and any other linux filesystem you'd like) using free tools in Windows Server 2008. All it takes is some time and a rather twisted hack.

You will need:
  • An installation image file (ISO) for your favorite linux distribution. If you don't know linux that well I'd recommend Ubuntu or Fedora. I used Gentoo, since I knew I could make it a very small installation.
  • VMware Server 1.0.6. VMware Server is free, you need to fill out a web form to request pretty much any number of license keys.

At the end of this article I've provided the kernel configuration file I used for Gentoo as well as my smb.conf.

Start VMware Server, before you install you should reboot. Press F8 before windows loads, and make sure to select "Disable driver signature enforcement". Before some recent patches, this could be set permenantly using bcdedit, but no longer works. It is recommended you suspend your windows installation instead of shutting down to avoid having to do this every time you boot your system.

Connect to localhost and create a new VM, use typical settings. Selecting the type of OS you'll be running is only really useful for VMware tools, which I won't discuss here. Feel free to comment on this. Call it whatever you want.
At the networking screen, for security's sake it's advisable to use NAT or host-only networking. I used NAT.
The next screen is for the size of the virtual hard disk. This doesn't really matter, and should only be as large as absolutely needed for your linux of choice, but really shouldn't need to be much bigger than 6 or 7 gigabytes. My Gentoo installation is about 1.3GB, and could probably be made smaller.
For the CD-ROM drive, if you've burned your installation disk use the physical drive, otherwise select the image file you downloaded earlier.
Finish setting up your VM and start it. With no data on the virtual hard drive, it will boot off the CD. For the sake of the length and scope of this article, I will assume you know how to setup the distribution you selected. When you get to a point where you can, make sure to install the most recent version of Samba you can.

Once your linux VM is installed and working, shut it down.
In the VMware console select the VM and click "Edit virtual machine settings", then click "Add" to add hardware. The 3rd option when adding a drive should be to directly access a physical hard disk, for experts only. Click 'ok'.
The names VMware gives the disks in your system are probably not the most descriptive things in the world, but you select to use Invidual Partitions and click next you can see the partitions and their types that are available on the selected disk. Select your Linux partition(s).
Start your VM again.
Once you are up and running, fdisk -l or the system browser should recognize the new disk.

Open the file /etc/fstab as root in your editor of choice and add a line similar to this:
/dev/sdb1 /mnt/reiser reiserfs user,defaults 0 0
Where /dev/sdb1 is the name of the partion as shown in fdisk -l. Also make sure the directory /mnt/reiser actually exists. If it doesn't, create it (you will likely need to be root).

Now mount /mnt/reiser.

The final piece of this convoluted puzzle is samba, the smb.conf file.
[global]
workgroup = WORKGROUP
netbios name = vmlinux
server string = Samba Server %v
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no
[reiser]
path = /mnt/reiser/
public = yes
writable = yes
browsable = yes
guest ok = yes

Make sure samba is configured to run on startup...in Gentoo this is
rc-update add samba default
in Ubuntu or Fedora you can configure this in the GUI. If your desktop is GNOME, this will be in System>Administration>Services

Either reboot here or start the service /etc/init.d/samba start

Now back in Windows, open the explorer and go to Network. If you are using Aero you will need to hit the 'Alt' key to see the 'Tools' menu. Select 'Tools' and 'Map Network Drive'.
Select whatever drive letter you want, and as a folder use:
\\vmlinux\reiser
Click 'Finish' and you are done! Yay! You can now open your linux partition under windows and have full access to it.

If you left 'Reconnect on logon' checked when you mapped the drive you should edit the virtual machine. In the options tab of the edit dialog, select the Startup/Shutdown setting and from the dropdown box under "On host startup:" select "Power on virtual machine"


Click here for the Gentoo kernel .config file


As a note I wrote this while incredibly hungry, so it might but hard to understand some things. I might be rewriting sections of it to word things better later...if it looks like anyone's coming here and reading this.

--PXA

No comments: