System Backup: Auto-Clean and Lock added

I’ve updated the system backup script I’ve released 3 weeks ago to let it clean automatically rdiff-backup folders. This is mandatory because incremental backup process is transactionnal and a power failure or a reboot can break the consistency of the rdiff-backup data repository. So even if such a misfortune happened, the script will be able to revert backups to a previously consistent state.

I’ve also added a locking mechanism to prevent the script to be run twice on the same machine. I’ve added this feature because I start my script every day thanks to cron and some backups can take more than one day.

Finally, all rsync commands will now be run first to reduce the time-window during which all external machines are reached and, as mentionned above, because rdiff-backup can take lots of time to finish its job.

Here is a direct link to the new version of the script. You can also find it in my page dedicated to various linux scripts.

How-to Backup / Mirror a public SVN repository

In this little how-to I will show you how to backup a public SVN repository thanks to SVK, a tool build upon SVN framework that add decentralized capabilities.

First, create a local repository:

svk mirror //local https://username@svn.kde.org/home/kde

SVK will ask you to create a new repository. Tell it you want so:

Repository /home/user/.svk/local does not exist, create? (y/n) y

Then, sync the remote repository with the local one:

svk sync //local

That’s all !

To update your locale repository with the latest set of changes from the remote one, just run the previous command from time to time.

Now you can play with your local repository (/home/user/.svk/local in this exemple) as if it was a normal SVN repository !

Update: If you want to generate a vanilla SVN dump out of your SVK local mirror, as suggest by Thomas Mølhave in his “Remote Backup Of A Subversion (svn) Repository” blog post, use svnadmin:

svnadmin dump -r2:HEAD ~/.svk/local > my-repository-dump

How-to Block Ads in Konqueror

Starting from version 3.5, Konqueror feature an ad blocker mechanism based on regular expressions. Here is a little how-to to help you install an efficient filter set.

  1. Dowload the latest Filterset.G regexp set. The file which contain all rules is located at http://www.pierceive.com/filtersetg/ under the name YYYY-MM-DD.txt.
  2. Go to Settings > Configure Konqueror... menu.
  3. Then go to AdBlock Filters panel (the one on the screenshot).
  4. Check both Enable filters and Hide filtered images options.
  5. Use the Import... button to load the “Filterset.G” file you previoulsy downloaded
  6. Enjoy ad-free web sites !

By the way, I hope to see the feature suggested by Andreas Frische to get some attention by the Konqueror community: it would be nice to have an integrated auto-updater of filter set in Konqueror (and make this how-to deprecated).

System Backup on Unreliable Link thanks to rdiff-backup and rsync

I’ve just write a brand new script called system-backup.py. It’s similar to my website-backup.py script but instead of website and MySQL databases, it is designed to backup systems of several machines. This script is based on an idea from the “Backup up on unreliable link” article from the official rdiff-backup wiki. It use rdiff-backup to keep the last 20 backups and rsync to speed-up the backup process.

I run this script to backup all the local machines within my LAN. I start the backup process everyday thanks to a cron entry similar to this one:

0 20 * * * root /root/system-backup.py >> /mnt/backup-disk/backup.log

If you need more information about the rsync part the script, please have a look to my previous Remote Backup with rsync article, which detail how-to setup key authentification with ssh.

How-to grow any Qemu system image

Qemu images can’t be growed. In this example I will show you a little hack to grow a 6GiB qcow image to a 10GiB image. Beware: these operations can take a lot of time to perform and require lots of free space.

First, convert your qcow image to a plain raw file:

qemu-img convert system.qcow -O raw system.raw

Then, create a dummy file (filled with zeros) of the size of extra space you want to add to your image. In this case, 4GiB (=10GiB – 6GiB):

dd if=/dev/zero of=zeros.raw bs=1024k count=4096

Fearlessly, add your extra space to your raw system image:

cat system.raw zeros.raw > big10G.raw

After that you can boot qemu to verify that added free space is available:

qemu -hda big10G.raw

Here is an real case example of what you can see in a qemu image on which Windows XP was installed:

Now, to grow your primary partition, I suggest you to download a Live CD like gparted Live CD or System Rescue CD, and boot on the .iso file with qemu:

qemu -hda big10G.raw -cdrom gparted-livecd-0.3.4-5.iso -boot d

This will allow you to grow and manipulate all your partitions safely thanks to parted and other open source system tools.

Finally you can convert back your raw image to a qcow one to not waste space:

qemu-img convert big10G.raw -O qcow growed-system.qcow

That’s all !

By the way, I think it’s possible to perform the second and third step of this how-to in a single operation using dd only.

Update: I missed it, but this issue is also described in the FAQ from the unofficial #qemu wiki (look at “How do I resize a disk image?” question).