Thursday, December 2, 2010

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

By Whitson Gordon

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCsWe're platform agnostic at Lifehacker, which is why we love dual- and triple-booting our computers. Unfortunately sharing data between operating systems can be a huge headache. Here's how to stay organized by keeping it all in one place.

There's nothing more annoying than booting into OS X only to realize you need access to some files on your un-readable Linux partition; or Windows; or any combination thereof. The more operating systems we put on one computer, the more our data can get scattered around different partitions that we can't read or write from other OSes. With the right drivers and a bit of organization, though, you can keep all your data in one central location, and read and write that data from any OS under the sun.

Of course, not everyone triple-boots their system, so I've divided this guide into easily scannable sections, so you can skip right to the sections that apply to your machine (i.e., if you don't have OS X, you won't need to know how to read HFS volumes, nor will you need any drivers for OS X).

Part One: Sharing Drives Between Operating Systems

One of the biggest roadblocks to making your data available through each OS are all the different filesystems each one uses. OS X uses HFS+ and can't write to NTFS drives; Windows uses NTFS and ignores pretty much everything else, and Linux has support for nearly everything (albeit with some serious hassle caused by stingy UNIX permissions). Thus, before you do anything else, you'll need to install the correct drivers in each OS for reading and writing to other filesystems. Here are the best choices we've found in each situation.

Note: while it's very likely that your OS X partition is HFS+ and your Windows partition is NTFS, your Linux partition could be any number of filesystems. Unfortunately, Ext4 (which is becoming the new standard) still isn't supported in most third-party Ext drivers. For the most part, the drivers in this guide will work with Ext3 and Ext2 formatted Linux drives only. If your drive is Ext4, you may have to clone your Linux partition, using an Ext3-formatted drive as the destination.

Accessing Mac and Linux Drives in Windows

Reading and writing to Linux drives is easy in Windows, but there aren't any free, read/write drivers for Windows, so you'll have to compromise somewhere. Here are your options.

For Mac Volumes

To install the Boot Camp drivers, just insert the Snow Leopard install disc into your Mac and install the drivers when prompted. If you're on a Hackintosh, you won't get this option, since the disc won't recognize your computer as a Mac. To install the HFS drivers on a Hackintosh, you can use this installer instead.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

Unfortunately, these drives are read-only. If you absolutely have to write to your HFS partition, the only way to do so is to spring for either Paragon's $40 HFS+ for Windows 8 or Mediafour's $50 MacDrive 8. It isn't cheap, but sadly it's the only read/write option currently available.

For Linux Volumes

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs
Luckily, there is a relatively pain-free Ext2/Ext3 driver for Windows called Ext2Fsd. Just download it and install it like a normal Windows program. When you get to the "Select Additional Tasks" stage, check all the necessary boxes for your setup (I chose to check all three). Once you're done, however, you'll get this error message:

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

To fix it, navigate to Ext2Fsd's install location (C:\Program Files\Ext2Fsd by default), right click on Ext2Mgr,exe, hit Properties, and check the "Run as Administrator" box under Compatibility. Then, double click on it to set up your drive. Double click on your Ext3 drive, click the Mount Points button, hit Add, and select a drive letter for your drive. I chose to create a permanent mount point for the drive so it's always mounted. You can choose whatever you want at this stage. Once you're done, you should be able to browse your Linux drive from Windows Explorer just as you would any other drive.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

Accessing Windows and Linux Drives in Mac OS X

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

With the free, open-source utility MacFuse, you can enable support for Windows and Linux drives very easily in OS X. All it takes is a few simple installer packages. Before you install the drivers themselves, you'll need to install MacFuse. Then, install either (or both) of the drivers below depending on your needs.

For Windows Volumes

While Mac OS X can read NTFS partitions out of the box, you can't actually write to them. If you need both read and write support, you can install the NTFS-3G driver after installing MacFuse. Just head over to their homepage, download the software, and double-click on the package to install. When prompted, I chose to use UBLIO caching during the installation process, since my NTFS partition is on an internal drive and is unlikely to be unintentionally disconnected. When you reboot, you should have full write support.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

Note that their homepage is a bit confusing—the people who work on NTFS-3G also develop a driver called Tuxera NTFS for Mac, which is not what you want (unless you feel like paying $30 for slightly better performance, in which case go for it). Make sure you're downloading "NTFS-3G for Mac OS X" before you install. You may have to scroll down the blog to find a post containing the latest download. It isn't the most well-organized homepage.

For Linux Volumes

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs
To get Ext3 and Ext2 support in OS X, just download the Fuse-ext2 driver from this Sourceforge page and install the package. When you reboot, you should have read access to your Linux drive.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCsWhile the drive does support reading and writing, it's set as read-only by default. You can enable it by tweaking a configuration file, but I will note that while many have had success with this method in Snow Leopard, it keeps throwing me an error when I try to write to the drive, so your mileage may vary. To make OS X mount the drive as read/write, just navigate to /System/Library/Filesystems/. Right-click on the fuse-ext2.fs file and hit "Show Package Contents." Then, drag fuse-ext2.util to the desktop, right-click on it, and hit "Open With", choosing TextEdit when prompted.

Use Cmd+F to find the line that says OPTIONS="auto_xattr,defer_permissions" near the middle of the file. Add ,rw+ to that line inside the quotes, so it reads:

 OPTIONS=auto_xattr,defer_permissions,rw+" 

When you reboot, the drive should be mounted as read/write. Note once again that write support is a bit buggy in this driver, so just be wary.

Accessing Windows and Mac Drives in Linux

Most Linux distros come with full NTFS support built-in, as well as read support for HFS+. So, you only need to do anything extra in Linux if you want to write to Mac-formatted drives.

For Mac Volumes

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs
By default, Mac OS X formats volumes in journaled HFS+ volumes. Journaling is a feature that improves data reliability, and unfortunately it makes HFS drives read-only in Linux. To disable journaling, just boot into OS X and fire up Disk Utility. Click on your HFS partition, hold the Option key, and click File in the menu bar. A new option to Disable Journaling will come up in the menu. Click that, and reboot into Linux. You should have read and write access to your HFS partition—however, the permissions on your Mac user's home folder will prevent you from reading or writing those files. See Part Two below to fix that problem.

Part Two: Putting All Your Data in One Place

This part is optional, but I've found that using one home folder to store all my data (and linking to that home folder in the other two OSes) makes life a lot easier, especially since a few of the drivers listed above aren't quite perfect. Plus, by putting all my data in one place, I can keep my music libraries synced together, pause torrent downloading in one OS and resume it in another, and so on.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

First, pick which OSes home folder you want to use for this—I like to use OS X's home folder—and follow the instructions below to use it across OSes. Depending on your needs, you may choose to store all your data in your Windows or Linux home folder. The best way to decide which to use is by which OSes you use the most—since I barely use Windows (and thus didn't feel like paying $40 for a read/write driver), I used my OS X partition as my main data dump, since it's easy for Linux to read and write to it. The main idea is to not use a partition that has bad write support in an OS you use often—so, if you're a heavy OS X user, you wouldn't want to put all your data on your Linux partition, since the OS X driver isn't so great. Similarly, if you use Windows often, you wouldn't want to put it all on your OS X partition (unless you want to pay $40 for MacDrive). Think about which partition would be most convenient for you and go with it—after all, you can always move your data later if you so choose.

Making Mac and Linux Home Folders Play Nicely with One Another

The great thing about OS X and Linux is that they are both UNIX-based operating systems, so they work pretty well together if you can get everything set up correctly. When you create a user in either operating system, it gives you a User ID number. OS X starts these numbers in the 500s, while Linux usually starts in the thousands. This is problematic because a different "user" owns your home folder in OS X than owns your home folder in Linux. As such, Linux will deny you access to your OS X home folder, since you don't have the right permissions to access it.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

There's an easy fix, however—we just need to change our UID in one OS so that it matches the UID in the other. Unless you have a reason for choosing otherwise, we're going to change our Linux UID to match our OS X one, since it's a bit easier. By default, the first user in OS X has a UID of 501, but you can double check this by going into System Preferences in OS X, right-clicking on your user, and hitting Advanced Options. If your User ID is something different from 501, replace 501 with your other UID in the terminal commands below.

Boot into Linux (we're using Ubuntu in this example) and fire up the Terminal. First, we're going to add a temporary user, since we don't want to edit a user that we're currently logged into. So, run the following commands int he Terminal, hitting Enter after each one:

 sudo useradd -d /home/tempuser -m -s /bin/bash -G admin tempuser  sudo passwd tempuser 

Type in a new password for the temporary user when prompted. Reboot and login as tempuser. Then, open up the Terminal and type in the following commands, once again hitting enter after each one (and replacing yourusername with your Linux user's username):

 sudo usermod --uid 501 yourusername  sudo chown -R 501:yourusername ~/ 

This will change your Linux user's UID to 501 and fix your home folder permissions so that you still own them. Now, you should be able to read and write to both your Mac and Linux user's home folder, no matter what OS you're logged into.

You may also want to fix your login screen, since by default Ubuntu won't list users with a UID of less than 1000. To do this, just open a Terminal and run gksudo gedit /etc/login.defs and search for UID_MIN in the text file. Change that value from 1000 to 501, and when you reboot your user will be listed in the login screen.

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCs

Lastly, log back in as your normal user and run sudo userdel -r tempuser to delete the temporary user we created earlier.

If you like, you can create symlinks in one of your home folders that point to your main home folder for quick access. For example, since I use my OS X home folder as my main data dump, my Linux home folder is mostly empty. So, I created symlinks in my Linux home folder for Documents, Videos, Pictures, etc. that point to the equivalent folders on my Mac partition. You can do this by using the following Terminal command:

 ln -s /path/to/linked/folder /path/to/symlink/ 

If you're using your Linux home folder as the main one, you can use this same command to create symlinks that link to your Linux home folder instead.

Note that if you're using your Mac partition as the main home folder, you'll probably also want to automatically mount it in Linux when you start up. You can do this by adding a line to the end of /etc/fstab. This will vary from person to person, but mine looks like this:

 /dev/sda3 /media/Data auto rw,user,auto 0 0 

Where /dev/sda3 is the location of the partition containing the home folder and media/Data is the path I want to use to navigate to it.

Using Libraries in Windows 7

A Comprehensive Guide to Sharing Your Data Across Multi-Booting Windows, Mac, and Linux PCsSince Windows doesn't support UNIX permissions, you won't need to mess with them at all—you should be able to read and write to your Mac and Linux home folders without a problem (as long as you have the correct drivers installed). To make them easier to access, we can use Windows 7's awesome Libraries feature, which allows your Documents, Videos, Pictures, and other "libraries" to link to multiple folders on your drive, so you can access the files stored in your main home folder from shortcuts in the Windows Explorer sidebar (and in many applications).

To add those folders to each library, open up Windows Explorer. Right click on a Library (say, Documents), and hit Properties. Hit the "Include a folder" button and navigate to the Documents folder in your main home folder. Hit Include, and you should see it show up in the list. You can even click on it and hit "Set Save Location" to set it as the default save location for the types of files Windows associates with that Library. Repeat this for your other libraries and you're all set on the Windows front.


Now, I just make sure all my applications point to the same directories in each OS. For example, I have Amarok watching my iTunes folder for new files, so when I add music to my iTunes library, it will show up automatically in Amarok (similarly, I can add newly download music to iTunes' "Add Automatically to iTunes" folder for it to automatically show up in both Amarok and iTunes). I tell my torrent downloader in each OS to download new torrents to the same location, so if I want to leave Linux and continue downloading a torrent in OS X, I can just reboot, add the torrent to Transmission's queue, and it will pick up right where I left off in Linux. This way, you don't need to use space-limited solutions like Dropbox (as awesome as they are for inter-computer syncing) to sync your data—it's just always there. There are, of course, other ways to do this, but this is the way I have it set up. How do you share your data between multiple operating systems? Share your favorite strategies in the comments.

Number of comments
  • Share this:

No comments:

Post a Comment