I’ve been using Ubuntu Linux on my laptop exclusively for about four months now, after having grown accustomed to Windows machines over many years. I jumped in headfirst, figuring that was the only way to actually learn the ins and outs of Linux. So far, its been great, and there are very few things I miss now. I left about a quarter of my laptop’s hard drive partitioned for the Windows 7 install that it came with, and up until this past week I’d booted up Windows at most 4 times… for a conference call on GoToMeeting, to slice a Photoshop file I couldn’t handle in Gimp, and a couple other odds and ends.

But… there are a few times in a web developer’s career that having a Windows machine is a necessity. When you have a client that demands their design work in IE6, for example… I tried everything I could think of in Linux, running Internet Explorer under WINE (kinda worked for me with IE7, but I couldn’t run IE6 at all), trying IETester in PlayOnLinux (pretty much a complete blowout in my experience)… so I finally started looking at using the Windows partition of my hard drive for something other than empty space.

I tried a number of ways to share my work-in-progress between my Linux and Windows partitions, but this is the one which ended up working for me. I found bits and pieces of it various places online, but I didn’t see it put together anywhere, so I’m posting this in case anyone else finds it useful.


Mount your Windows partition in Ubuntu so it can be easily accessed

Found this in a tutorial here. (You may be able to skip this step. I was always able to see my Windows partition from Ubuntu, but I found that it wasn’t always mounted when I was looking for it, and it wasn’t always in the same location. Doing this saved me a bunch of headache.)

I’m not going to try to list all the commands for this step, because a bad /etc/fstab configuration can kinda bork your system. Read the tutorial I linked, and follow it with all the explanations provided. For the sake of moving on, I’m going to assume that, like me, your Windows c drive is now mounted as /windows, and that your WAMP folder on Windows is now accessible at /windows/wamp.

Move your /var/www folder to the Windows partition, and symlink to it

This was counterintuitive for me. I felt like: I spend 95% of my time in Ubuntu, this folder should reside there. Problem is, Linux can read Windows drives, but Windows can’t read Linux drives without a lot of added support, and the software to manage that just isn’t stable or updated. Yes, you can use WinSCP to view and edit the files on your Linux partition, but its not easy or seamless, and that’s what I wanted.

This is what I had to do (based on WAMP vx.x.x.x on Windows and lamp-server on Ubuntu):

cd /var
sudo rsync -axS www/. /windows/wamp/www
sudo mv www www-backup
sudo ln -s /windows/wamp/www www

Move MySql data into Windows partition, and symlink to it:

Slightly more complicated than the previous step, but the same basic principle. You’ll want to find what directory your WAMP install holds the database information in. In my case, it was /windows/wamp/bin/mysql/mysql5.5.16/data.

Then, make sure you have a MySql user set up in WAMP with the same username, password, and permissions as your MySQL user(s) under Ubuntu. I just did this through phpmyadmin on Windows, and it was easy because all my test databases have the same user, granted the same permissions. If you’ve got a more complicated setup, then I’m sure there’s a way to automate this, but since I didn’t do it, I can’t say exactly what it is.

(Bonus round) Share development environment between Linux and Windows

Of course, being able to view your work on Windows is only half the story, if you can’t fix it. Luckily, all the tools I was using on Ubuntu were also available on Windows. So all that remained was to mirror my gVim environment for editing, and make sure my Windows environment had git tools I could use to commit the changes I had made.

Mirroring my vim environment turned out to be pretty easy, just:

  • moving my ~/.vim directory to /windows/Users/{username}/vimfiles and symlinking the old directory to the new, and
  • moving my ~/.vimrc file to /windows/Users/{username}/_vimrc and symlinking the old location to the new one.

So now… all my vim plugins and keymappings are synced between Windows and Linux, and if I come to a point in a project where I need to check my css under IE, or reslice a Photoshop file, I can just restart my machine, boot the other OS, and continue editing right where I left off.

Git, of course, is a platform-independent tool, and the Git Bash which comes with TortoiseGit functions nearly identically to the way git works on Ubuntu. So, with all of these steps, I have a pretty seamless workflow (at least with PHP/MySql projects) between my Ubuntu and Windows partitions, and I’ve eliminated a lot of useless intermediate steps I’ve seen other people recommend (ie using Dropbox to sync folders between your two partitions, or uploading to a remote server, etc). I don’t know if this will help anyone else, but for me (living in a rural area, where my access to the internet is only occasional, and my bandwidth limited) its been a lifesaver. So I’m offering it up in case it helps anyone else…

Leave a Reply