Published

16 December 2013

Sharing

Introduction

I want to store content in various directories and have a unified view of them. Unionfs has been developed to achieve this need.

The problem

I work on ECM applications based on Alfresco. Custom developments are based on libs stored in WEB-INF. They are mixed with Alfresco ones which make difficult to know who did what. I can prefix them with a specific name so I will recognize them, but it is not a very convenient solution.

Unionfs-fuse to the rescue.

The solution

Unionfs-fuse concatenates content from various directories into one. For example, imagine I have the following directories :

  • lib-base : contains the alfresco libraries provided by the installation
  • lib-ext : contains the alfresco libraries provided by my custom development

Unionfs-fuse allows to have directory (lib for example) which will be the union of the other ones. Just type the following command:

unionfs-fuse lib-base=RO:lib-ext=RO lib

Download

Get it on github with the following command:

git clone https://github.com/jonnyyu/unionfs-fuse‎

Compilation

Go into the directory and type:

make

You may have 2 errors which are very easy to fix:

  • AT_SYMLINK_NOFOLLOW
  • malloc.h

On OpenVZ, create the following:

  • vzctl set CTID --devnodes fuse:rw --save

Bug AT_SYMLINK_NOFOLLOW

This bug requires you apply this [patch][Bug AT_SYMLINK_NOFOLLOW]. I always had difficulties with patch, so I prefer to apply it manually. Fortunately, the file is pretty simple.

Bug malloc.h

As indicated [here][Bug malloc.h]:

Actually, you shouldn't need malloc.h at all, it's obsolete; including stdlib.h should take care of what malloc.h used to handle. Basically, just remove it, or #if it out

Finalization

Just type make again and that's it!

Ressources




blog comments powered by Disqus