Extreme Sys mods - how to backup?

bluehz

Registered
While this may not be a strictly UNIX question - I think you guys might know the answers better than others.

I have spent quite a bit of time learning UNIX and the OS X System and have been modifying my basic OS X 10.1.2 install pretty heavily. Compiling my own software and installing it, etc. One thing I can not get a good grasp on is where all this stuff that I modify/install is going. I mean sometimes it goes to /usr, sometimes into /etc, other times it might go into /Library or /System, etc. Most of the things I am installing include mail servers, etc. Various system/server mods.

My question is - what directories do I need to backup to safely save all the hours of work I have spent modifying this system so that in a catastrophic failure I could just reinstall and then run the backup to install all my mods.

Mind you I don't feel it necessary to backup all the basic stuff that gets installed - apps, etc. This is a waste of time and storage space. What I do want though is a THOROUGH backup that will return my system to the point it was before the failure.

Anyone have any suggestions as to just what I should backup?

- thx
 
This is a good question. It's unclear to me whether you have a firm grasp of the standard *nix-style file structure, so let's start there:

/: root level, often has kernel (unless it's in /kernel) and some other boot-level files

/bin: standard system-wide commands

/sbin: standard system-wide server/daemon commands

/usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin: user-level and user-installed commands and daemons

/usr/share, /usr/lib, /usr/include: shared support files for applications

/dev: device list

/var: system accounting files, such as logs (/var/log) and spools (/var/spool)

/tmp: temporary files, deleted by the system on a regular basis

/etc: configuration files

Now, OS X has its own system and library directories (/Library, /System/Library) as well, and we are now seeing more instances of *nix source code recognizing and using the OS X/Darwin directory structure in its installs. This means that sometimes an app you make yourself from the source code distribution will install itself in the standard *nix directories, and sometimes it will use some of the OS X directories as well.

This will stabilize over time, I bet. In any case, a typical *nix app installation will place files in one of the /bins or /sbins in /usr or /usr/local, and then corresponding library files in /usr/lib or /usr/local/lib, and then some manuals in /usr/man or /usr/share/man. The config files are generally placed in /etc or /usr/local/etc, and the log and account files are generally placed in /var or /usr/local/var, and so on.

You see the pattern. Basically, on a normal *nix machine, you back up /usr, /var, /tmp, /, and /home as separate partitions, so that any one can fail and not drag the others down with it. In OS X, this is complicated substantially by all the other stuff happening. But I think the theory should still hold -- if /usr, /var, /etc, /Library, and /System were all restorable, then you should be protecting anything that you altered as a part of your CLI adventures.

An additional note -- always pay attention to the feedback of your "make install"s! These will always be echoing to the CLI where they're placing their various files. There's almost always an install log left over in the source code directory telling you exactly where everything went.

Whew! I hope that was helpful.

Matt (billbaloney)
 
DUDE! That was a most excellent description of what's going on!!! I do have a good grasp of the nix file structure, etc. and I even watch the make install logs, etc. The problem is - the stuff is just flying all over the place. I keep telling myself I am going to document what gets installed where - but it has yet to happen. I have asked this question several times at several place and gotten the standard masse backup answer. Yours is the first GREAT DETAILED answer of exactly what I wanted to know. It is much appreciated!

- thx
 
One question though - lets say I wanted to mirror a mod system from one machine to another. I have been having pretty good success using Tri-Backup to synch apps, etc. and they retain their permission, ownership, etc. What I worry about though is lets say I synch the /var dir in one machine to teh /var directory in the other - what happens with symbolic links and things of that sort when they get to the other machine? Will they still be pointing back to the original machine. Seems like this could cause all sorts of problems.
 
Symbolic links are very simplistic. There's no hidden information in there, just a simple pointer. So when you have a link to, say, /var/log/ftpd.log, and you move it to another machine, it will simply try again to point to /var/log/ftpd.log. In this way, symbolic links will move easily from machine to machine.

Of course, the file a symlink points to has to exist on the new machine; otherwise you're just introducing a bad pointer into your system, and that's never helpful.
 
Back
Top