I'm currently using a Virtual Server running Ubuntu Linux. The company hosting it does not do any kind of backups, but they offer me the oppertunity to do backups via FTP. Therefor, I get access to a FTP share of equal size to my primary server storage. There is no more help availbale than This is your FTP account data, have fun! but I guess I'm supposed to write a small script and run it as cron job. They promote their backup solution as if it's the best and easiest thing in the world, but right now I see many open questions.
So I'm not asking on how to write a shell script, but rather on what it should do.
First, I'll have to decide on whether I just want to backup some data folders (like the htdocs and a recent DB dump) or if I want to mirror the complete server. I'd like to do the latter, because I'm not only concerned about data loss, but going through the pains of server configuration from scratch, which usually keeps my busy for some days.
Next, I wonder if I will get any problems by backing up files which are currently accessed by some process, maybe even written to. Will I end up with corrupted files in my backup, will the backup just stop, or will the normal operation of the server be interupted?
If I had twice the backup space as my primary server, then I would upload the backup n, and after success, delte the backup n-1. But I only have space equal to my server's hard disk, so I cannot keep backup n and n-1 at the same time. But if I do it the other way round (that is, delete backup n-1 and then start uploading backup n) I'm going through times without any backup at all, which I'd like to avoid.
If I had physical access to that server, or at least access to the file cointing the virtual hard disk image of my VServer, I'd just backup that image and restore it as a whole. But sadly, I don't have that access.
And last thing, I'm also wondering how I'm supposed to restore that data in case the primary storage goes away. Is it possible, on Linux, to let the system overwrite itself with the backup data while it's running? Even if it is possible to tell the system to download everything via ftp, store it right at the file system root / and overwrite everything what's there, I'd still have to delete all the files which are there now but were not present in the backup.
Any help and ideas are much appreciated!