Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

recover bitbucket from old backup

Bradley Moravek June 10, 2020

Simple background....

Due to heat issues we (me) is recovering a bitbucket server back to operations on some new metal.  I guess some servers just don't like 120 degree temp spike when the room a/c failed.  The backup local NAS went south for the winter taking all of the current data with it.

The last off site backup was 30 days old.  I did have  a fresh backup (git clone) of the project a few hours before the server got toasted. 

I obtained access to a new VM, installed the same version of bitbucket, moved the data directory back over the fresh install.  The system came up, showed all the projects as valid but 30 days out of sync.

I patched up the OS, bitbucket (7.2), and git to current.

Now to stuff (update) bitbucket with my git clones that I managed to capture right before all the fun happened.

My goal would like to keep all the branches, etc intact so history is preserved based off that git clone of the project.

 

right now I am thinking git push origin master might do the trick for normal git, might have to mess with pull requests?

 

 

 

2 answers

2 accepted

0 votes
Answer accepted
Bradley Moravek June 13, 2020

I had some fun on some of the fixes - I had two project types that this impacted:

 

The first my standalone 'git clone' was using the original myproject.git.  However, one of the people thought how nice; lets change it to something else  Odd part was that the backups continue to collect data and it was stale.  No use restoring a old git clone backup.  So this project will end up with oh a few weeks of lost data.  Lucky it was after a major release so the impact was small.  I did notice that this bug within bitbucket failing to remove dead projects was fixed in the current major release.

 

The second project did have valid project.git so the backups were fine.  I went online to the project to let me do a full level push with my user ID to avoid the pull request.

 

The push seemed to have worked, the diff -r between new and old project directories  only showed some deltas within the '.git' directory so the push was good. 

 

I also had a fork(ish) of this project after the server was toasted.  I did take the approach of a new project name  to indicate that parts of the history were gone.  It was a fork but not a fork.  A lot of the middle non-release branches were trimmed out so some history was lost, but not a big deal.  If old history is needed I have the original project which will go read only.  For new work I will use the new project name.

0 votes
Answer accepted
Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 11, 2020

Hi Bradley,

I think in the interest of consistency I would start over. Create a new install of BB (or just delete the current home directory), then create the projects and repos and push the content into the repos from the file system backup you have (see https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html for details).

Cheers,

Christian

Premier Support Engineer

Atlassian

Bradley Moravek June 13, 2020

I did take this approach when I found a project and a back up version that had removed some of the historical data.  They had trimmed out some of the dead wood for updates that were / will never be accepted.

For me one of the keys was using git config --list between the projects to notice that the remote project "myproject.git" had changed.   This made that project a dead end for upgrades by me.

The second key was to allow me to do a full push back into the project.  This worked fine and did capture the current status of the server before it was 'retired'.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.2
TAGS
AUG Leaders

Atlassian Community Events