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.
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:
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.
- 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:
- Then, create a folder /media/data in which we will mount our data partition:
sudo mkdir /media/data
- 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
- Open fstab in gedit:
sudo gedit /etc/fstab
- 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
- 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:
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.
- Make sure all your personal files are located in the data partition and delete the (now empty) folders from your home folder
- 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.
When you browse through your personal documents, you might notice the appearance of several not-so-elegant Windows files and folders: $RECYCLE.BIN, System Volume Information, desktop.ini and Thumbs.db. Luckily these files and folders are easily hidden using a .hidden file in Ubuntu.
- Open gedit and paste these lines in it:
System Volume Information
- Save the file as: /media/data/.hidden
- After a reload of your data partition in Nautilus, you’ll see that $RECYCLE.BIN, System Volume Information, desktop.ini and Thumbs.db are not visible anymore (but are easily revealed again by selecting the option View > Show Hidden Files (Ctrl+H))
- You may place the .hidden file in your sub folders as well; this time, you’ll only need to use these two lines:
- 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.