Which are the most important files to backup in a Debian server?
Hi everyone,
Let me further elaborate on the title of this post. I have a home server (in a constant testing environment, so to speak) running Debian Squeeze, and use it as file server (with SAMBA), print & scan server (with CUPS and SANE), mail server (POSTFIX), web server (APACHE), database server (MySQL), and would like to backup the most important configuration files for each package. The questions are: 1) Which files should I backup? (I am assuming that backup-ing the entire /etc/package_name folder maybe would be too much). 2) I know how to create a tgz backup package and do it periodically using Cron, for example. But should I do a full backup, a differential backup, or an incremental one? Which one would be better and how do I do it? |
Two things I'd like to mention... backing up /etc/package_name is likely too little. You *should* back up all of /etc just in case you accidentally forget a configuration you wanted. You'll have all configs to reference in that case. Second, depending on how you configured your server there is variable data for each package located in /var (e.g. /var/lib/mysql or /var/www).
As for your backup strategy it depends on how much disk space you have on the remote machine to run backups. Assuming you know the terms I'd say that it is better to create backups using rsync and set it up so that it runs regularly with cron. It is better to over-backup than not enough. Remember, if you're dealing with imperative data (i.e. financial, business, your own development sources) then hard drives are cheap and data is expensive. E.G. If I put a 1000 hours into developing a project it is cheaper to buy a 2TB hard drive for $100 and back it up than it is for me to recreate the work. At the very least if you're not going to run backups then you should at least create a mirror of your data (also using rsync). You should also cron job regular dumps of your MySQL database as it's easier to recover from a dump than the raw DB files (not impossible just more steps). Hope that helps, as always there's tons of resources on the net for the subject. SAM |
Quote:
Here's the listing of my /var/lib directory. Besides mysql and www, which ones would you backup? Code:
total 236K |
Quote:
Please understand it is difficult for me to convey what exactly you should back up because I don't know what you use your system for. You could explain all day how you use your system and I still could not know the full scope. Why not back up all of var? Here's how big var is on my system... Code:
root@farcry:~# du -shc /var /etc Guidelines List out your currently used applications, constraints, and requirements on pen and paper (or use a text editor).
Now with your lists in hand get more detail on each application/item. For example if you run this command to see free disk space... Code:
df -h If you don't have that ability (due to limited hard drive space) then investigate each application that you use and figure out exactly how you use it. Once you know how you use it figure out the parts of it that may need backing up whether it's user data, meta data, configurations, database backends, and so forth. For example, if you use MySQL for your application and you don't care about the data in the database then you might not care to back it up since you can just use the schema files and easily recreate the database. Another example, if you're using an application with defaults without customizing it then why bother backing up a default configuration? In that list you gave me, there are tons of things which I would configure and customize but that doesn't mean that you use it. So giving you an application specific recommendation is not useful for you. Remember Backups and redundancy are two different things so it's still possible for you to lose your backup if the hard drives fail or say your house is broken into and they steal your computer (along with all the drives). That's why things such as RAID and offsite backups exist. RAID 1 disk mirroring is the best redundancy if you have enough hard drives (and that can be bested with replication to multiple drives). For offsite backups, hopefully you have a friend that you can do this with like you backup your stuff to his drive and he backs up his stuff to your drive. |
Man, that was some awesome explanation. Thank you SO very much. I will mark this as SOLVED (I already added to your reputation AND clicked your last post as HELPFUL ;) ).
|
Thanks, glad I could help :) One thing I corrected from my original post is I changed /var/lib/www to /var/www.
|
All times are GMT -5. The time now is 03:15 AM. |