Google hack: Use Gmail as a Linux filesystem
Computerworld - This article is excerpted from Google Hacks, 3rd Edition, by Rael Dornfest, Paul Bausch and Tara Calishain, published August 2006 by O'Reilly Media Inc. Copyright 2006, 2005 and 2003, all rights reserved. Reprinted with permission.
What I wouldn't give for a couple spare gigs of networked filesystem on which to stash a backup of my work in progress or as an intermediary between two firewalled systems (thus, they're not directly reachable from one to the other).GmailFS puts your gigs of Gmail storage to work for just such a purpose. It provides a mountable Linux filesystem and repurposes your Gmail account as its storage medium.
GmailFS is a Python application that uses the FUSE userland filesystem infrastructure to help provide a filesystem and the libgmail library to communicate with Gmail.
GmailFS supports most file operations, such as read, write, open, close, stat, symlink, link, unlink, truncate and rename. This means you can use the lion's share of your favorite Unix command-line tools (cp, ls, mv, rm, ln, grep, et al.) to operate on files stored on Google's Gmail servers.
So, what can you store on the Gmail filesystem, and what can you do with it? About anything you can with any other (possibly unreliable) networked filesystem built on a cool hack or three. Figure 1 shows the Firefox Web browser launched from an executable stored as a message in my Gmail account.

Figure 1. Reading Gmail via the Firefox Web browser launched from an executable stored on the selfsame Gmail account
Click image for larger view
Warning: This is my first foray into Python, and I'm sure the code is far from elegant. That said, the language has a reputation as an excellent choice for rapid prototyping — and this was borne out in my experience. The first working version of GmailFS took about two days of coding with an additional day and a half spent on performance tuning and bug fixing. Given that this includes the learning curve of the language itself, the reputation seems well deserved.
A special mention should go to libgmail and FUSE, as both greatly contributed to the short development time.
(I'm particularly concerned with my attempts to manipulate mutable byte arrays. I'm sure there's a less clumsy way of doing it than the nasty list -> array -> string path I'm currently using.)
So, do be careful using the GmailFS and certainly don't use it for anything important.



- Excel 2010 Cheat Sheet
- Register for this Computerworld Insider Cheat Sheet and gain access to hundreds of premium content articles, guides, product reviews and more.
- Digital Transformation: Creating New Business Models Where Digital Meets Physical
- Individuals and businesses alike are embracing the digital revolution. Social networks and digital devices are being used to engage government, businesses and civil...
- Make the Connection: Better Network Connectivity Drives Transformation
- Network connectivity is more than just plumbing. Leading organizations today see high-performance network connectivity as a critical enabler of competitive advantage, and not...
- Virtualizing Government Infrastructure
- All server virtualization solutions are not created equal. The more-with-less agenda for government agencies is tailor-made for server virtualization, which is evolving into...
- Moving Service Management to SaaS
- Today, organizations can enjoy similarly substantial benefi ts by migrating their IT service management functions to a software-as-a-service model. This paper shows how...
- Achieving 360 Degree Network Visibility with Nimsoft
- 360° network visibility is critical for ensuring continuous availability of networks, servers, and applications-anything less could
have costly bottom-line implications.
All Networking White Papers
- Optimizing Networks for the Cloud
- Join guest speaker, Rohit Mehra, IDC Director of Enterprise Communications Infrastructure, to explore current trends, discuss best practices for optimizing Data Center and...
- Unified Communications 101
- What's the best way to implement a unified communications solution for your organization?
- Try the OptiView® XG on your network - FREE
- The OptiView® XG is the first dedicated tablet with automated network and application analysis -- fastest way to root cause. XG raises the...
- Apps QuickStart Series Part 2: Designing and Deploying SQL Server on VMware vSphere
- Download this webcast to learn about the design considerations for virtualizing SQL workloads, performance and scalability information and high-availability options, as well as...
- Apps QuickStart Series Part 1: Designing and Deploying Exchange 2010 on VMware vSphere
- Download this webcast to learn the virtual hardware design considerations for Exchange 2010, deployment using the building block approach, options for high-availability and... All Networking Webcasts
