(The lastest version of this article is always available in stand-alone HTML format and in PDF format. The original AsciiDoc source is also available. Please link to the HTML version, not this Blog post!)
1. Introduction
BoxBackup is an online remote backup tool for Unix systems (BSDs, Linux, MacOSX). It is robust, secure, low on resources and can perform both in continues backup mode and snapshotting. In continues backup mode changes will be pushed to the server soon after they happen; in snapshot mode mode BoxBackup behaves more like traditional backup programs and creates snapshots every fixed amount of time.
This article will describe how to set up a BoxBackup server and client on Debian and Ubuntu machines. Much of this article can also be used on other Unix-like systems, however it will not discuss how to compile BoxBackup.
Read the rest of this entry »
Posted on February 1st, 2011 in linux, sysadmin, tech | 2 Comments »
I've been trying to get MacOS X working on VirtualBox for a while now, and it never worked due to some ACPI problems. The latest versions of VirtualBox have added MacOS X Server as a guest possibility, and it also seems to have fixed some problems with running the normal Mac OS X.
I got this working on the following hardware/software. If your hardware/software differs, your mileage may vary:
- CPU: Intel Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
- Videocard: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03) (Some Intel integrated piece of crap).
- Ubuntu GNU/Linux v10.04
- VirtualBox v3.2 (important)
Here are the instructions:
- First, you'll need to get get MacOS X. I used a pre-made illegal VMWare image I got from here. (I'm sure Apple's legal team will be on my neck soon, but fuck it).
- Second, you need the latest VirtualBox. I'm using the Non-OSI v3.2.10. You can get it from the VirtualBox download page.
- Now, add a new VirtualBox guest and select 'MacOS X' as the Operating System and either 'Mac OS X Server' or 'Mac OS X Server (64 bits)' as the version. I'm not quite sure it works on 32 bits host processors/operating systems, but it does work on 64 bits hosts.
- You need at least 1024 Mb of memory. Less will NOT work
- For the Virtual Hard Disk add the Mac OS X vmdk image as a harddisk
Okay, now you'll have to through the settings and match them to the following settings:








The rest of the settings do not seem to matter, at least for getting MacOS X to boot succefully. To recap:
- Enable IO APIC must be ON.
- Enable absolute pointing device must be ON.
- You must enable only ONE SINGLE CPU. Mac OS X will not boot on VirtualBox with two or more CPUs
- Enable PAE/NX must be ON.
- Enable VT-x/AMD-v must be ON. This also means your hardware must support it. For Linux users, run the following command to check if your hardware has support for virtualisation enhancements:
grep "vm" /proc/cpuinfo.
You should see one or more of these lines:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm tpr_shadow vnmi flexpriority
If it's not there, but you have a recent CPU, you may have to enable VT-x in your BIOS
- Enable nested paging must be OFF
- Enable 3D acceleration must be ON. This also means your hardware AND host operating system has to have support for 3D acceleration. Linux users can use the 'glxgears' and 'glxinfo' commands to see if 3D acceleration is working correctly.
- Virtual Storage must use a SATA controller of the AHCI type, and must NOT use host I/O cache
IMPORTANT: You MAY have to boot Mac OS X with the -v boot option. Directly after starting up the Virtual Machine, hit enter and at the boot: prompt, enter -v. I had to do this the first time to get Mac OS X successfully booted. After the first successful boot, it doesn't seem necessary anymore. Safe-mode may also help in case of problems.
The Mac OS X image I linked to at the top of this post has its language set to Russian. Here's a nice blog post about how to change it, including screenshots.
Posted on November 5th, 2010 in sysadmin, tech | No Comments »
Maatkit is a suite of command-line tools for MySQL. It contains some rather nifty things for query analyses, replication, and other stuff. Some of the more interesting highlights:
Found via databasejournal.com, which has two articles on Maatkit:
The Wonders of Maatkit for MySQL and
Even more Maatkit for MySQL.
Posted on June 18th, 2010 in programming, sql, sysadmin | Comments Off
In kind of a follow up to my previous post on using find and sed to search and replace multiple files, I found out something else.
I needed to find and replace something in every file, except for any files which had ".svn" in them. After struggling for a few fruitless minutes with -regex, I stumbled upon this example in the manual page:
find /sbin /usr/sbin -executable \! -readable -print
Search for files which are executable but not readable.
The \! allows us to invert the tests after it. Perfect! All we need to do is use -regex to do our excluding:
find . -type f \! -regex ".*\.svn.*"
And we can now search and replace in all files except those that have ".svn" in them:
find . -type f \! -regex ".*\.svn.*" -print0 | xargs -0 sed -i "s/foo/bar/"
Neat. Note that, again, -regex is a GNU find only construct.
Posted on November 10th, 2009 in linux, programming, shell scripting, sysadmin | No Comments »
I always kept a small Python script around for searching and replacing in Linux. Turns out that GNU sed has an inline edit mode which I didn't know about:
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
This makes searching and replacing in files as simple as:
find . -name "*.txt" -print0 | xargs -0 sed -i "s/foo/bar/"
This replaces all occurences of "foo" with "bar" in all the .txt files in or below the current directory.
Unfortunately, -i appears to be a GNU extension, so it won't work on *BSD or Solaris, probably.
Posted on November 9th, 2009 in linux, shell scripting, sysadmin | No Comments »
I have a laptop that travels with me to work as well as being used at home. I have a number of network CIFS mounts that I like to have available when I am at home, so I have them set to "auto" in /etc/fstab. [...] The problem is that when I shift locations, I need proper handling of those network mounts.
Handling network mounts on a very mobile laptop.
Posted on November 6th, 2009 in link, sysadmin | No Comments »
Since Debian 4.0 or some such, when your MAC address changes, your interfaces changes too. So if you spoof the MAC address of your nic, or you clone a Debian 5.0 VirtualBox guest and assign it a new different random MAC address, or if your nic broke down and you replaced it, the new nic will be assigned to eth1 instead of eth0 (if you previously only had one network card in your machines, that is). Chances are your statically defined network settings (in /etc/network/interfaces) will not work anymore, because they refer to eth0, and not to eth1.
The reason behind this appears to be Udev. It keeps a list of MAC addresses and which interfaces they were assigned to, and when it sees a new MAC, it assumes that is a new network card, and so assigns it a new ethX interface. This is both a good thing, as it will keep your system from rearranging all the nic's if you add one or one dies, and a bad thing, as your network will not come up anymore if you've replaced the previous nic
To fix this, log in at the console as root, find a file named something like persistent-net.rules in the /etc/udev/rules.d/. The file may be prepended with some and remove all the lines in that file below the You can modify it... line.
When done, reboot. (I haven't yet found out how to regenerate the file. Running the executable the file mentions doesn't work for me).
Posted on October 8th, 2009 in linux, sysadmin | No Comments »
ArchFS is a FUSE (user-space, so it does not require a special kernel module, other than the FUSE kernel module) file system on top of rdiff-backup (an incremental backup tool). It allows you to mount a rdiff-backup repository and then provides an easy way to maneuver through the various revisions in that repository.
Posted on October 1st, 2009 in link, sysadmin | No Comments »
Here's an interesting article on trying to understand TCP performance. It discusses how the TCP flow-control window (receive buffer), window scaling, selective ACKs and some other TCP features/options affect your link's speed. Of course it's only a tiny fraction of the total picture that is link performance, but it's an interesting read.
There's also a webpage which inspects the TCP options your browser sends and calculates it's maximum theoretical speed.
Posted on August 31st, 2009 in link, sysadmin | No Comments »
I used to be real pleased with Ubuntu, because it got a couple of things right that Debian didn't. But I've upgraded my Ubuntu install three times now, and every time I upgraded everything broke.
The last time I upgraded, everything even remotely having anything to do with sound broke. This was because the geniuses at Ubuntu decided to include the shitty PulseAudio sound architecture in Ubuntu way before it was ready to be included. (Yeah, I know, not really PulseAudio's fault, but I'm just trying to get the PulseAudio crowd pissed at the Ubuntu crowd in the hopes that they'll gun them down).
Last time I upgraded, from Hardy to Intrepid, all my sound stuff broke again, flash didn't work anymore, my wireless broke (I've kind of fixed it now, but now NetworkManager keeps dropping the wireless connection when I push too much data through it, and can't get up again without a reboot – piece of shit), my hotkeys and all my keybindings broke, my sessions weren't saved anymore, my sound applet refuses to address the right mixer channel, my ~/.xinitrc is being ignored, I can't rm -rf / anymore (my favorite past-time thing in Linux :-( ).
Each time I upgraded Ubuntu, I found myself doing a clean install a couple of days later because too many things had broken. And even after that, many of the broken things were still busted.
I've had it with Ubuntu. It's a piece of shit. I'm going back to Debian Stable.
Posted on April 19th, 2009 in linux, opinion, sysadmin | No Comments »