[SOLVED] Which are the most important files to backup in a Debian server?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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/lib/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
Thanks a lot for taking the time to answer and sharing your perspective. Hard drives are kind of expensive these days where I live (Argentina) but you're dang right, having to re-create a ton of work will end up being much more expensive (in terms of personal effort) if I lose something due to a hardware failure (as I mentioned, this is a home server I built with a very old computer -Compaq Presario with a 10 Gb hard disk, 256 Mb RAM, Intel Celeron 566 MHz... I'd say it's served its purpose - I don't mind it breaking down one of these days, but I'd be very pissed off if I lose all the configs I've made for the packages I mentioned earlier).
Here's the listing of my /var/lib directory. Besides mysql and www, which ones would you backup?
Code:
total 236K
drwxr-xr-x 2 root root 4.0K May 17 2010 alien
drwxr-xr-x 5 root root 4.0K Oct 30 19:49 apt
drwxr-xr-x 2 root root 4.0K Oct 30 19:49 aptitude
drwxr-xr-x 2 root root 4.0K Jun 25 11:44 aspell
drwxrwxr-x 2 root bind 4.0K May 29 00:20 bind
drwxr-xr-x 2 root root 4.0K Jan 11 2012 dbus
drwxr-xr-x 2 root root 4.0K Aug 15 15:53 debfoster
drwxr-xr-x 2 root root 4.0K Aug 15 16:56 deborphan
drwxr-xr-x 7 root root 4.0K Jun 25 11:46 defoma
drwxr-xr-x 2 root root 4.0K Jan 10 2012 dhcp
drwxr-xr-x 4 root root 4.0K Jun 25 11:44 dictionaries-common
drwxr-x--- 2 root root 4.0K Oct 24 21:51 dovecot
drwxr-xr-x 7 root root 4.0K Oct 30 19:49 dpkg
drwxr-xr-x 4 root root 4.0K Jan 31 2012 ghostscript
drwxr-xr-x 2 root root 4.0K Jan 10 2012 initramfs-tools
drwxr-xr-x 2 root root 4.0K Jan 11 2012 initscripts
drwxr-xr-x 2 root root 4.0K Jan 1 2011 insserv
drwxr-xr-x 6 root root 4.0K Sep 10 21:50 jffnms
drwxr-xr-x 2 root root 4.0K Oct 18 2009 john
drwxrwsr-x 2 libuuid libuuid 4.0K Aug 23 20:47 libuuid
drwxrwx--- 2 logcheck logcheck 4.0K Aug 27 22:02 logcheck
drwxr-xr-x 2 root root 4.0K May 19 08:25 logrotate
drwxr-xr-x 2 root root 4.0K Jan 12 2011 lsb
drwxr-xr-x 2 root root 4.0K May 19 00:36 mdadm
drwxr-xr-x 4 root root 4.0K Oct 22 10:52 mibs
drwxr-xr-x 2 root root 4.0K Oct 2 2011 misc
drwxr-xr-x 2 root root 4.0K Oct 31 06:26 mlocate
drwx------ 11 mysql mysql 4.0K Oct 29 15:22 mysql
drwxr-xr-x 2 nagios nagios 4.0K Sep 17 13:04 nagios
drwxr-x--- 4 nagios nagios 4.0K Oct 31 08:22 nagios3
drwxr-xr-x 3 www-data www-data 4.0K Sep 17 21:40 nagvis
drwxr-xr-x 6 statd root 4.0K Oct 29 15:22 nfs
drwxr-xr-x 2 ntp ntp 4.0K Oct 31 08:24 ntp
drwxr-xr-x 2 root root 4.0K Jan 10 2012 os-prober
drwxr-xr-x 2 root root 4.0K Jan 10 2012 pam
drwx-wx-wt 2 root root 4.0K Oct 22 13:39 php5
drwxr-xr-x 2 root root 4.0K Sep 10 22:17 phpmyadmin
drwxr-xr-x 2 root root 4.0K Oct 29 15:23 portsentry
drwxr-xr-x 2 postfix postfix 4.0K Jun 20 00:35 postfix
drwxr-xr-x 2 root root 4.0K Aug 13 21:44 pycentral
drwxr-xr-x 2 root root 4.0K Jul 28 21:42 python
lrwxrwxrwx 1 root root 18 Jan 10 2012 python-support -> /usr/lib/pymodules
drwxr-xr-x 2 root root 4.0K Nov 1 2010 rpm
drwxr-xr-x 5 root root 4.0K Jan 11 2012 samba
drwxr-xr-x 2 root root 4.0K Jan 10 2012 sgml-base
drwxr-xr-x 2 root root 4.0K Dec 26 2010 smartmontools
drwxr-xr-x 2 snmp snmp 4.0K Oct 29 15:23 snmp
drwxr-xr-x 2 root root 4.0K Oct 1 21:47 snort
drwx------ 6 root root 4.0K Jan 1 1985 sudo
drwxr-xr-x 2 root root 4.0K Jan 16 2011 supervise
drwxr-xr-x 3 root root 4.0K Jan 10 2012 tex-common
drwxr-xr-x 3 root root 4.0K Sep 17 21:46 ucf
drwxr-xr-x 2 root root 4.0K Oct 3 21:38 update-rc.d
drwxr-xr-x 2 root root 4.0K Oct 29 15:22 urandom
drwxr-xr-x 2 root root 4.0K Jan 10 2012 usbutils
drwxr-xr-x 3 root root 4.0K May 26 00:58 vblade-persist
drwxr-xr-x 3 root root 4.0K Jan 10 2012 vim
drwxr-xr-x 2 root root 4.0K Jan 31 2012 x11
drwxr-xr-x 2 root root 4.0K Jan 31 2012 xfonts
drwxr-xr-x 2 root root 4.0K Jan 10 2012 xml-core
Here's the listing of my /var/lib directory. Besides mysql and www, which ones would you backup?
Code:
total 236K
drwxr-xr-x 2 root root 4.0K May 17 2010 alien
drwxr-xr-x 5 root root 4.0K Oct 30 19:49 apt
drwxr-xr-x 2 root root 4.0K Oct 30 19:49 aptitude
drwxr-xr-x 2 root root 4.0K Jun 25 11:44 aspell
drwxrwxr-x 2 root bind 4.0K May 29 00:20 bind
drwxr-xr-x 2 root root 4.0K Jan 11 2012 dbus
drwxr-xr-x 2 root root 4.0K Aug 15 15:53 debfoster
drwxr-xr-x 2 root root 4.0K Aug 15 16:56 deborphan
drwxr-xr-x 7 root root 4.0K Jun 25 11:46 defoma
drwxr-xr-x 2 root root 4.0K Jan 10 2012 dhcp
drwxr-xr-x 4 root root 4.0K Jun 25 11:44 dictionaries-common
drwxr-x--- 2 root root 4.0K Oct 24 21:51 dovecot
drwxr-xr-x 7 root root 4.0K Oct 30 19:49 dpkg
drwxr-xr-x 4 root root 4.0K Jan 31 2012 ghostscript
drwxr-xr-x 2 root root 4.0K Jan 10 2012 initramfs-tools
drwxr-xr-x 2 root root 4.0K Jan 11 2012 initscripts
drwxr-xr-x 2 root root 4.0K Jan 1 2011 insserv
drwxr-xr-x 6 root root 4.0K Sep 10 21:50 jffnms
drwxr-xr-x 2 root root 4.0K Oct 18 2009 john
drwxrwsr-x 2 libuuid libuuid 4.0K Aug 23 20:47 libuuid
drwxrwx--- 2 logcheck logcheck 4.0K Aug 27 22:02 logcheck
drwxr-xr-x 2 root root 4.0K May 19 08:25 logrotate
drwxr-xr-x 2 root root 4.0K Jan 12 2011 lsb
drwxr-xr-x 2 root root 4.0K May 19 00:36 mdadm
drwxr-xr-x 4 root root 4.0K Oct 22 10:52 mibs
drwxr-xr-x 2 root root 4.0K Oct 2 2011 misc
drwxr-xr-x 2 root root 4.0K Oct 31 06:26 mlocate
drwx------ 11 mysql mysql 4.0K Oct 29 15:22 mysql
drwxr-xr-x 2 nagios nagios 4.0K Sep 17 13:04 nagios
drwxr-x--- 4 nagios nagios 4.0K Oct 31 08:22 nagios3
drwxr-xr-x 3 www-data www-data 4.0K Sep 17 21:40 nagvis
drwxr-xr-x 6 statd root 4.0K Oct 29 15:22 nfs
drwxr-xr-x 2 ntp ntp 4.0K Oct 31 08:24 ntp
drwxr-xr-x 2 root root 4.0K Jan 10 2012 os-prober
drwxr-xr-x 2 root root 4.0K Jan 10 2012 pam
drwx-wx-wt 2 root root 4.0K Oct 22 13:39 php5
drwxr-xr-x 2 root root 4.0K Sep 10 22:17 phpmyadmin
drwxr-xr-x 2 root root 4.0K Oct 29 15:23 portsentry
drwxr-xr-x 2 postfix postfix 4.0K Jun 20 00:35 postfix
drwxr-xr-x 2 root root 4.0K Aug 13 21:44 pycentral
drwxr-xr-x 2 root root 4.0K Jul 28 21:42 python
lrwxrwxrwx 1 root root 18 Jan 10 2012 python-support -> /usr/lib/pymodules
drwxr-xr-x 2 root root 4.0K Nov 1 2010 rpm
drwxr-xr-x 5 root root 4.0K Jan 11 2012 samba
drwxr-xr-x 2 root root 4.0K Jan 10 2012 sgml-base
drwxr-xr-x 2 root root 4.0K Dec 26 2010 smartmontools
drwxr-xr-x 2 snmp snmp 4.0K Oct 29 15:23 snmp
drwxr-xr-x 2 root root 4.0K Oct 1 21:47 snort
drwx------ 6 root root 4.0K Jan 1 1985 sudo
drwxr-xr-x 2 root root 4.0K Jan 16 2011 supervise
drwxr-xr-x 3 root root 4.0K Jan 10 2012 tex-common
drwxr-xr-x 3 root root 4.0K Sep 17 21:46 ucf
drwxr-xr-x 2 root root 4.0K Oct 3 21:38 update-rc.d
drwxr-xr-x 2 root root 4.0K Oct 29 15:22 urandom
drwxr-xr-x 2 root root 4.0K Jan 10 2012 usbutils
drwxr-xr-x 3 root root 4.0K May 26 00:58 vblade-persist
drwxr-xr-x 3 root root 4.0K Jan 10 2012 vim
drwxr-xr-x 2 root root 4.0K Jan 31 2012 x11
drwxr-xr-x 2 root root 4.0K Jan 31 2012 xfonts
drwxr-xr-x 2 root root 4.0K Jan 10 2012 xml-core
Thanks again.
If you're using your computer as your main driver then you'll probably want to backup the /home directory too.
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
1.5G /var
21M /etc
1.5G total
root@farcry:~#
For me, it's a no brainer to back up all of the /var directory because I have the spare disk space available. There is no such thing as a single backup strategy for all. Perhaps it would be better for me to give you guidelines on how you can effectively back-up your system rather than tell you which specific applications.
Guidelines
List out your currently used applications, constraints, and requirements on pen and paper (or use a text editor).
Currently used applications would be your mission critical apps. For example, MySQL or Apache or Nagios monitoring etc.
Constraints are your limiting factors such as the number of hard drives you have to back up to, the size of the hard drives, the free disk space on those hard drives, etc.
Requirements are things you absolutely require to have backed up. These are things you can't compromise on. This would be something like your own personal source code repository, configurations you heavily customized away from application defaults, etc.
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
and you find that you can back up the whole system then just back up or mirror the whole system and be done with it.
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 ).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.