July 17th, 2010

Jaga |
unix  |   linux

While having a Linux computer, I wanted to have a monthly full backup, daily incremental backups and a weekly differential one.

I chose Flexbackup for taking backups. It has clean configuration file and enough options. A feasible backup method technology can be chosen from tar, cpio, afiodump, afio, GNU tar, cpio, star, pax, or zip. Flex handles all of them automatically and easily. Incrementals and differentials are also supported.

My setup

I equipped the backup server with Flexbackup, afio, buffer, finduitls and fileutils. Buffer is quite old software and does not support files that are having size of 2GB and more. Lucklily I don't have any large files among my work files. 

On the server, I made RSA keys in order to allow the script to log in and do its work without the need to answer a password request.

Then after some fiddling, the config file looks like this (these are only the lines that I changed) :

  1. $type = 'afio';
  2. $set{'root'}= 'athena:/root';
  3. $set{'conf'} = 'athena:/etc /boot&';
  4. $set{'mysql'}  = 'athena:/var/lib/mysql';
  5. $set{'sven'} = 'athena:/home/sven';
  6. $set{'httpd'} = 'athena:/home/httpd';
  7. $set{'svn'} = 'athena:/home/svn';
  8. $set{'projects'} = 'athena:/home/sven/NetBeansProjects';
  9. $set{'stuff'}  = 'athena:/stuff';
  10. $prune{'athena:/stuff'} = 'stuff';
  11. $buffer = 'buffer';  # one of false/buffer/mbuffer
  12. $buffer_megs = '20'; # buffer memory size (in megabytes)
  13. $device = '/home/backup';
  14. $remoteshell = 'ssh'; # command for remote shell (rsh/ssh/ssh2)
  15. $remoteuser = 'root'; # if non-null, secondary username for remote shells

The first $set-s are the dirs on my work computer, athena, that will be backed up, after I issue a command like 'flexbackup --set root --full' on the server. These are like short aliases.

Pruning must be inserted per directory-style and then there can also be subdirs in there.

Buffer will make copying faster and I raised the amunt of megabytes from 10 to 20.

Device can either be a directory or a tape backup device on the server itself.

Then finally there are some parameters for networking.

The first test run (flexbackup -set root -full) went fine, backing up a 132MB /root took some seconds.  Then the /home was 26 GB and took about an hour to back up. /home/backup on the server got cleanly named files like this:  athena-home.0.201007170538.afio-gz

Some handy commands:

Listing all the files inside a backup file:

  1. flexbackup -list athena-home.0.201007170636.afio-gz

Extract just one file
  1. flexbackup -extract athena-home.0.201007170538.afio-gz --onefile 'sven/pics/1/2010, July, 8/MVI_2913.AVI'

Restore some files from athena-home.0.201007170538.afio-gz listed in a text file named "filelisting"
  1. flexbackup -extract athena-home.0.201007170636.afio-gz -flist filelisting