how to do backups in linux you might wonder?

the essentials

  • no offline time (system must always be up and usable)
  • backup must be consistent (lvm2 snapshots)
  • must be incremental (so single jobs are small-> therefore fast to do)
  • one must be able to put the backup everywhere (encrypted remote storage)

in my case ssh was used to copy the encrypted backup to a remote store but one can use smb:// also. in fact using smb:// is what acronis on windows does.

with my current setup i can do backups from everywhere with internetaccess.

the setup

my local disk is encrypted and i installed using a lvm2 system. therefore i can always 'freeze' the xfs partition / is on. when performing a incremental backup i need to 'snapshot' my root filesystem (namely /) and then perform a backup over the network (either lan or wlan). afterwards the snapshot can be removed but not removing a snapshot in lvm2 won't hurt either since lvm2 has persistent snapshots meaning you can even reboot without breaking the snapshot.

currently duplicity can't resume backups which were interrupted either by fault or intentional which is sad. if someone want's to fix this i would offer 100euro - if done nicely (i judge your work) ;-)

i use ssh certificates to automate remote login.

the script run by root

#!/bin/bash -v
umount /mnt/snap
lvremove /dev/vg/snap
lvcreate -L10G -s -n snap /dev/vg/root

# snapshot mounten
mount -o nouuid,ro /dev/vg/snap /mnt/snap

# backup machen
nice -n 19 duplicity -v 9 --ssh-options="-F.ssh/config" /mnt/snap/home/joachim scp://joachim-laptop@flux //mnt/sdb1/backups/joachim-laptop

on windows xp

on windows i use acronis which is a very nice tool.

  • it can use 'shadow volumes' on ntfs which is equivalent to lvm2 snapshots
  • it uses also AES to encrypt the backup on the remote storage
  • it can use smb:// with login/password
  • it can be scheduled
  • it can be run incremental

on mac os x

on mac os x i do backups with the leopard boot dvd. i create a image of the whole disk and store it on a different usb harddrive for later restore. quick backups can be done with time machine which i only used once.

i didn't find hfs+ write support (using a linux live cd) which forces me to use this mac os x leopard install cd which does not even include the 'vi' editor.


the best software is probably acronis 'true image' for windows. but if you have some time you can copy my script and adapt it to your needs then you can have this for linux as well. keep in mind: you need to have lvm2 to make it work snapshotted.


Powered by MediaWiki