28.5.11

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

fuse

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!




1.1.10

Hacking my MSI Wind (Wireless card, USB Hub, bluetooth, 16gb flashdisk, wireless mouse)

I just opened up my MSI Wind after its hard disk gave out. To check whether it was just a software crash or hardware (really!), I opened it up and swapped an old 2.5 SATA disk from an old (headless) computer. It worked which means that the current disk did not work any more. In the spirit of turning a "bad" thing to a good thing, this offered me a chance to hack out my Wind netbook.


First things first: replacing the hard disk. This was easy to do. Then I remembered that the RTL8187 wireless card of the Wind was quite crappy and thus decided also to get the wireless card (Intel) from the other computer and replace the one in the MSI wind. Thus the hacking starts!

I took out the battery and opened up the MSI wind by removing the screws and using my fingernail to pop out the back cover. Removing first the antenna connections on the wireless card and the screw that holds it down, it is now easy to take away the mini PCI card and pop in the replacement.

Before that, I need to unscrew the SATA hard disk out and replace it with the working HD. Putting all the screws back together, putting in the cover and the battery, all it needs it a test. I had previously installed Ubuntu 9.10 there and surprisingly it all worked. The wireless card was detected, the hard disk was working-- this means I have a working netbook again.

Yet, this is also an opportunity to put in Bluetooth as the original computer had none. I have an old bluetooth USB which protrudes 1/2 cm out of the side when plugged it. I surmised (correctly) that it will fit inside. All i need to do is to wire it in!

But why stop there? Searching the web, I found some blogsites (the MSI Wind forum was down probably permanently) that pointed the way. Finding an old USB hub, stripping it down to its barest minimum, checking the internet again for the correct USB wiring connections, I soldered the hub down, stripped a 16gb flash drive, stripped down the bluetooth dongle and got my wireless mouse dongle (which I got cheaply for the holidays) and connected them to the hub. That left me with a single port for "future" upgrades. :-)

I tried to put in the 3G smart bro stick inside but it was too thick and to separate them out needed special connectors that I don't want to make as of the moment.

I soldered the power carefully, the USB D+ and D- lines and the ground for the hub. Soldered in the USB stuff and placed the hub and the dongles underneath the hard disk. The flash disk was placed beside the hard disk so that I could see it light up when accessed. Using a glue gun and masking tape liberally since I don't have kapton tape, I fixed in the components and put in back the cover and the battery.

Turning on the power, I see now the bluetooth module is up in Ubuntu, the wireless mouse works and the 16gb disk is detected. Hardware hack done!

Not satisfied with this I now upgraded the Ubuntu 9.10 OS to the latest alpha (I know it is alpha software but this is "cutting edge" hacking hahah) Ubuntu Lucid Lynx 10.04 version (due on April 2010).

Now I celebrate the new year with a new OS and refurbished computer. Pictures to follow soon!

Happy new year!