SEARCH

How-To Geek

How To Harmonize Your Dual-Boot Setup for Windows and Ubuntu

bannerimg

Looking for some harmony between Windows 7 and Ubuntu in your dual-boot setup?  Here are a few ways you can make the tense OS situation a little more unified and copacetic.

Background

When we covered How to Choose a Partition Scheme for Your Linux PC, we noticed that some people were wondering how to use a third partition between Linux and Windows to act as a storage partition.

Why It’s Difficult

As a few commenters pointed out, you can’t use an NTFS-formatted partition for /home in Linux.  That’s because NTFS doesn’t preserve all of the properties and permissions used by Linux, and Windows doesn’t even read Linux file systems.  You can readily see this if you view a folder that’s hidden in Windows from within Linux, or a file that Linux sees as hidden in Windows.  What works for one doesn’t work for the other.  Furthermore, there isn’t an incredibly clean way to move the Users folder in Windows without messing with things.  This is why many people with nicer machines end up using virtualization software; it’s easier than forcing the two to co-operate side-by-side.

win v tux banner

Image from cellguru.co.cc, assumed fair use

A Work-Around

There isn’t a way to run your /home directory from a FAT32 or NTFS partition, so your configuration files and scripts will have to remain there.  What you can do is redirect the other commonly used folders like Documents, Downloads, Music, etc. to another partition, one that can be read by Windows.  Then, you can add these folders to your Windows 7 Libraries and mark them as the default save location.

This isn’t a proper workaround.  Your program-associated configuration files and other user-related settings will not be in the same place for this setup.  If you have to reinstall either OS, you will have to perform a separate backup of your user settings.  That being said, however, most people are really just concerned about their documents, music, videos, and so forth.  This solves that issue by pointing both OSs to look in the same place for them.

Linux has come a long way with regards to reading and writing NTFS, and since it’s much better than FAT32 and tougher to configure this setup with, that’s what we’ll be covering in this guide.

Partition Scheme

For this to work, you’ll want your hard drive set up in a way similar to this:

  • Your Windows partition
  • Your Linux partition
  • A large partition (or second hard drive!) to store your files
  • A small swap partition

For later convenience, when you format your storage partition to NTFS, add an easily recognizable label to it.  It’ll be easier to find a drive called “storage” or “media” than by counting partition numbers.

Notice that we don’t have a separate /home partition this time around.  Since the vast majority of your important/large files will be on a separate partition, this negates the need for that.  You’re welcome to use a separate /home partition to make backing up the Linux-side of things easier, just remember that you can’t exceed four primary partitions per disk.

Auto-Mount Your Storage Partition (Linux)

Since we’re using NTFS, it’s a good idea to specifically tell your system to mount your storage partition or disk in the same place every time you boot.  To do this, we’ll be editing the /etc/fstab system file, which is the file system table used by Linux, but first, we have some preparations to make.  Open up terminal, and if this makes you nervous, just take a deep breath and relax.  It’ll be okay.

Prep Work

We need to install ntfs-3g, the driver Linux will use to read and write to NTFS.  If you already have it installed, it’ll tell you, so don’t worry.

sudo apt-get install ntfs-3g

If you see “ntfs-3g is already the newest version” then you already have it installed, otherwise you’ll see it work, so wait for it to finish its thing.  Next, let’s create the directory where your partition will mount.  If you want the drive to appear in the “Places” menu by default, you’ll use:

sudo mkdir /media/storage

If you don’t want it to appear in “Places” and you want to manually browse to it for whatever reason, you can use this instead:

sudo mkdir /mnt/storage

This will create a “storage” directory in /media.  You can change this to something else if you like, but be sure it does not have any spaces.  Spaces will create a problem when we configure it to automatically mount in the next few steps.

fstab

Now, it’s time to edit the fstab file.  First, we’ll create a backup, just in case anything happens.

sudo cp /etc/fstab /etc/fstab.backup

It’ll prompt you for your password, so go ahead and enter it.  If, for whatever reason, you need to restore the backup in the future, you would do this:

sudo cp /etc/fstab.backup /etc/fstab

Next, you need to find what the UUID of your storage partition is.  The UUID stands for “universally unique identifier” and acts as a proper serial number that will not change until the partition is reformatted.  Run the following command:

sudo blkid

Enter your password, and you’ll see some output resembling this:

/dev/sda1: UUID=”23A87DBF64597DF1″ TYPE=”ntfs”
/dev/sda2: UUID=”2479675e-2898-48c7-849f-132bb6d8f150″ TYPE=”ext4″
/dev/sda5: UUID=”66E53AEC54455DB2″ LABEL=”storage” TYPE=”ntfs”
/dev/sda6: UUID=”05bbf608-87fa-4473-9774-cf4b2602d8d6″ TYPE=”swap”

Find the line that has the correct label to your storage partition (makes things easy, doesn’t it?) and copy the UUID.

gksudo gedit /etc/fstab

You’ll see gedit open, like so:

fstab before

You may see an uglier theme on gedit than usual, but don’t worry it.  Add the following lines to the bottom of fstab, substituting your own UUID instead of mine:

# storage mount
UUID=66E53AEC54455DB2 /media/storage/    ntfs-3g        auto,user,rw 0 0

The first line is a comment, indicated by the leading hash tag.  The next line tells fstab to look for the partition with the specified UUID, mount it to /media/storage/, and to use the ntfs-3g driver.  Furthermore, it makes sure that it automatically mounts at boot, makes it accessible by users (not just root), gives both read and write privileges, and skip file-system checks (you’ll probably want to use Windows to do that).  Lastly, double-check, and triple-check to make sure you didn’t touch anything else, and that the UUID is correct.

fstab after

When you’re ready, click save and then reboot.  Don’t skip the reboot, as it’s necessary for the next step as well as to make sure things work.

You should be able to boot into Ubuntu as if nothing happened, but you’ll notice that you’ve got “storage” (or whatever you named it) under the Places menu now!  If not, check to make sure you got fstab correct.  See above to restore fstab from your backup, if you need to.

Configure Your Subfolders (Linux)

Open up terminal and enter the following command:

gedit .config/user-dirs.dirs

This is the file where your “special” folders in your home directory are defined. 

user-dirs before

You can edit this to your liking.  In place of where you see “$HOME/Downloads” you would put in an absolute folder location, like “/media/storage/Downloads”.  Go ahead and create those folders, or whatever folders you’d like to call them, and put the path down for each of these.  Here’s what the finished edit should look like:

user-dirs after

Click save, and we’re done the crux of the configuration.  You may need to reboot for these changes to take effect, but you can just boot into Windows to finish out the process in the next section.

Basically, now when you browse and put files in your “Downloads” folder, they’ll actually go to your storage drive’s “Downloads” folder.  Anything in your home folder itself will stay in /home/yourusername/, not on your storage drive.  A few of the folders, like “Desktop” and “Templates,” probably won’t benefit from this treatment, either.  Templates are rarely used, the desktop usually gets cluttered with shortcuts and the like, and the Windows desktop isn’t elegantly redirected, unfortunately.

Configure Your Subfolders (Windows)

Boot into Windows, and you’ll see that there’s another partition called “storage” under “My Computer.”  Windows 7 has the beautiful Libraries feature built-in, so take a look at our article “Understanding the Libraries Feature in Windows 7,” and you’ll see step-by-step directions on how to add your new storage folders to your libraries. 

libraries

As you can see, my storage drive folders are a part of my libraries.  My storage drive letter is E: because my network share is at D:.  Also, take a look at our “Change the Default Save Folder for Windows 7 Libraries…” article so that when you stick things in your libraries, they automatically get saved to your new storage folders as well.

setting as default save location

The last thing you’ll have to change is the default “Downloads” directory in your preferred web browser(s), which can point to your “Downloads” library.  All done!

It’s also worth mentioning that if you have some know-how, you could even do this with a remotely shared drive on your network, though it may prove to be too slow for actual use.  A better idea is to turn your storage partition into a shared drive that can be accessed by other computers in your network.


While there is no perfect solution to the problem of a unified shared drive for dual-booters, this layout works quite elegantly.  Most people mainly care that their downloaded files, documents, and media files can be accessed very easily regardless of which OS they’re using, and you’ll see that this scheme does that fairly well.  If you have any tips, or perhaps a better setup, please share them!

Yatri Trivedi is a monk-like geek. When he's not overdosing on meditation and geek news of all kinds, he's hacking and tweaking something, often while mumbling in 4 or 5 other languages.

  • Published 11/21/10

Comments (32)

  1. Guss

    Thank you for this useful article…

    I have done that using Ubuntu Tweaks.

  2. MJ

    You can also change the location for folders inside your “User” folder in Windows. Just right-click a folder (“Pictures” for example), then go to the tab “Location” and change it to the folder you just created inside the other partition. This way you avoid changing the libraries, but most important your programs will save by default to those locations. You can even move your desktop to that partition!

  3. Hatryst

    That’s what makes Ubuntu a nice operating system :)
    Nice article, and awesome research !!

  4. Harish

    Good article..
    My way is to set windows partition to automount at login
    and symlink the relevant directories(My Documents -> $HOME/Documents, My Pictures -> $HOME/Pictures.. and so on)… thanks

  5. Ivan Kolevski

    Very nice information, Nice to see someone utilizing the power of both OS’s and Win7 Libraries. Tnx. for sharing useful info.

  6. Porter

    I have been using Ubuntu for quite some time now, and was wondering what Linux operating system you were using?

    Thanks,
    Porter

  7. Porter

    Or should I say what theme are you using for Ubuntu? It looks interesting

  8. Vincent Raja

    Nice artical.. We can use both Win and Linux… and ur Theme is awesome.. i like it..

  9. Tom C.

    Nice article, indeed. But I am missing some words about the (not solvable) problem, when using Bitlocker for encrypting the (Windows) system …

  10. Brian Carr

    great item well constructed very useful 9/10
    :)

  11. bob murrell

    How do I change the default boot order in grub?

  12. YatriTrivedi

    My theme is based on the BlueJoy Gnome theme and a modified Radial Emerald theme. :-)

    http://gnome-look.org/content/show.php/Blue-Joy?content=73387
    http://gnome-look.org/content/show.php/radial?content=71352

  13. YatriTrivedi

    @ Tom C.
    I don’t have much experience with BitLocker. My guess is that if you’re adding a folder to your Libraries, it would be excluded from encryption and therefore should work, but if not then I’m wrong about this assumption. Sorry I can’t help more!

  14. YatriTrivedi

    @bob murell
    You can install either of the following packages to give you a GUI to edit your grub configuration, and change your default boot order/options easily:

    startupmanager
    grub-choose-default

  15. k5cr3am

    Interesting. Thats almost exactly what I’v done already with my own win 7/ubuntu dual boot setup.

  16. tu padre

    what about just installing the driver so that windows recognizes a ext3 or 4 partition its out there

  17. k7g v

    A vastly superior method for sharing your piece of the electronic frontier with mighty “Jabba The Gates” would be to right click on the following link:

    http://sourceforge.net/projects/unetbootin/files/UNetbootin/494/unetbootin-windows-494.exe/download

    and then visit TigerDirect for a cheap 16GB Flash Drive. Put your Kubuntu on the Flash Drive, including your various personal files, installed software applications, etc., and you won’t have to negotiate any silly non-aggression treaties with the Redmondites. Neville Chamberlain once negotiated such a treaty with Adolph Hitler and it cost him his flat at No. 10 Downing Street, and gave the job to Winston Churchill, whose sour faced rejoinder was something like, “Any damned fool could have seen that coming!”{

  18. Zach

    There’s two other ways of doing this:
    1. mount the shared drive to your home folder, so everything goes to there, this way you might be able to share certain application’s profiles cross-platform
    2. create a symbolic link between ~/Documents and the shared partition

  19. Jonathan

    When I dual booted I remember just creating symlinks in my home folder to My Document folders in XP.. *shrugs*worked. lol

  20. Ryan

    Yeah, I had the same problem over and over again and I had uninstalled Ubuntu for this, though I liked it.
    Well, I want to reinstall it now that I know I was not alone and a solution
    But first,

    Please can you tell me whether this method will still work if I skip the “Partition Scheme” Part?

  21. Matt

    Fairly good piece, but do have any suggestions for harmonizing settings on programs and such? I’d been symlinking some of my Firefox folders, but that seems clunky and inelegant. Is there a better solution? I’d love to see a further series on working with dual-booting, but this is definitely a good start.

  22. Steff

    This articleis very helpful. Thanks…

  23. Karl J

    Doing this didn’t work for me “gedit .config/user-dirs.dirs” ,places were still the same (/home/user)
    To fix it I had to edit /etc/passwd (the last line)

    I have an aspire one netbbok with ubuntu 10.04 netbook edition on it

  24. Thomas Kizito

    Thank you very much although there was a simple although similar in a way I was doing it. Actually both my M$ Windows and Ubuntu share among other the same Desktop, Documents, Downloads, Music and Pictures for each user that exists on both the OSs. I want to take on this and compare the differences.
    Thank you!

  25. Kevin

    Hi there,

    Although I don’t remember exactly my configuration when I had my Ubuntu’s files on a NTFS partition, I noticed that if I hibernated from Windows and booted Ubuntu on wake up, as the NTFS hadn’t been closed, Ubuntu used an out-of-date files table, therefore I ended up writing on new windows files and loosing data.

    If that is still a problem, I would suggest adding some warning about it. Other than that, great walk-through for addressing this important issue for dual booters

  26. M

    and why not just use wubi

  27. Kanj

    I don’t think this method of auto-mounting using UUID and ntfs-3g is great.

    First of all I’m getting an error message saying “Under-privileged user can’t mount NTFS blocks using external FUSE library. Mount as root or rebuild NTFS-3G with integrated FUSE….”.
    The other thing is that for every partition I’m getting 2 listings under Places. One is what ordinarily used be- “54 GB filesystem”. Second is by the name of folder I’m trying to mount it to. (Even though mounting fails.)

    It’s better to use /dev/sda… instead of getting errors at every boot-up.
    Why don’t people try out a few things before going on to write an article about it?

  28. YatriTrivedi

    To see why ubuntu uses UUID by default nowadays, please see my article on fstab editing: http://www.howtogeek.com/howto/38125/htg-explains-what-is-the-linux-fstab-and-how-does-it-work/

    It’s hard to say for sure without seeing your fstab, os version, etc, but a quick google search yields the following link: http://www.tuxera.com/community/ntfs-3g-faq/#useroption
    “sudo chown root $(which ntfs-3g)”
    “sudo chmod 4755 $(which ntfs-3g)”
    Those commands should enable you to use UUIDs. You may have to make sure that your username has “sudo” ability, and also that the userid you reference in fstab (if this option is present) is correct. Different configurations can cause different issues, as I’ve never needed to do this myself. Two directories appear because fstab created one set based on your fstab, and since it failed, the auto-parsed info gives you the second set, which you can mount manually. Once fstab works, the second set will disappear.

  29. Kanj

    I’m using Ubuntu 10.04. I saw the article on tuxera.com (It was mentioned in the error msg itself).
    Using the commands with sudo caused following error:

    Mount is denied because setuid and setgid root ntfs-3g is insecure with the external FUSE library. Either remove the setuid/setgid bit from the binary or rebuild NTFS-3G with integrated FUSE support and make it setuid root. Please see more information at http://ntfs-3g.org/support.html#unprivileged

    There’s nothing about userid in my fstab.

  30. taosaur

    Thank you! This worked great on the netbook I’m setting up for my nephew, and aside from Android, I’m a Linux n00b. For those starting from scratch like me, there’s no point doing anything in gparted until you have both operating systems installed, but you’ll save yourself some trouble if you set the Windows partition to the final size you’ll want it during the Ubuntu install (rather than accepting the default, like I did).

    I had to delete a recovery partition to get down to four primary partitions, but I just copied it over to an external hard drive via gparted–hopefully if it’s needed, it can be re-copied and will work.

    Some additional resources I found handy in the process:
    1. Wintoflash: installing Windows from USB is so much less hassle than CDs.
    2. LinuxLive USB creator: I was juggling 3-4 distros, and this Windows program made it easy.
    3. Grub Startup Manager: let me clean up my boot menu (and msconfig did likewise for the Windows boot menu)

    Some human error:
    1. I missed the step in this guide where you actually create the folders in the storage partition–had to redo my .config edits
    2. It took me a frustrating few minutes to figure out that my Ubuntu and swap partitions were grouped in a larger partition, which had to be moved/resized before I could position the Ubuntu partition where I needed it. The storage partition ended up being created within that larger partition as well, to get it between the Ubuntu and swap partitions, per the guide.

  31. taosaur

    Quick correction now that I’m on the Linux side: it wasn’t Grub Startup Manager that helped me out, but Grub Customizer. I tried GSM, but it was no help.

  32. Jeff

    So the link to understanding the libraries was helpful, but i’m not entirely clear on what you did that harmonized the dual boot. Do I create new document, music etc folders on the storage drive and then link them to the libraries? I don’t really understand what you used in that guide to do this.

Enter Your Email Here to Get Access for Free:

Go check your email!