System Administration – Version Control for Administrators


Spiral staircase

There comes a time in the life of every administrator where you need to get access to an old version of a file, or get access to a file that has been deleted. I’m not talking about a user’s file, but your own file. We’ve all got little scripts and spreadsheets and text files that we use all the time. Perhaps you have a task that sounds similar to a batch file you wrote 3 or 4 centuries ago. It’d be handy to have that batch file, but you deleted during your last frenzy of hard disk clean-up. 
Introducing Source Code Management.  Most techies are familiar with the concept of source code management, but for many of us it’s something just for use by software developers who have to work in teams, manage different versions of products, deal with branching, and other advanced things. In a sense this is true, SCM is a critical tool for the software developer, particularly those working on teams. But that doesn’t mean that many of the advantages of SCM can’t be available for everyone else, even when working alone.
There are a couple of features of SCM that are helpful for any system administrator:
  • Versioning. The big strength of SCM tools are their ability to track changes in files over time. Suppose you have a text file containing the names of computers, and that you’ve added and removed names over the months. It’s handy to quickly look over the history of the file and see when and where it was changed.  Perhaps even with a note as to why it was changed.
  • File Recovery. Nothing in a SCM repository is ever deleted (unless you really go out of your way to remove it.) You never need to worry about deleted files disappearing, or have to worry about keeping it around cluttering up your disk in case you may need it.
  • Rollback. It’s becomes a lot easier to edit files if you know that at any time you can rollback to any previous version. No need to copy files around or make copies if you just want to test something.
But aren’t SCM tools just for teams working on the same files?  No, there’s nothing wrong with installing a SCM tool locally on your own computer and using it for your own repository. There is a bit of a learning curve but in my opinion it’s well worth it, especially the first time you’re able to rollback a file after you realize those changes you made 3 weeks ago broke something.
I’ve experimented with many systems over the years, but I’ve really only worked with three different SCM systems in-depth. There are many, many to choose from, but I’ll just mention those three. Listed in chronological order of my use.
  1. Microsoft Visual SourceSafe. This is a product that Microsoft purchased years ago and has been giving away with Visual Studio licenses for years. Most Windows developers cut their teeth on it, and speaking of teeth, it’s getting long in them. It hasn’t been actively maintained by Microsoft for quite a few years, and has been replaced by Visual Team System which doesn’t work very well for the single user. It’s got some well known problems, but it’s still very widely used because it’s pretty simple and was essentially “free” at a time when other solutions were either too complicated and/or expensive.
  2. Concurrent Versions System, or CVS. This is one of the most popular open source SCM systems, though it may now have been surpassed in popularity by Subversion. The system only has a command-line interface, but there is a whole ecosystem of add-ons and GUIs including my favorite, TortoiseCVS.  I replaced SourceSafe with CVS when I started working extensively in Linux and when my repository size got too large for SourceSafe to handle.
  3. Perforce. This is what I currently use and I love it. The installation is dead simple and it’s very light-weight. It just works and once you understand how to configure a workspace, the rest just falls into place. The nice thing is that while it can get expensive for a large team, it’s free for a single user (actually, free for 2 users) making it ideal for a lone wolf. It’s got a flatter learning curve than CVS and the other open-source systems, but it doesn’t sacrifice any power.
Next week I’ll write a quick tutorial to get you up and running with Perforce in your environment. There are also plenty of resources available online to get you started with other packages out there. If you’ve got some spare time (who doesn’t?!?) then this is one more tool to add to your arsenal.