Gmvault: Backup and restore your Gmail account
github.com
github.com
#Email backup
0 0,6,12,18 * * * /usr/local/bin/gmvault sync -d /XXXXXXX/email-backup/joshstrange --resume josh@joshstrange.com >> ~/mail-backup-logs/joshstrange.com.log 2>&1
0 1,7,13,19 * * * /usr/local/bin/gmvault sync -d /XXXXXXX/email-backup/otheremail --resume other@otheremail.com >> ~/mail-backup-logs/otheremail.com.log 2>&1
....
I sync it all locally to my house then back it up to Dropbox as well. The reason to store them in different datebases is you cannot "filter" them out when restoring so if they all go to the same DB if you restore you are restoring ALL your email across all accounts to one new account.What's the database format it uses, sqlite3? (I tried looking on the repo but couldn't any obvious reference)
-d DB_DIR, --db-dir DB_DIR
But from what I see the structure looks like this: db/
YYYY-MM/
1234554543262346.eml.gz - I assume the meat and potatoes of the email along with attachments, not sure
1234554543262346.meta - JSON file with msg_id, thread_id, flags, labels, subject, etchttps://github.com/good-3g-apps/email/tree/master/imap-impor...
It also saves the raw .eml files to disk. No support for labels (yet), but it does properly link up threads in the db using `References` from the parsed headers (setting both MPTT and adjacency-list fields)
It's WIP, so contributions welcome :)
btw, the data is pretty exhaustive, even for non major Google applications or more recently added features (Maps Location History).
(Note that these aspects may also make the tool a little more dangerous to use.)
I wonder how to use them once I have the backup data?
cdubz@professor-farnsworth ~/data $ du -h Mail-chris.mbox
3.2G Mail-chris.mbox(2) easy to corrupt
I'm using Gmvault for Gmail (emails and chats), pretty effortless and with enough features for me, especially the export to maildir.
And rclone[2] for Google Drive, in "create a local mirror" mode (sync).
Any other tools to backup your Google life?
[1] - https://news.ycombinator.com/item?id=12972554 [2] - http://rclone.org/
But really, you may not need S3 at all and just sync between your devices with Syncthing: https://syncthing.net/
Shameless plug: Syncthing is in official Debian repositories! https://tracker.debian.org/pkg/syncthing
Not feasible to use this for critical infrastructure if there is no maintenance happening.
- https://github.com/syncthing/syncthing/releases/tag/v0.14.7
Also, It will improve further with File System Notifications (from what I understand?):
By default, Syncthing is pre-configured with community-hosted discovery servers:
- https://github.com/syncthing/syncthing/blob/master/lib/confi...
The community also hosts relay servers, so if your two devices can't communicate with eachother directly, it will work anyway.
Relay servers take bandwidth. Anyone can run a relay server, and it will automatically join the relay pool and be available to Syncthing users. This is documented here:
- https://docs.syncthing.net/users/strelaysrv.html#strelaysrv
It would also be possible to host your own private relay and discovery pools, if you need that for some reason.
If you want to use an open source tool you can use borg backup & rsync.net as your external backup site. Borg doesn't have good S3 integration, and using fuse & s3 doesn't work that well either. It works best when the borg daemon is on the reciever box too to help with indexing and such.
There's a big item on one of my whiteboards: "put gmvault into the environment" ... the idea being that you could run 'gmvault', over SSH, on rsync.net:
ssh user@rsync.net gmvault ... blah blah ...
I've been meaning to do this forever ... it would be great if rsync.net customers could not install anything, but just run gmvault as an ssh command.
The only reason it takes time is that we do not have a python interpreter in our environment - we try to keep things as simple and locked down as possible - which means we have to "freeze" gmvault as a binary executable in order to put it into place ...
So ... folks want this ?
- XOauth
- Sync to another gmail account (incrementally)
Edit: Also supports only backing up emails with a specific gmail tag.
It has been good practice for a couple of decades. Of course, getting people to follow good practices is another matter....
You can also do something like using fastmail, where you don't control your domain, but being a paying customer you do have somebody to call if there are issues
As is now well known, mobile numbers are often also hijacked to subvert weak 2fa.
Then use TLDs where that can't happen.
If you forget to renew a .de domain, for example, you get a letter, and have 2 weeks to restore it, or end it - per default, it gets held in TRANSFER mode, for 50€/month.
Also, you can always get the domain back, if you can prove ownership.
There's many TLDs where such safety is standard.
Switching is annoying, but not impossible. You just forward the old address to the new and progressively replace it on any accounts you might have. I still have access to my Gmail account, it just hasn't received a non-spam email in years.
gmvault is purpose-built and quite simple. I've used it before with success. It backs up your whole mailbox in one command. Why should we fiddle with a desktop mail client?
How about clawsmail ? It's a pretty good client too, and still updated.
Go to the website click on documentation then indepth then restore.
You can also export to other formats ex. mbox
I then have a backup of my computer -> 1. Time Machine + 2. Arq->S3/Glacier
Given that this keeps mail locally in a constantly readible format (offline, copied in mbox)... is there something missing in my basic solution that this cli utility adds?
I guess this utility benefits people who only use gmail's web interface.
Not as full featured (can't restore), but it's just a 77-line Python script. You could audit it yourself to make sure it doesn't upload your creds to another server.
I am (slowly) working on a project to pull some statistics from Takeout's mbox file for Mail. Also want to play around with the Location History, Chrome data and Hangouts exports.
Additionally, the output format (gzipped plain email + metadata) looks very convenient for indexing / analysis; something I'm dreaming of for a long time.
(2) You can do things with a desktop client that you can't do with a web interface. That includes sort by subject and sort by size.
(3) Desktop clients can have real folders, which Gmail doesn't.
(4) Works off-line. This is still useful, though not as useful as it used to be.
(5) Easy to backup. Easy to automate backup.
It generally works fine and it allows you to restore the emails to a different account name. (I sometimes temporarily restore an account to search for old emails). It seems to have some issues with restoring accounts with a lot of large emails (large or multiple attachments) especially those that have reached the 15GB quota.
It's sad that after all these years, google still hasn't gotten around to properly implementing IMAP.
Are there similar tools for MS Outlook or Protonmail or if it is possible to modify gmvault to work with either one?
I have an always on PI server as git server. I wouldn't mind put this on as one more cron job on it.
Even before this I've been looking to get a bit independent from Google, atm I'm trying to get Camlistore to replicate my data over various places. (I wish it had some erasure encoding)
EDIT: Ok it appears gmvault encodes attachments into the eml default, cool.
https://github.com/gaubert/gmvault/issues/73 >> Users asked about attachments. Put somewhere in the doc that they are saved.