Archiv der Kategorie personal

My desktop backup solution

Requirements

Through the last years I have used various own hacks for backing up my desktop(s). There are dozens of packaged backup solutions in Debian/Ubuntu already, but none of them did quite fit my requirements:

  • KISS! no fancy web UI, storage formats, or millions of plugins and configuration files; backups should just be a normally accessible directory
  • Supports standard backup strategy: daily backups for last week, weekly backups for last month, permanent monthly backups. This must not require my computer to be switched on all the time.
  • Runs as my own user, so that I don’t need to set it up each time I reinstall my box
  • No interactivity; any backup solution that requires me to do anything regularly is doomed to fail.
  • Push-style backup to my server through ssh (or derived, like scp or rsync)
  • Supports per-directory filtering to avoid backing up unnecessary stuff; my upload bandwidth is very small. (e. g. I don’t want to include ~/.cache and in ~/evolution I want to ignore the cache subdir).

rsnapshot

I have used rsnapshot as a basis for about a year now. It was originally intended to be used with pull-style, but that does not work for home setups behind a NAT. But it’s easy to use push-style with it (details later). It is by and large a fancy wrapper around good old trusted rsync, which is why I liked it from the start: It by and large just creates a full tree copy of your data for each snapshot, and uses hardlinks to avoid duplicate files. So restoring is easy and robust, you can use any file browser to get to your data.

File selection

If in doubt, backup should include a file rather than exclude it. I value completeness over small storage size, and I just check the volume of a snapshot from time to time to ensure that it doesn’t grow too big (it’s currently in the magnitude of 200 MB, which is small enough for daily deltas to be pushed through a slow DSL uplink without much pain). So my approach is to backup everything in /home/martin except explicitly configured files. For configuring the blacklist I use per-directory .rsync-filter files (which have builtin support by rsync).

Excerpt of my ~/.rsync-filter:

# global ignores
- *.log
- *.cache
- .*.swp
- .swp
- .*.lock
# only direct subdirectories/files
- /.ICEauth*
- /.Trash
/.aptitude
/.ccache
[...]
/download
/ubuntu
[...]

(In case you wonder, everything in ubuntu/ is either in the Ubuntu archive or in bzr, so no need to include this.)

Another example is ~/.Private/mozilla/firefox/t3znsw4q.default/.rsync-filter:

- /url*.sqlite*
- /*.bak
- /Cache
- /adblockplus
- /OfflineCache

Please see man rsync, section “FILTER RULES” for the details of the syntax.

Having and maintaining a sensible arrangement of your home directory is by far the most difficult aspect of backup, if you need to be stingy with bandwidth.

rsnapshot configuration

You need a central configuration file ~/.rsnapshotrc. The most important settings are the paths to back up, the destination directory, and the modes (daily/weekly/monthly). In addition I include my crontab into the backup, and add a post-backup action to rsync the backup tree to my server. Backups go to /var/backups/$USER on my systems, which is a different partition than /home (can’t stress that enough; today’s file systems are good, but not infallible).

config_version 1.2
snapshot_root /var/backups/martin
cmd_rsync /usr/bin/rsync

link_dest 1
one_fs 1
lockfile /home/martin/.rsnapshot.lock
rsync_long_args -F –delete –numeric-ids –delete-excluded
cmd_preexec /bin/sh -c ‘crontab -l > ~/.crontab’
cmd_postexec /bin/rm ~/.crontab
cmd_postexec /usr/bin/rsync -e ‘ssh -i /home/martin/.ssh/id-backup_rsa’ -aHzvPy –delete /var/backups/martin/ piware.de:backup/tick-home

interval daily 7
interval weekly 4
interval monthly 6

backup /home/martin martin-home

cronnery

The last piece of the puzzle is a script which calls rsnapshot regularly with the desired mode. I wrote a small shell script (which lives in ~/bin/backup) which determines the age of the last daily/weekly/monthly backup, and calls rsnapshot with the correct mode argument. It doesn’t do anything if the last backup was done less than a day ago, so it’s designed to be called very often.

The actual cron job just needs to call it every hour:

$ crontab -l
# m h dom mon dow command
05 * * * * $HOME/bin/backup >/dev/null

And voila, from now on I have e. g. yesterday’s backup on piware.de:backup/tick-home/daily.1/.

Tags: , ,

Photo Quiz

Vor einer Weile habe ich ein wirklich interessantes und schönes Motiv gefunden und fotografiert. Errät jemand, was das ist?

A while ago I found a really interesting and beautiful motif and shot a photo of it. Can anyone guess what it is?

Gruene-Eislandschaft

Update:
Natürlich habt Ihr es rausbekommen, es ist gefrorener Spinat in einer Schachtel. Ich habe das nur durch Zufall entdeckt, und fand die Eiskristalle einfach wunderschön.

Of course you got it right; it’s frozen spinach in a box. I just discovered it by accident, and found the ice crystals marvellous.

Tags: ,

Hello Ween!

Ein gruselig schönes Halloween an Euch alle! Gestern haben Netti und ich wieder gebastelt:

Kuerbis

Wir hatten mit einigen Freunden eine sehr schöne Feier. Danke nochmal an Sonni und Knäcke!

English:
Happy Halloween everyone! Netti and I made some nice pumpkin yesterday, and had a great party with some friends.

Tags: , , ,

Die nächste Stufe…

… auf der Taekwondo-Leiter ist erreicht!

Gestern fand hier in Dresden mal wieder ein Lehrgang mit unserem Großmeister Kim Chul Hwan. Er hat uns ab um neun ordentlich auf Trab gehalten. Ich hab mich gestern auch mal wieder einer Gürtelprüfung gestellt, die ich auch bestanden habe. Formenlauf, Einschritt- und Freikampf gingen glatt über die Bühne, ich hatte nur etwas Bammel vor dem Bruchtest (Yop-Chagi), da ich den vorher noch nicht geübt hatte. Ging aber beim ersten Versuch durch.

Nun bin ich stolzer Träger des 4. Kups (blauer Gürtel)!

English summary:
Yesterday I earned the next Taekwondo belt at the training camp with grandmaster Kim Chul Hwan. Now I’m the proud bearer of the 4th kup (blue belt).

Tags: , ,

New Blog address / Neue Blog-Addresse

I moved my blog from its old wordpress.com home to my own server, replacing my ancient home page.

Mein Blog ist von seiner alten wordpress.com-Heimat auf meinen eigenen Server umgezogen, und hat damit auch gleich meine Uralt-Homepage ersetzt.

Back from mini-vacation and climbing

Today I returned from a great mini-vacation (long weekend). My parents and I visited my sister, in-law, niece, and nephew in Bavaria. We don’t see each other very often, it’s always great for me to see my niece and nephew grow, and play with them.

The highlight of the vacation was on Sunday, when my father, my in-law, and me went to Insbruck, Austria, on a 5-hour fixed-rope route climbing tour. It was my first outside climbing experience (I only did some indoor bouldering so far), and so I was looking forward to this new experience.

Martin on mountain top (click for more photos)

It was a “difficulty medium” trail, and indeed it was quite challenging at times. At some spots I couldn’t really climb any more, but had to cheat and resort to clinging to the rope. But it was fun anyway!

The Alps are such a wonderful place for enjoying fresh air, sun, and the nature!

Tags: , , , , ,

Asteroids bot submitted, publishing source

A while ago I blogged about my participation in the c’t programming contest to write a bot that plays against the 1979 Atari console.
Submission deadline was June 30th, and the results are trickling in now.

I am on rank 104, which I’m more than satisfied with. Unsurprisingly I didn’t make the top 50, I spent way too little time on it. But I had lots of fun with it, I have something that works, and at least outperforms my own Asteroids skills :-)

In case anyone is interested in it, the source code is on http://piware.de/bzr/ct-asteroids/. It’s a bzr branch, so you can bzr get the directory.

Tags: , , ,

My computer discovered playing games

The other day I read about the current c’t programming contest and got addicted immediately. The task is to create a program which plays the Atari Asteroids game from 1979:

Unfortunately they do not send that gem to everyone :-) , but they do send the original 8 KB of ROM, so you can play it on the MAME emulator.

So far I got the emulator and the game running, and have a Python script which tracks the objects and their velocity vectors. I spent half of the weekend doing the vector analysis bits with good old pencil and paper. Reviving all the maths bits from school (about 11 years ago) was a lot of fun! Now I have useful formulas for determining the shooting angle to hit a moving comet from a moving and decelerating ship, determining if and when two moving objects with given radius collide, etc. In my head I have a first cut of a strategy, too.

Now I just need to find some time to actually implement all of this…

Once the contest is over, I’ll publish my sources, in case anyone else is interested.

Tags: , ,

Howdy!

After 17 hours of long flights and hectic interchanges I made it to Austin, Texas last Saturday, yay!

Admittedly there are much fewer cowboy hats around here than I anticipated (but then again, Austin is said to be the most non-Texanian city in Texas). Instead I have to readjust my mental scale of the size of everything; the country itself, the vast cars, the hilariously big TV in my giant hotel room.

I could sleep surprisingly well, I was awake between 4 and 6 am, but fell asleep again for two hours fortunately. I spent the Sunday morning with fixing some bugs and some jockey improvements.

Around noon I met again with Jon Masters, and we drove to San Antonio to visit the The Alamo Mission. It is a great historic place which presents the wild history of Texas and the U.S. at large. It’s hard to believe how drastically both changed within the last 150 to 100 years, and to see the complex “relationships” (read: “neverending wars”) between the Mexican and USian settlers, the Federalists and Centralists, etc. Irony of history: less than 150 years ago, the Mexican states complained about the rush of immigrating U.S. settlers which would subvert and destroy their culture…

Later on we spent an hour strolling along the San Antonio River Walk. From the description I expected some wild nature along the river, but it turned out to be a a cozy and lively center of cultural and touristical live, crammed with small bars and restaurants, and dozens of boats with hundreds of tourists. Well, it was a warm and sunny Sunday afternoon after all :-) . However, after ten minutes of walking it became much quieter and relaxing, a totally different perspective than you get when being on the ground floor, when you are in a typical American city.

Then we went back to Austin and picked up Soren Hansen, who joined us for the evening. We went to have a little walk through Austin itself, mainly to see the rather impressive Texas State Capitol (although the boss was not there; what a slacker :-P ), and the 6th street, where all the cool bars and restaurants are. We had a beer, later on a classic burger, and finished the night with two rounds of pool and a rather long walk.