Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Migrating from Server to Cloud and switching to LFS

charles_blessing
Contributor
January 25, 2021

I am currently running a Bitbucket Server instance and I'm in the process of migrating it to the cloud.

The repo has steadily grown over the last few years and is now ~2.5Gb in size, so this seems like a good time to switch to LFS.

Unfortunately, the larger files in the repo are required and I'd rather not lose the history.

From what I've read so far, the best way to convert to LFS is to use BFG, so my main question is, what is the best order to do things in?

  1. Import the current repo into the cloud and then convert to LFS.
  2. Convert the current repo to LFS and then import into the cloud.
  3. Somehow import and convert simultaneously (this would be awesome, but I don't think it's possible).

From the moment I start the process until the moment it is complete, the programmers aren't going to be able to access the repo and they'll have to check-out the new repo when it's all done, so I'm aiming for the safest option with the least down-time.  I'm thinking this will be me working after everybody has committed all their changes and signed off for the day.

One side note - I ran a test import/convert (using option 1) and the result was that the repo still claimed to be taking up a ton of space and I also needed a ton of storage.  I've seen a few posts mention that I may need to contact Atlassian support about running a garbage collection to clear this up.

I look forward to hearing your suggestions/comments/ideas/feedback.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2021

Hi Charles,

I'm afraid that the importer in Bitbucket Cloud does not import LFS objects.

My suggestion would be the following:

  1. Take a mirror clone of the repo from the Bitbucket Server instance
  2. Convert it to LFS
  3. Create a new empty repo in Bitbucket Cloud, and push the converted repository to the empty Bitbucket Cloud repo

You can double check whether the LFS objects have been pushed if you go to Repository settings (in Bitbucket website) > Git LFS.

I suggest running also the following command inside the converted repo, after you use BFG and prior to pushing it

git reflog expire --expire=now --all && git gc --prune=now --aggressive

and then you can check the size of the local converted repo with

git count-objects -Hv

The sum of the fields size-pack and size in the output will give you the size of the git repo. If this differs from the size you see in the remote, you can open a ticket with the support team to run a git gc on the repo.

If you have any questions, please feel free to let me know!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events