Using symlinks to keep your data separate in linux

I’ve always preferred not to have my data files on the same partition as my system files and often I have used a separate /home partition for this. This has a huge downside though. As your home folder is also used by the system to hold non global setting files, you risk making a mess of settings when you have different system installations sharing the same /home partition.

The solution I found best is to have symbolic links in the /home folder (that resides in the system root; no separate /home partition).

I create a partition for my data files, where I create Documents, Downloads, Music, Pictures and Videos (I try and avoid putting files in Desktop, but you could link that in a similar way). You can also use other folders you created in the home folder of course; I also use folders Apps, Audio and Calibre Library, for instance.

Now I need to add this data partition to fstab to make sure the files are always available at startup. Let’s assume the data partition is on /dev/sdc1 and that we created mount point /media/DATA. We can find out the UUID in terminal by typing:

~ $ blkid /dev/sdc1

Then we’ll need to add a line to /etc/fstab:

UUID=whatever-came-out-on-blkid /media/DATA auto defaults,errors=remount-ro 0 1

Now rename the folders you want out of the system /home folder:

~ $ mv Documents Documents.old

And link Documents to the Documents folder in your data partition:

~ $ ln -s /media/DATA/Documents ./Documents

Et cetera! Now you’ll have your data files in a separate partition (easier back-ups and easier to re-install your system without touching your data) and if you follow this symlink setup for all your installed systems, the data will be available in all of them.