AwesomeMounter: join plug’n’play drives into a single large directory

Have you ever run out of space, and decided to offload some of the bigger files to a second (or third…) disk? Sometimes even an external drive?
Are you tired of having to look around all disks in order to find that specific file?

Well, you’re in luck!
Because AwesomeMounter is an awesome program that will get you rid of all that mess, without ever needing to know what LVM, RAID, or even filesystem means.

(…probably!)

AwesomeMounter is free and GPLv3. Based on inotify and mhddfs [en], it’s actually a pretty simple bash script (so if you’re interested, you can easily tinker with it).

 

What can AwesomeMounter do?

Here’s an example. You’ve got 3 places where you store music: your Linux home (50 gigs), a Windows partition (100gigs), and an 8 gigs USB pendrive:

  1. /home/foo/music/ (has reggae and jazz subdirectories)
  2. /mnt/windows/data/mp3/ (has pop and jazz subdirectories)
  3. /media/pendrive/songs/ (has hiphop and electro subdirectories)

And you want all the music in a single place. Namely:

  • /music/ (will contain all the aforementioned music)

 

With AwesomeMounter, you can access music through the 3 original paths, or through /music/, like this:

  • /music/ (total size: 50+100+8 = 158 gigs!)
    • /reggae
    • /pop
    • /jazz
    • /hiphop
    • /electro

How cool is that?

 

Plug-n-Play!

With AwesomeMounter, you gain the ability to disconnect (or umount) any drive at any time.
Reciprocally, whenever a previously set-up drive is connected or mounted again to your system, the data will automatically reappear where the AwesomeMounter config files tells it to.

This makes it perfect in combination with external drives, such as pendrives, USB hard disks, cellphones, memory cards…

 

Continuing the example: the USB pendrive at /media/pendrive/, can be removed as you normally would (e.g. right click -> unmount drive), and /music/hiphop and /music/electro will automatically disappear from /music.

 

Storage balancing!

(a.k.a. what happens when I write stuff in there?)

(c) Peter Riedel/Rex Features
Any new file you try to write, will automatically be put in the drive with the most free space.

E.g.: If your pendrive is full, data will be stored somewhere else.

 

If you need to write stuff to a specific drive, you can bypass this awesome automatic storage balancing. by simply using the corresponding original path at /media/pendrive/*, instead of the joined path that AwesomeMounter made available to you at /music/.

 

How do I use it?

First, copy the script anywhere on your disk, and give it execution permissions.

Then, create a configuration file at ~/.awesomemounter/config. Example file:

##########################
# some configured dirs:
/music /home/foo/music,/media/pendrive/songs
/movies /home/foo/videos,/media/bigHDD
/downloads /home/foo/incoming,/mnt/windows/p2p
# you can nest mounts w/out problems
/video /movies,/downloads/series,/home/foo/docus
##########################

Then simply run awesomemounter from command line (you may be prompted for root access):

$ ./awesomemounter.sh

That’s it!

 

Where do I get it?

AwesomeMounter is available at GitHUB:

https://github.com/stenyak/AwesomeMounter

Don’t forget to create the config file!

 

DISCLAIMER: Use at your own risk. If your house burns down because of it, don’t blame me. Instead, call the firefighters and only then don’t blame me.

Tags: [en] | January 21st, 2012 |

2 Responses to “AwesomeMounter: join plug’n’play drives into a single large directory”

  1. Yuki Says:

    What’s the improvement of using it instead of using mhddfs alone? I haven’t prove it, it’s just to know it :p

  2. stenyak Says:

    Say you have 4 external hard disks: /media/hdd1, hdd2, hdd3 and hdd4. You want it all merged at /storage

    With a line in /etc/fstab, you cannot automatically mount “whatever is plugged”. mhddfs will fail unless ALL 4 disks are plugged in already.

    One solution is to manually open a terminal, look up what’s present in your system with /etc/mtab, then remember the syntax for mhddfs, and execute the mhddfs line.

    Still, that will fail if there’s only one disk available. Because mhddfs refuses to “join” a single disk. You need at least two.
    A solution to that problem, is to replace the /storage with a symlink to the only present disk. Or to mount with –bind, instead of using mhddfs.

    And when you plug a second disk, then you have to umount /storage, and compose a different line in your terminal (remember to look up which disks are available: were they hdd2 and hdd3? or was it hhd3 and hhd4? ah… let me run “mount” and grep it for existing disks… ok, looks like it was hdd1 and hdd3)

    With awesome mounter, it’s all automatic:
    You plug a single disk? No problem
    You plug any combination of the 4? No problem
    You already had something mounted at /storage? No problem.

Leave a Reply