Subversion Backups and Restores
One thing that a lot of developers don’t even think about is backing up their source control repository. If, like me, your code is stored in Subversion then backing up and subsequently restoring the data is easy.
Backing Up
svnadmin has an option to do a dump which is a full command history of your repository. Because of this the file can end up quite large if you have a repository with a lot of changes. A quick way to back up and compress the repository is:
1 | $ svnadmin dump /path/to/repo | gzip -9 -c > archivename.gz |
This dumps the repository straight into gzip to compress it down to then write it to a file. With a little bit of shell scripting this can be turned into a very nice backup script.
Restoring
What happens when you need to restore your repository? You load the information back in! You can take the backup we made above and reload it into the repository with:
1 | $ gzcat archive.gz | svnadmin load /path/to/repo |
This will dump your backup into a fresh repository so that it looks exactly like it did when you took the backup.
Reset a Lost root Password
What happens when that server that was always humming along nicely all of a sudden needs you to log in as root to check something or install something new. What was the root password? Didn’t it just get changed? All of a sudden, the cold sweat starts - the root password is unknown.
What do you do?
Reset it! Thankfully there are a few ways to do this.


