Enabling GMailFS on a Gentoo Linux system
Tagged:  •    •    •    •  

Given the (ever increasing) storage size of a GMail account, it becomes interesting as an alternative backup storage location. The GMailFS project becomes an interesting option then.

Using Gentoo, I referred to Gentoo-Wiki.com where a howto was given on how to install GMailFS. This is a virtual file system, based on the FUSE infastructure. This allows you to enable support for a (virtual) filesystem without having to modify the kernel.

I followed the steps on the Gentoo Wiki page, but it turned out I had to follow a slightly different procedure in order to get this right. These are the steps I followed in the end:

  1. Retrieve the latest ebuild for GMailFS from Gentoo Bugzilla. This involves putting this in an overlay. Refer to this article in order to put 3rd party ebuilds in the Portage system.
  2. You'll also need the latest ebuild for fuse-python, which are Python bindings for the FUSE infrastructure. At the time of writing only version 0.2 pre2 was available in Portage. Gentoo Bugzilla offers 0.2, which we will use for now. Put this file also in your overlay.
  3. Make sure to unmask these ebuilds for installation. So for my x86 system:
    # echo "sys-fs/fuse-python ~x86" >> /etc/portage/package.keywords
    # echo "sys-fs/gmailfs ~x86" >> /etc/portage/package.keywords
  4. You should be ready to install GMailFS now, so issue the following command:
    # emerge -av sys-fs/gmailfs
  5. Run the depmod command in order to update the modules.
  6. And load the FUSE module:
    # modprobe fuse

    You can also add the FUSE module to your autoload list if you plan to use this filesystem regularly:

    # echo fuse >> /etc/modules.autoload.d/kernel-2.6
  7. Relax the permissions on the FUSE device such that non-root users can write to FUSE filesystems:
    # chmod 666 /dev/fuse
  8. Once installed, it's time to configure the thing. First, edit the file /etc/gmailfs.conf and fill in the details:
    username
    Your GMail username.
    password
    Your GMail password.
    fsname
    A string of characters which shouldn't be easy to guess for others. Or paste the output of the following command:

    dd bs=12 count=1 if=/dev/urandom | base64

    If people find out this string, they can corrupt your filesystem by sending you emails containing this string in the subject.

  9. In order to mount the GMail filesystem as your own, non-root, user, copy the file to your home directory:
    $ cp /etc/gmailfs.conf ~/.gmailfs

    Eventually change the logfile directive to a place where you are allowed to write.

  10. To cover your password for others, issue an chmod on this file:
    # chmod 600 /etc/gmailfs.conf
    $ chmod 600 ~/.gmailfs
  11. Create a mount point for your GMail filesystem, this can be anywhere. I'll use /mnt/gmail for this.
  12. Now, you should be ready to mount the filesystem as your own user!
    $ mount.gmailfs /usr/share/gmailfs/gmailfs.py /mnt/gmail

    This may take a few seconds, but when no error appears, you're all set and you can use this folder as any other folder on your local filesystem.

    To test everything is OK, try to create a new file or copy an existing file to the mount point. If this goes without a stitch, realize you just got a couple of gigabytes extra to use.

  13. However, we're not completely done yet. Look at the log file, it will probably read the line:
    10/30/07 20:47:27 ERROR OpenSSLProxy is missing. Can't use HTTPS proxy!

    This is because you're missing the pyOpenSSLProxy package, and therefore it could log in with SSL. Portage didn't offer a package for this, neither did Bugzilla. So I decided to create a custom ebuild for this (or you can download the module directly). Once you put this in your overlay, the error disappears, which means you now log in with SSL.

    Note: this pyOpenSSLProxy package didn't specify a license. I just left it GPL-2 like the GMailFS code, but not knowing this makes me hesitant to submit this to Gentoo Bugzilla.

At this time, I'm trying to figure out to make encfs work properly. This is another FUSE filesystem which provides an encryption layer upon an existing filesystem. I love Google, but I don't love them enough to have my private stuff on their servers.
As soon as I figured out how I can write this filesystem as non-root, I'll write a new article about it.

Update 5 April 2008:

EncFS works now from version 1.4. See this page for more info.