Sharing your home directory with a VMware Machine
For the last week or so, my experiences with Mac OS X have been mixed – I’ve tried to get it working the way I want it to, but for some things Ubuntu is just better. Unfortunately, Ubuntu on the Mac hardware is pretty messed up right now (and by “pretty messed up” I mean “get ready to compile and edit kernel drivers by hand” messed up). VMware Fusion to the rescue! With the VMware tools installed, it’s mostly usable. However, it’d be awesome if I could share my /home for both Mac OS X and Ubuntu. You could do this trick with any POSIX OS though, I’m gonna try to do it for Windows next.
Disclaimer!
I haven’t tested this that much – just enough to get it to work (I still haven’t restored my data, so I can’t really use it for anything). However, VMware’s Shared Folders feature doesn’t handle locking between host and guest. So if you open a file on both OS X and Ubuntu at the same time, expect fiery death
How to set it up
First, set up your home directory to be shared in VMware – I use the appropriate name “home” here. Then in the guest OS, run these commands (replace ‘paul’ with your username, hint):
sudo groupmod -u `ls -l /mnt/hgfs/home/paul | cut -d ‘ ‘ -f 4 | tail -n 1` paul
# If you use Macports, do this and your .bashrc won’t go crazy
ln -s /usr /opt/local
This is necessary because the number that Mac OS X picked for your username (the UID) is different than the one Ubuntu picked – we set the Ubuntu one to match the Mac. Now, reboot (or do this stuff logged in as root), then open up /etc/rc.local and add the following line:
Some hacks
Because of the locking issue, we have to do one more hack to make GNOME work – KDE users probably don’t need this hack. Open up /etc/gdm/Xsession and add the following section to the top, after the comments:
That’s everything – like I said, I’m gonna work on trying this same trick for C:\Users in Vista using mapped drives and seeing if I can get the same success. It might involve some hackery though.
