Tag FreeBSD

dirvish + MySQL

I’ve been using dirvish to do backups at home. One problem I’ve always had is how to back up MySQL databases, since the backup takes a snapshot of the binary files, so if it happens at the wrong time (e.g., in the middle of a transaction), the backup might wind up being in an unusable, inconsistent state. Much better to use mysqldump to export the database to a file (one which, by the way, can also be manipulated with standard tools like perl and emacs, in case I need to repair anything).

The obvious way to do this was to use the pre-client dirvish directive to export to a file, then let that file be backed up. But I could never get it to work.

Cut to the chase: It turns out that for this to work, the pre-client directive (and post-client, if you want to clean up afterward) needs an extra semicolon:

pre-client: ; /usr/local/bin/mysqldump -a -A -e > $DIRVISH_SRC/mysqldump.%Y-%m-%d.sql
post-client: ; /bin/rm $DIRVISH_SRC/mysqldump.%Y-%m-%d.sql

Without those semicolons, things don’t run correctly. My guess is that the semicolon tricks dirvish into thinking that the command consists of multiple commands, which must therefore be run inside a shell, rather than a single command to be executed with fork()/exec().

Network Problems Fixed?

As far as I can tell, FreeBSD 8 tickled something in the driver for my ethernet card, and caused it to behave unreliably. Rather than muck around with half-tested kernel patches or ifconfig settings, I slapped a $30 Whatevertheyhadontheshelf-3000 (read: common chipset that’s been debugged by a lot of people), and as far as I can tell, things are now working as they should. If the site stays up for a year, I guess we’ll know.

I also took the opportunity to add some memory. So whoo-hoo all around.

And while I’m at it, I should point out that FreeBSD is like a VW Bug: not the prettiest thing to look at, especially compared to various Apple or Linux offerings, but in a crunch it’s nigh-indestructible. Wanna run with a root partition that’s over 100% full? Sure thing. Boot a 7.2 kernel with a 8.0 /usr? No problem.