Google hack: Use Gmail as a Linux filesystem

1 2 3 4 5 Page 2
Page 2 of 5

Implementation details

All meta-information in the GmailFS is stored in the subjects of e-mails sent by the Gmail users to themselves.

Tip: This was not as good an idea as I first thought. I thought I could speed things up by grabbing the message summary without having to download the entire message, as Gmail elides subjects (abbreviates them and adds ellipses) to fit them on the screen, but it turned out I needed to get the full message anyway. (Yes, the message bodies are empty, but it does add considerable latency to operations such as listing the contents of a large directory.)

The actual file data is stored in attachments. Files can span several attachments, which allows file sizes greater than the maximum Gmail attachment. File size should be limited only 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 paths and names of files or directories. Symlink information is also kept here. These structures have a reference to the file's or directory's inode (a data structure that holds information about where and how the file or directory is stored).

Inode structures

Hold the kind of information usually found in a Unix inode, such as mode, uid, gid, size, etc.

Data block structures

One of three types of messages GmailFS uses to store information related to the filesystem. The subject of the messages holding these structures contains a reference to the file's inode as well as the current block number.

As GmailFS can store files longer than the maximum Gmail attachment size, it uses block numbers to refer to the slice of the original file that this data block message refers to. For example, if you have a blocksize of 5 MB and a file 22 MB long, you will have five blocks (5 MB, 5 MB, 5 MB, 5 MB and 2 MB); the block numbers for these are 0, 1, 2, 3, and 4, respectively.

1 2 3 4 5 Page 2
Page 2 of 5
Download the 2018 Best Places to Work in IT special report
  
Shop Tech Products at Amazon