Ads by TechWords

See your link here
Receive the latest technology news and information.
Networking
Computerworld Daily News (First Look and Wrap-Up)
Computerworld Blogs Newsletter
The Weekly Top 10
Cloud Computing
View all newsletters




Privacy Policy
 

Google hack: Use Gmail as a Linux filesystem

September 15, 2006 12:00 PM ET

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.

Google Hacks
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
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.


Jump to comments

Google

Additional Resources

Microsoft
Here are some of the key reasons why you would want to run Unified Access Gateway with DirectAccess.
Microsoft
Review how one energy firm tightened protection and simplified IT work using business-ready security solutions.
Sybase
In this white paper, IDC analyzes the role of next-generation mobile enterprise platforms as organizations seek a more strategic deployment of mobile solutions.

Learn the important issues you must consider before starting your next mobility initiative. Get your mobility white paper from IDC now, compliments of Sybase.

What People Are Saying

White Papers & Webcasts

Death to PST Files
Download Now  

Business Process Framework Demo
Learn about Configurable Business Processes and Calculated Fields. Watch Now!

A Green Architectural Strategy That Puts IT in the Black
Levergage green computing across your data center. Read more now.  

Manager Experience Demo
Go beyond self-service solutions to perform more effectively. Watch Now.

Quantifying the Business Value of VMware View
Learn why you should invest in a centralized virtual desktop.  

Asia-Pacific Enterprise Network Solutions
Learn through this Webcast how your business can achieve reliability, performance and value in hard-to-reach locations within the Asia-Pacific region.

Mainsoft Webcast w/ Forrester Research: Drive SharePoint Adoption in Lotus Notes Shops
How can you drive mainstream user adoption of Microsoft SharePoint when your users rely on Lotus Notes?


IT Jobs