linux filesystem rotating incremental backup
I
recently got a new VPS from vpslink.com. Their service is great
because I can choose from a list of operating systems. I, of course,
chose “Hardy Heron”, Ubuntu 8.04. This service is totally unmanaged
other than DNS and billing so I have to manage everything myself,
including backup.
I haven’t found anything out there that I’ve fallen in love with as far as backup is concerned, so I started with a shell script that covered the basics. I needed a rotating incremental backup script with full backups performed once a week. I wanted all the backups to live in a top level path like /backup and I wanted the whole backup process to be owned and operated by a backup user. My distribution came with a backup user, it just needed to be configured.
So I created a home directory for the user at /home/backup and set its ownership and also created a /backup folder and set its ownership.
sudo mkdir /home/backup
sudo chown backup:backup /home/backup
sudo mkdir /backup
sudo chown backup:backup /backup
The backup user will be using tar to backup my system, including files that even the backup user shouldn’t be able to directly modify. So I modified my sudoers file to allow the backup user to use tar without providing a password (so it can be done automatically).