- svn
- code
- knowledge-backup
One of the projects I’m currently involved with requires taking over a technical infrastructure that was built over the past 15 years. It includes numerous tools, some of which haven’t been updated or used in years. Depending on our client’s needs, we might need to use these tools at some point. Documentation is often missing or scattered across many locations.
Recently, while trying to get one of these tools running, I suspected that the solution to a problem might be documented in some old code. The more recent code is hosted on a GitLab instance, but much of the older code was never migrated from SVN. Fortunately, I had access to an SVN backup output.
I ended up with a .svn file that was 33GB. A bit of research revealed that such files are typically created by running svnadmin dump and can be imported using the same tool.
After some digging, I found several Docker images suitable for running an SVN server. I opted for krisdavison/svn-server. I ran this image while mounting the backup and a /home/svn directory to store the restored data.
docker run -v $(pwd)/svn:/home/svn -v $(pwd):/backup -p 80:80 krisdavison/svn-server:v3.0
Once this was running, I had to create a new SVN repository with svnadmin create /home/svn/breeze
, which creates a new blank repository. Then, I imported the backup using svn admin load /home/svn/breeze < svndump.svn
.
The restore process took a lot longer than I expected. I leanred that svn admin
replays the commits insquence over the repository. It was fascinating to watch the file system evolve in real-time. I particularly noticed the moment the repository transitioned from a flat repository into a trunk-branch-tag structure.
Interestingly, the loaded SVN repository was only 17GB, while the dump file was 33GB. This initially caused me some concern, but further research clarified that svndump by default includes entire files for each revision, whereas SVN stores deltas with occasional snapshots. Considering the 2478 revisions, this size difference seems reasonable.