Stash Backup Client

Jim Winsor October 1, 2013

Is it possible to perform a partial backup/restore? It looks like the current version is all or nothing.

2 answers

1 accepted

1 vote
Answer accepted
mstudman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2013

The backup client backs up and restores two categories of Stash data: database data and filesystem data. It is designed for a full backup and restore but there is some flexibility in the settings which, although not the best fit, might help you in what you need to do.

Database data is always and in full backed up and restored. Now, by default the restore process will restore to the same database it backed up from. Say you didn't care about backing up and restoring the database data (because you already have systems in place to back this up) and only cared about the filesystem data. What you could do is override the target database for the restore so that it is restored to an in-memory database (a HSQL database) which you then discard. You would also have to reinstate the original database settings after restoring. I'll post more details only if you want to go down this route (as its not officially supported).

Filesystem data (managed git repositories, audit logs, plugins and data etc) is also always backed up and restored but you have flexibility in what gets backed up and thus what gets restored by varying the includes and excludes. The backup property that controls includes is stash.home.includes and its default value is "**/*" which is an Ant glob for all files. The property stash.home.excludes controls excludes and its default value is "" (although empty there is a default set of excludes that get added to this which is "export/**,data/db.*,tmp/**,log/*,plugins/.*/**,.lock,metadata.json,system.zip"). Excludes trump includes. You could add excludes to filter out the files you don't care about e.g. stash.home.excludes=data/repositories/29/**

One fly in the ointment with wanting a partial backup / restore of Stash files is that the restore process will refuse to run if the target directory is not empty. So if you wanted to do that you you will not be able to restore straight into a Stash home but rather will have to restore to a separate directory and subsequently move the files and folders to your Stash home.

It would be good to know why you want a partial backup and restore. Most customers who have asked this have pointed to the size of their repositories (hundreds of gigabytes) which may make it impractical for a full filesystem backup in acceptable time (since Stash is put into maintenance mode for the duration of the backup). Most of these customers assume they can rely on their own database and filesystem backup procedures to back their data. We must caution you that it is incredibly easy to make a corrupt snapshot of a Git repository if there are running Git processes writing to it at that time. This is why Stash goes into maintenance mode during the backup.

Jim Winsor October 3, 2013

Thanks for the answer.

The question of partial restore came from an admin who has had to restore parts of repositories from other CM tools than Git when a user accedentally removed files from source control. That may not be an issue with Git, but my experience level with Git is still pretty low, and I didn't have an answer for him.

0 votes
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2013

Jim: The client backs up the data below and I don't see an option to do partial backups. What are you trying to accomplish with a partial backup?

  • Stash data
  • Managed Git repositories
  • The Stash audit logs
  • Installed plugins and their data

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events