Gmail Filesystem Implementation 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.
>