It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Answer accepted
mstudman Atlassian Team Oct 03, 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,"). 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 votes
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 Sign up to answer
Community showcase
Published in Opsgenie

Authentication Options for Atlassian’s Opsgenie

What’s New as of May 21, 2020 Hi there! We recently made some changes to the way you can leverage Single-sign on and authorization within Opsgenie. Based on customer preference and feedback we intr...

90 views 1 1
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you