1

I have been reading recently about backup strategies for Linux, particularly using the Bacula software.

It seems that this software is focused at providing backups in case of a hard server failure where data is not recoverable, ie the backup software will copy the files daily.

Yesterday I recursively changed the permissions of a directory which led to undesirable behaviour. How do I approach issues like this with a backup strategy? Realistically, something along the lines of 'Undo' functionality is what I would be looking for, as opposed to rewriting the whole image from scratch using a backup, which seems like overkill in this instance.

closed as too broad by kasperd, HopelessN00b, mdpc, MadHatter, mailq Nov 30 '14 at 0:00

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • So what are you asking here? How to undo your permissions snafu, or how to restore the directory that was affected? I'm a little confused because I assume you mean the former, but that isn't really related to backups. – Rob Moir Nov 29 '14 at 20:12
  • Essentially, I want to be able to tinker with things as a way to learn how things work with some form of confidence that if I get myself into a snafu as you put it, I can revert to the old state without a significant amount of work (ie backing up the whole server from a saved image). I am sure I can research how to fix the permissions problem, but my ideal case would be getting something set up where after I make my next error of that sort, I have a quick way to revert to my pre-tinker state. – user256349 Nov 29 '14 at 20:16
  • Your question is not about backup strategy, but rather about how to perform a partial restore, when you lost something but not everything. This is not something which can be completely generalized, because nobody can enumerate all the possible ways one could partially lose the data on a system. You could write a completely different question, which would be: How can I restore just the file permissions from Bacula without restoring full file contents. And will this leave the system in an operational state (the later can only be answered if we know which directory and which software). – kasperd Nov 29 '14 at 20:17
  • Ok, then partially restoring a server based on a Bacula backup is possible, I had imagined that may be a method. Also then, could it be said that copying the files on the server to create a backup of only that which I am about to tinker with, and then restoring based on that if something goes wrong is also a usable strategy in this case? – user256349 Nov 29 '14 at 20:24
  • 1
    Congrats for this wonderful bikesched question :-) Which other people probably won't say: backup should be as far, as it is possible - both in the physical space and in the virtual space. – peterh Nov 29 '14 at 20:46
2

It's always possible to do a partial restore of a backup. I'm not familiar with Bacula but I will outline the general methods:

  1. Most backup software actually allows you to do a partial restore of a full backup, by design. If you run the restore command for Bacula then I'm sure it will allow you to select a list of files or directory trees to restore. "Halp, I deleted $important_file can you get it back for me?" is one of the most common questions a sysadmin is likely to encounter.

  2. If that doesn't work then you can do a full restore onto a new system (I suggest a virtual machine) then copy the files and directories you need back to the original system. This is actually something you should already be doing as part of a backup strategy, because backups are useless if any subsequent restores don't work for some reason, and the way to protect yourself against that is to do test restores of this kind.

Lastly, when you're 'experimenting' in the manner you describe, it's entirely possible (and very common) to just create an archive of the files you're working with first and restore the archive after in the event of a problem. My suggestion is to just create a tar archive and make sure its nowhere 'near' the directories you're working with before you start.

  • 1
    Perfect, that answers all my questions exactly, thank you for your help! – user256349 Nov 29 '14 at 20:56
3

I've organized my backup strategy around rdiff-backup over NFS. It lets you access your backups as a simple mirror of your file system with the ability to get previous versions too.

  • 2
    I've put my backup script on pastebin. I'm not a Bash expert, but it works for me pastebin.com/Dga2bN29 perhaps this could help someone – Antony Gibbs Dec 1 '14 at 0:18

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