Live Stash backups via filesystem snapshotting


I understand that Atlassian recommends shutting off Stash before taking backups to ensure data consistency.

I was thinking about using filesystem snapshotting as part of a live backup policy. If the git repositories and [PostgreSQL] database all reside on the same ZFS volume, and if I take a ZFS snapshot of that volume, and would I be able to restore that snapshot, and would the restored data be consistent and usable by Stash?



1 answer

1 accepted

0 votes
Boris Berenberg Community Champion Mar 15, 2013

Hey Eric,

That is the nature of filesystem snapshots, you don't know about the data consistency of open files. I would recommend using a script to perform a pgdump first, then you can perform a filesystem snapshot. I am not sure about the rest of the open files, but I think that you should be able to replace / rebuild them if they are corrupted.


Hi Boris,

Thanks for your response. I wanted to take a single filesystem snapshot, including WAL logs, both for convenience and also to try to keep the database and git repos as close in sync as is reasonably possible. According to the PostgreSQL documentation and what I believe to be true about ZFS snapshots and git, and assuming fsync()s work all the way down to the disks, I believe that restoring such a snapshot should be like recovering from a power outage:

  • The PostgreSQL database may lose in-flight changes, but should otherwise be restorable
  • git repos may have some corruption due to in-flight changes; it's a pain to clean up but it's doable

We'll schedule our backups around a time of day with the least amount of activity to avoid such data loss.



Boris Berenberg Community Champion Mar 19, 2013

Hey Eric,

I agree with your assesment. I would recommend testing this in a dev environment first.


Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

675 views 0 4
Read article

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