Skip to main content

Mounting Rackspace Cloud Files using cloudfuse into ubuntu 10.10 v2

·5 mins

This article shows how to mount cloud files using cloudfuse software into your ubuntu 10.10 as a directory so you can access your cloud files containers data inside your linux server just like any other folder and files. One heads up, this gives you an easy access to your cloud files data but in no way means you can use it as a place for any database/application directly running from it, will be darn slow. So, why would one want it then? Well, there are plenty of uses of having system level access to your cloud files, for instance if you have some scripts which create your mysql backup or website backup, those scripts can create backups automatically into cloud files without you needing to copy them yourself. So, lets get on with it..

Note: The following commands are tried and tested on Ubuntu 10.10, but they should be easily applicable to other versions of ubuntu or debian. As long as you install the required packages, you should be able to compile cloudfuse code and use it.

Installing cloud fuse: First download the cloudfuse code. Extract this file and then compile.

ssidhu@ssidhu:~$ tar -xzvf cloudfuse-0.1.tar.gz

Once you have extracted the .tar.gz file, you should have following files under cloudfuse-0.1 directory.

root@ubuntu-test:~/cloudfuse-0.1# ls -la
total 280
drwxr-xr-x 3 root root   4096 Feb 21 21:47 .
drwx------ 4 root root   4096 Feb 21 21:47 ..
drwxr-xr-x 8 root root   4096 Feb 21 21:47 .git
-rw-r--r-- 1 root root   1059 Feb 21 21:47 LICENSE
-rw-r--r-- 1 root root   1024 Feb 21 21:47
-rw-r--r-- 1 root root   2332 Feb 21 21:47 README
-rw-r--r-- 1 root root  12014 Feb 21 21:47 cloudfsapi.c
-rw-r--r-- 1 root root   1043 Feb 21 21:47 cloudfsapi.h
-rw-r--r-- 1 root root  11240 Feb 21 21:47 cloudfuse.c
-rw-r--r-- 1 root root   4335 Feb 21 21:47
-rwxr-xr-x 1 root root 198521 Feb 21 21:47 configure
-rw-r--r-- 1 root root   1324 Feb 21 21:47
-rwxr-xr-x 1 root root  13184 Feb 21 21:47 install-sh

Now its time to compile it and install it. You’ll need libcurl, libfuse, and libxml2 and their dev packages installed to build it.

Cloudfuse is built and installed like any other autoconf-configured code. Normally,

sudo make install

But, first you need to install the required packages, otherwise the ./configure command will fail and throw you errors.

apt-get update
apt-get install gcc
apt-get install libcurl4-openssl-dev
apt-get install libxml2 libxml2-dev
apt-get install libfuse-dev

now run the following command in the cloudfuse directory

root@ubuntu-test:~/cloudfuse-0.1# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for XML... yes
checking for CURL... yes
checking for FUSE... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
root@ubuntu-test:~/cloudfuse-0.1# make
gcc -g -O2 -I/usr/include/libxml2     -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse   -o cloudfuse cloudfsapi.c cloudfuse.c -lxml2   -lcurl   -pthread -lfuse -lrt -ldl
root@ubuntu-test:~/cloudfuse-0.1# make install
/usr/bin/install -c cloudfuse /usr/local/bin/cloudfuse

If everything went fine, you should have cloudfuse installed properly. Confirm this by running the which command. It should show the location of the cloudfuse binary file.

root@ubuntu-test:~/cloudfuse-0.1# which cloudfuse

Mounting cloudfiles: Let’s now use cloudfuse and mount our cloudfiles.

You’ll have to create a configuration file for cloudfuse in your home directory and put your Rackspace cloudfiles username and API key in it, like below:

    api_key=[api key]
    authurl=[auth URL]

Auth URLs: US cloudfiles account: UK cloudfiles account:

The following entries are optional, you can define these values in the .cloudfuse file.

     use_snet=[True to use snet for connections]
     cache_timeout=[seconds for directory caching, default 600]

After creating the above configuration file, you will run the cloudfuse command like following. The syntax should be as simple as:

cloudfuse [mount point]

So, you should be able to mount cloud like this

root@ubuntu-test:/# mkdir cloudfiles
root@ubuntu-test:/# cloudfuse /cloudfiles

If you run # ls -la command inside the /cloudfiles directory you should see your cloudfiles containers.

If you are not the root of the system, then you username will need to be part of “fuse” group. This can probably be accomplished with:

sudo usermod -a -G fuse [username]

If you are unable to see any containers inside the mountpoint, then probably some of the above steps didn’t work properly. You need to check and make sure that all the above steps get completed properly.

UPDATE: 30/9/2011

Here is some extra info for CentOS on how to mount cloudfuse using another use ie. Apache.

$ yum install fuse
$ usermod -a -G fuse apache
$ mkdir /mnt/cloudfiles
$ chown apache:apache /mnt/cloudfiles
$ sudo -u apache cloudfuse /mnt/cloudfiles -o username=myuser,api_key=mykey,use_snet=true,authurl=""

Play around with it and fix it how you like, but I think it would be useful. Courtesy my frnd Anh.

Let me know if there are any errors in these instructions or you faced some difficulty understanding them, I will update them accordingly. Any comments are highly appreciated.

Note: Please don’t bug Rackspace Support for the help on this article, it’s not supported by them hence this article. :)

Good luck!

– Sandeep Sidhu