Thursday, January 27, 2011

ReiserFS on OS/X, a tough nut cracked

For people who do programming work in sealing-wax and string, building the great machinery that handles real work, like Facebook's incredibly adept original implementation of the "Like" button, which has generated traffic possibly greater than any previous initial release of a feature anywhere, and has run almost without fail right out of the gate, everything is done in some derivative of Unix - Linux being the dominant force in the marketplace today.
    For those among us addicted to the beauty of Linux that way, as a set of wonderful small tools that make up a larger machine that can face up to most any challenge thrown at it in a myriad different ways, Macs tend to be irresistible, because they have a sweet, coddling visual grammar that allows the user to simply use it as a tool and drop down to a shell to do intricate invisible work whenever it's called for. So programmers live in Linux and interact on Macs in large numbers.
    The trouble is that when you have a disk that uses a purely Linux file-system, like the most excellent ReiserFS, the Mac is decidedly unfriendly. I have some ReiserFS disks from a recently-defunct server that I would really like to be able to read on my Mac, so I went foraging for solutions some months ago and came up completely empty-handed. There were a few projects out there trying t get Macs to read ext. Sometimes they work, and sometimes not. Here is a solution I just figured out that I think applies to reading most any filesystem on most any operating system, and it's clearly cheating.
    Specifically, to read ReiserFS filesystems on a Mac, here's all you need to do.
   
    1. Install VirtualBox on your Mac.
   
    2. Download & install a Linux distro that supports ReiserFS. I chose Fedora because that is what I run on my servers, warts & all.
    There are 2 pivotal steps, specifically for Fedora on VirtualBox:
   
    3. When installing Fedora, you must modify the installer prompt. The install screen gives clear directions on how to do this, but once you have the installer line in front of you to modify, you will see a line that begins with either "linux" or "vmlinuz" or the like. At the end of this line, to include ReiserFS support in your installation, add the word "reiserfs".
        To do this in the Fedora installation, as soon as you see the first screen prompting for the kind of installation you want to do:
         
        you select the first line, select "Install or upgrade an existing system", press the Tab key to modify the installer line, and add "reiserfs" to the end of it. Here is the line in question:
       
        Add "reiserfs" like so:
         
        Then, proceed with the installation normally.
       
    Once you complete the installation, you need to make one key modification to the configuration of your Linux virtual machine:
   
    4. Scroll down in the main panel of the configuration (the right hand, large window pane), and select USB.
   
   
        Once the Peripheral configuration dialog opens with the USB tab selected, you will see an empty window pane with four USB icons with various symbols overlaid. Select the first one, with the blue circle. You will see a tool-tip dialog that says "Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device." Click on this one, and a new filter will be added.
           
    Once this filter is active, you can start your virtual machine. Here is the disconcerting part. Because this filter allows all USB devices through, any USB device attached to your Mac will become the property of the virtual machine - i.e. the Fedora instance you are running in VirtualBox. Your USB mouse & keyboard will stop working on the Mac, etc.
    However, and by the same token, if you now plug in a ReiserFS disk, it will get mounted by Fedora, and be completely legible and writable.
    Since you can now install VirtualBox guest add-ons, you will also be able to have shared filespace on your Mac native drives, and as well be able to move, copy, or rsync files between them.
   
    That's it. After several months of trying to figure out how to retrieve data from my ReiserFS disks on the Mac, it turns out that just by installing a virtual Fedora machine inside it, it is possible to read and write, restore and back-up anything I want between the Mac and my ReiserFS disks. Happy days.

No comments:

Post a Comment