0

I intend to start incremental backups of my Fedora 20 system, and would like to know what root directories I should include, and what directories it is useful to exclude. I know there is a lot of information on this on the 'net already, but none of it seems to answer this simple specific question. Looking at the answers already available on this site, they are useful, but so many end in etc, instead of being specific, which is not really very helpful.

I assume that I needn't or shouldn't backup directories that are created or filled in by the system as it runs, for instance certainly not /run/media/Harry/CA6C321E6C32062B which is the hard drive that I will be saving the backup on. Are there any more like this?

I will be using rsync in the system described here, which I have already tested on small runs. I have looked into luckyBackup as a GUI front end, but get lost in its technicalities (please see my footnote). I will use its task manager to form the command I need for rsync, when I know what files to include and exclude.

In the event of a crash I envisage a re-installation of Fedora, then using the backup as a resource as I get going again, rather than trying to exactly reproduce the state just before the crash.

What files should I include and exclude specifically?

Footnote: In luckyBackup I do not see the way to use datestamps as in the reference I give, and I do not understand how to use the log of a dry run: why is it printed red, after some black lines at the start which I can no longer access because the log is so long?, and how do I find details of the errors to know if they matter? These are rhetorical questions, my real question is still only : what files to include and exclude, please?

Anthon
  • 78,313
  • 42
  • 165
  • 222
Harry Weston
  • 1,319
  • 5
  • 21
  • 35
  • (I know the possible-duplicate question approaches the subject from the opposite direction, but I believe an answer to one is also applicable to the other, given that there is a reasonably limited number of directories in the root directory on a *nix system. If you feel otherwise, please do edit your question to describe why.) – user Dec 20 '14 at 14:15
  • 1
    This is an obvious comment, but put text files you are working on under distributed version control, e.g. git or mercurial. Then is it easy to push these to remote place and is an effective form of backup. In practice this forms most of the valuable content on your hard drive. – Faheem Mitha Dec 20 '14 at 15:08

2 Answers2

4

The important things are your data! Programs (and the rest of the system) can always be re-installed from scratch from DVD and your distro's repositories. That said, it may be a good idea to back-up /etc with your configurations (if you've done many changes) and perhaps /usr/local if you've installed many packages locally.

The important stuff is /home with all your data... /var/mail or /var/spool/mail if you run a mail-server... local webpages (/var/www etc. )... and the content of your databases - MySQL, MariaDB, PostgreSQL (probably located somewhere in /var , but it may be better to do the backup with the database-server or a suitable program for dumping the databases).

Of course you may make a back-up of your whole system, but since most (except /home, mail and databases) aren't likely to change much, it's hardly necessary to do incremental backups of everything. If you have the storage-space and want to make a complete backup of the whole system, doing so once every 3rd month or so should be sufficient - as long as you do incremental back-ups of your data! But remember, except for your data and configurations, the whole system may be reinstalled from DVD and your distro's repository; so you don't need to back it up.

As for /home, mail and databases... Do a complete backup once a month... then a backup each week with weekly changes... and then finally each day - or perhaps several times a day - changes during the last day/since the last back-up. It depends on how much your home-directories, databases and mail changes each day and how important the data is.

Alternatively, if your data changes a whole lot over just a week, you may concider making a full backup once every week (instead of monthly). You may also concider different cycles for different type of data - eg. full backup of /home monthly, /mail daily and databases several times aday. It depends on what services you run and how important the data are.

PS: Making backup of a database that is running and therefore being changed, is a problem. Check your options and find the best solution for you.

Baard Kopperud
  • 7,023
  • 6
  • 42
  • 62
2

If you only have a root partition you should make a full backup of that (and if you have e.g. a separate /home you should back that up as well). The most easy way to do so is use the -x/--one-file-system option of rsync so that you can recurse from / downward without including temporary/virtual filesystems like /run/lock or /dev

The first time this will of course take some time, but further incremental backups ignore everything not changing. You could of course reduce the amount of data on the initial rsync enormously by excluding any files that were not changed after the install, assuming that those would be "restored" if you do a reinstall and then overwrite that, but there are IMO better ways of getting a quick and full restore (temporary booting from another partition or CD and restoring).

Anthon
  • 78,313
  • 42
  • 165
  • 222
  • Thank you Bssrd Kopperud and Anthon for two excellent answers. Unfortunately I can only mark one of them as "accepted" – Harry Weston Dec 24 '14 at 11:34