Stash Backup Client

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

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,"). 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.

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 vote
Jeff Thomas Atlassian Team Oct 03, 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 Join to answer
Community showcase
Louis De Jaeger
Posted Thursday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

174 views 12 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot