Merging all your disks into one in Linux

I had accumulated several odd-sized hard disks over the years. Nearly 3/4 of these are filled with different research data, movies, documents, journal papers, music and other packrat files that I never got to arrange into a coherent sense.

I tried recently to allocate one disk for one type of file. Say a Music disk, a Documents disk, Movies disk etc. In linux it is easy to pretend that these subdirectories looks like one big disk since you would just link the disk to say /home/ganni/Music and have a music folder that goes directly to the Music disk.

However, as I thread through the files, it seems that kind of thinking is faulty. If I ever outgrow my Documents disk for example, then I would have to be forced to spill over its contents to the Movies disk and so on. Eventually probably in a year's time, I am back to where I am right now.

I thought of making one superdisk. There is of course the LVM option or logical volume management. This option can be done when installing ubuntu and choosing the LVM option, or of course making one in a live working system. The only fault here is that if one of the disks in the LVM fail, then the whole volume becomes unreadable. Since my disks are from different days and a mixture of different brands, I am not sure which of them will fail any time soon. LVM is an elegant though dangerous option.

I also considered union-fs (which the EEE PC uses) but I found an even better option for this. After some googling, I stumbled upon mhddfs. Now before I start moving my files, I will document how I will do it for those who are in the same predicament as I am. So for all the digital packrats there, here is an option for you to have a unified, fairly "safe" option to have your files in linux.

In the course of organizing my files, I tried to install different versions of linux. Ubuntu Natty was problematic for me since it does not have any good NVidia 3D drivers and it also has some problems with my AVRISP mkII programmer which I would be using for my electronics class this semester. I ended up falling back to ever dependable Debian but with a green face. I am now using LMDE or the Linux Mint Debian Edition, which has the polish of Linux Mint with the dependability and rolling updates of Debian Testing. Coolness! hehehe.

So back to mhddfs. First, we need to install it. So we fire up either synaptic or the terminal and install mhddfs. mhddfs is a FUSE plugin that combines data from several directories and present it in one directory.

$ sudo apt-get install mhddfs

Just following the recommendations from alj (https://www.nowhere.dk/articles/fuse-coolness-with-mhddfs) we first create a target directory.

For me the target directory is /home/ganni which will contain everything. Next would be mounting the drives on their own directories first
before joining them together. Apparently, it just makes you use the mounted directories as a single one via mhddfs.

One concern is hiding the mounted drives from showing up in nautilus. The solution from here (http://ubuntuforums.org/showthread.php?t=1439003) is to mount them at /mnt and NOT at /media

So editing my fstab we now have:
/dev/sdf1 / ext4 defaults 0 0
/dev/sdd1 /mnt/sdd1 ext4 noatime,defaults 0 0
/dev/sdg1 /mnt/sdg1 ext4 noatime,defaults 0 0
/dev/sde1 /mnt/sde1 ext4 noatime,defaults 0 0
/dev/sda1 /mnt/sda1 ext4 noatime,defaults 0 0

Checking nautilus, indeed the disks do not show up. Then it is a simple command to have all the mounts show up as one single mega-drive by executing

$ sudo mhddfs /mnt/disk1,/mnt/disk2,/mnt/disk3 /home/ganni -o allow_other

I did this in single user mode (init 1) to be safe. I get rewarded by a single drive with lots and lots of free space. Hahah! Success!

All I need to do now is to make this a permanent thing. This can be done by putting in the line

mhddfs#/mnt/disk1,/mnt/disk2,/mnt/disk3 /home/ganni fuse defaults,allow_other 0 0

One other subtle thing is to enable the fuse module to be loaded first at boot. I spent several minutes figuring this one out. This can easily be done by putting the line


into the /etc/modules file.

I also needed to change the permissions and user/group since some of the files were from past installations of various linuxes. So a quick chown and chmod, I have all files now as my own.

Onto the next challenge, organizing all these files :-) Happy packratting!