Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to backup my server that is hosting a few websites in such a way that I can restore everything to the way it was from a fresh format.

I know that I should backup all the home folders and then probably my /etc/ folders.

Is there a way to figure out all the folders that are relevant for backup in that they were not automatically generated or installed from apt-get?

It would ideally restore all the users with their current passwords as well.

Basically, enough to clone the system but only copying configuration files.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Also, if it's going about Debian, debsums -ce could show you changed configuration files.

share|improve this answer

You will certainly be interested in an article that I posted recently on my blog about important folders to backup (for Ubuntu but also applies to Debian).

It regroups common files that are usually changed by users. At least on a webserver.

Here's a summary.

If you look at the actual article, I've put commands related to each step.

  • /home entirely
  • /root entirely
  • /usr/local entirely (it commonly holds software manually installed by the sysadmin)
  • /etc entirely, or see below.
  • /var entirely, or see below.
  • Backup MySQL databases, users and privileges
  • List of installed packages using dpkg --get-selections
  • Diversions in /var/lib/dpkg/diversions

Also, for /etc and /var, you can be more specific:

  • Backup users, passwords and groups:
    • users and passwords are in /etc/passwd and /etc/shadow
    • groups are in /etc/group and /etc/gshadow,

    JUST take the lines containing users/groups that YOU created (usually they have a uid >= 1000)!

  • Backup crontabs, and atjobs `/etc/crontab` `/var/spool/cron/crontabs/` `/var/spool/cron/atjobs/`
  • Backup users' email `/var/mail/`
  • Websites `/var/www`
  • Backup needed config files in /etc/:
    • Apache2 vhosts
    • Networking configuration
    • Postfix configuration
    • Anything else you see in /etc/ and you wish to keep...

source: Things to remember to backup or copy when migrating servers [codealpha.net] source: Gilles and bofh's comments, thanks!

share|improve this answer
1  
Don't forget /root and /usr/local. In a typical setting, 90% of disk usage (not counting /home) will be from /usr, which is only supposed to contain distribution-installed data (save for /usr/local) that you do not need to backup. Storage is cheap, it's best to backup too much than not enough, so it's good to backup /etc and /var as a whole. –  b0fh Jul 24 '10 at 21:30
    
Thanks b0fh, I've updated my answer with your suggestion. I appreciate the comment. –  Weboide Jul 25 '10 at 12:09
1  
There may be a couple of things of interest in /var/lib/dpkg, such as the list of packages you have installed (best saved with dpkg --get-selections), and any diversion you created manually (all diversions are in /var/lib/dpkg/diversions). Also (though usually not for a server machine) game saves in /var/games. –  Gilles Jul 25 '10 at 18:28
    
Alright Gilles, thanks, I've added those to the list! –  Weboide Jul 25 '10 at 22:04

For your need Faubackup can help you out.Check this out.. ;) & It suits your requirement.

To install, As you said,

apt-get install faubackup
http://faubackup.sourceforge.net/
http://faubackup.sourceforge.net/man/faubackup.8.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.