Share Files Seamlessly Between Ubuntu and Windows in a Dualboot Setup

Do you want to be able to use both Ubuntu and Windows, while seamlessly sharing all your personal files between them? This is how I accomplished it.

Prerequisites

In this guide I assume that you’ve already installed both Windows and Ubuntu (preferably in that order).

I highly recommend that you (even though it’s not necessary) have a separate data partition for all your personal documents; this is really useful for the purposes of this guide, because it makes sharing your personal files a lot easier. Moreover, it will turn out to be really convenient when backing up or reinstalling your operating system, without worrying about your personal files.

Since Windows can’t read Linux file systems, but Linux can read Windows file systems, you’d best choose the data partition to be NTFS formatted. It might be something like this:

Auto mounting

With our personal files located in a separate data partition, we’re ready to configure Ubuntu. We start off by configuring Ubuntu to auto mount the data partition.

  1. First we need to know which UUID (universally unique identifier) our partition has; open up a terminal and enter this: sudo blkid. In my case the UUID of the partition is: D054B62D54B61666
  2. Then, create a folder /media/data in which we will mount our data partition: sudo mkdir /media/data
  3. Now, we’re ready to edit the /etc/fstab file, but first be sure to make a backup, in case something goes wrong: sudo cp /etc/fstab /etc/fstab.backup
  4. Open fstab in gedit: sudo gedit /etc/fstab
  5. Add a line, containing the UUID of your partition and the mount location:
    UUID=D054B62D54B61666 /media/data ntfs-3g auto,user,exec,rw 0 0
  6. Finally save and close the file.

This tells Ubuntu to mount the partition at startup (auto), makes it accessible for users (user) and gives it reading, writing (rw) en file execution (exec) rights. Furthermore, the two zeros leave the file system checks up to Windows.

Now, if you restart your system, the data partition should be automatically mounted:

Symbolic links

Now that we have configured Ubuntu to mount the data partition at start up, we’re ready to link the personal folders (located in the home folder) to the ones located in the data partition.

  1. Make sure all your personal files are located in the data partition and delete the (now empty) folders from your home folder
  2. Then, using symbolic links, we link the folders in the data partition to the home folder, as if they were actually located in the home folder: ln -s /media/data/Foldername ~/Foldername

So, now we’ve created some kind of shortcuts (note the arrows in the picture above) to the folders at your data partition, which will act just like any other folder and thus will work seamlessly within Ubuntu.

.hidden file

When you browse through your personal documents, you might notice the appearance of several not-so-elegant Windows files and folders: $RECYCLE.BINSystem Volume Informationdesktop.ini and Thumbs.db. Luckily these files and folders are easily hidden using a .hidden file in Ubuntu.

  1. Open gedit and paste these lines in it:
    $RECYCLE.BIN
    System Volume Information
    desktop.ini
    Thumbs.db 
  2. Save the file as: /media/data/.hidden
     
  3. After a reload of your data partition in Nautilus, you’ll see that $RECYCLE.BINSystem Volume Informationdesktop.ini and Thumbs.db are not visible anymore (but are easily revealed again by selecting the option View > Show Hidden Files (Ctrl+H))
  4. You may place the .hidden file in your sub folders as well; this time, you’ll only need to use these two lines:
    desktop.ini
    Thumbs.db
  5. Finally you can also hide these .hidden files in Windows, using the file properties.

Feel free to leave any comments in the comment section below.

2 thoughts on “Share Files Seamlessly Between Ubuntu and Windows in a Dualboot Setup

  1. Pingback: Correctly Set Up Dropbox to Auto Sync Your Personal Files and Folders | RienvanHulten.nl

  2. Pingback: Mounting a Windows Drive in Ubuntu – Tech Roose

Leave a Reply