The following post is based on Gmail file-system developed by Richard Jones, taken from his website http://richard.jones.name :

GmailFS supports most file operations such as read, write, open, close, stat, symlink, link, unlink, truncate and rename. This means that you can use all your favorite unix command line tools to operate on files stored on Gmail (e.g. cp, ls, mv, rm, ln, grep etc. etc.).
Installation:
- Make sure you have Python 2.3 (or later) installed. Most Linux distributions will have their own package for this (you’ll also need the appropriate python2.3-dev packages).
- Recent kernels include FUSE by default. If you run an older kernel you will need to install version 2.x of FUSE. Some Linux distributions (such as Debian) come with a package. If your distro doesn’t, you can find the source at FUSE’s SourceForge download page. Depending on your platform you may have to copy fusermount to /usr/bin for correct operation.
- Download the Python FUSE bindings from FUSE’s CVS repository. Checkout the python module using:
cvs -d:pserver:anonymous@fuse.cvs.sourceforge.net:/cvsroot/fuse co -P python
Then follow the instructions in python/INSTALL. - Download a copy of libgmail. Recent releases currently work however if you experience problems you may wish to grab the CVS version of libgmail by following the instructions here. After downloading (or checking out) the file, copy libgmail.py and lgconstants.py to somewhere Python can find them (/usr/local/lib/python2.3/site-packages/ works for Debian, others may vary).
- Download gmailfs-0.8.0.tar.gz. After untarring, copy gmailfs.py to somewhere easily accessible (for example, /usr/local/bin/gmailfs.py). Copy mount.gmailfs to the /sbin directory.
Using:
- You can mount your Gmail filesystem either via fstab or on the command line using mount.To use fstab, create an entry /etc/fstab that looks something like: /usr/local/bin/gmailfs.py /path/of/mount/point gmailfs noauto,username=gmailuser, password=gmailpass, fsname=zOlRRa
Note: If you cut and paste this entry remember to remove the spaces after the commasThe username and password fields speak for themselves. The fsname is the name of this Gmail filesystem. It is important to choose a hard-to-guess name here - because if others can guess the fsname, they can corrupt your Gmail filesystem by injecting spurious messages into your Inbox.To mount from the command line, do: mount -t gmailfs /usr/local/bin/gmailfs.py /path/of/mount/point -o username=gmailuser, password=gmailpass, fsname=zOlRRa
Note: If you cut and paste this entry remember to remove the spaces after the commasWarning: both of these methods have serious security issues. If you run a multi-user system, others can easily see your Gmail username and password. As of version 0.4 Gmail Filesystem supports an external configuration file for setting most of the options mentioned above, as well as defining your proxy settings if you require them. You can see an example gmailfs.conf file in the distribution, edit it appropriately and copy it to /etc/gmailfs.conf. Note that to use the Gmail filesystem through a proxy you must have the appropriate SSL packages installed, under Debian installing the package named python2.3-pyopenssl will ensure you have the correct dependencies installed. If your distribution doesn’t have a package you can download it from the pyOpenSSL webpage (you will also need the OpenSSL libraries). You will also need to download pyOpenSSLProxy and follow the installation instructions in the README. Note that HTTPS proxy support is optional, if you don’t need it then Gmail Filesystem will work fine without these extra packages. - GmailFS also has a blocksize option. The default blocksize is 5MB. Files smaller than the minimum blocksize will only use the amount of space required to store the file, NOT the full blocksize. Note that any files created during a previous mount with a different blocksize will retain their original blocksize until deleted. For most applications you will make best use of your bandwidth by keeping the blocksize as large as possible.
- When you delete files, GmailFS will place the files in the trash. libgmail does not currently support purging items from the trash, so you will have to do this manually when logged into your Gmail account.
- To avoid seeing the messages created for your Gmail filesystem you probably want to create a filter which automatically archives GmailFS messages as they come into your Inbox. The best approach is probably to search for the fsname value; it’ll be in the subject of all GmailFS messages.
Overview:
All meta-information in the GmailFS is stored in the subject of emails sent by the Gmail user to themselves. This was not as good an idea as I’d first thought. The idea was that I could speed things up by grabbing the message summary without having to download the entire message; however, as Gmail elides the subjects to fit on screen, I need to get the full message anyway (the message bodies are empty, but it does add considerable latency to operations such as ls -l on a large directory).
The actual file data is stored in attachments, and files can span several attachments allowing file sizes greater than the maximum Gmail attachment (filesize should only be limited by the amount of free space in your Gmail account).
There are three types of important structures in the GmailFS:
- Directory and file entry structures hold the parent path and name of files or directories. Symlink information is also kept here. These structures have a reference to the file’s or directory’s inode.
- Inode structures hold the kind of information usually found in a unix inode such as mode, uid, gid, size etc.
- Data block structures are messages which hold the attachment data for a file. The subject of the messages holding these structures contains a reference to the file’s inode as well as the current blocknumber.
All subject lines have a fsname (filesystem name) field which has two purposes:
- It prevents the injection of spurious data into the filesystem by external attackers. As such, the fsname should be chosen with the care you would exercise in choosing a user password.
- It allows multiple filesystems to be stored on a single Gmail account. By mounting with different fsname options set, the user can create distinct filesystems.




