How to find the LFS store disk usage for each LFS enabled repository in Bitbucket Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Every LFS enabled repo will create a separate folder in LFS store ($BITBUCKET_HOME/shared/data/git-lfs/storage). the name of the folder is in SHA format.

We need to find 2 things:

  1. The LFS folder is linked to which repository.

  2. Run du(disk usage command) on each LFS folder to find its size.

Environment

The solution has been validated in Bitbucket Data Center 7.x but may be applicable to other versions.

Solution

Building on the above example(screenshot)

  1. cd to the repository folder (<Bitbucket-home>/shared/data/repositories)

  2. Grep for the folder name(LFS store SHA folders) in the repositories location.

grep -r <LFS store folder SHA ID>
#Example: As per screen shot   grep -r 58b78567120e2e75d7d9 ./19/repository-config: hierarchy = 58b78567120e2e75d7d9   It will give you the repo ID, from the above example we found that repo id is 19.

This way you will find the LFS folder is linked to which repository.

The easiest way to get all repo id at once is querying the DB select * from repository

Now run the du command by navigating to $BITBUCKET_HOME/shared/data/git-lfs/storage and find the LFS disk occupied by each folder. 

storage % du -h 58b78567120e2e75d7d9  4.0K 58b78567120e2e75d7d9/01 4.6M 58b78567120e2e75d7d9/c4 6.0M 58b78567120e2e75d7d9/8c  11M 58b78567120e2e75d7d9

Quick Reference:

For Bitbucket DC 7.x and later, you can find LFS usage for all repositories using following script:

Note: Execute the following script from $BITBUCKET_HOME directory

# !/bin/bash # Run from $BITBUCKET_HOME LFS_DIR="shared/data/git-lfs/storage" REPO_DIR="shared/data/repositories" for lfs_folder in "$LFS_DIR"/*/; do sha=$(basename "$lfs_folder") repo_id=$(grep -r "$sha" "$REPO_DIR" 2>/dev/null | grep -oE '[0-9]+/repository-config' | grep -oE '[0-9]+' | head -1) size=$(du -sh "$lfs_folder" 2>/dev/null | cut -f1) echo "LFS SHA: $sha | Repo ID: ${repo_id:-unknown} | Size: $size" done

The output include each LFS store folder with its linked repository ID and disk size in one pass.

Sample Output:

LFS SHA: 79a0e40c6abf03b10dd0 | Repo ID: 43 | Size: 21M

For repository ID → repository name mapping, query the database: SELECT id, slug, name FROM repository WHERE id IN (<repo_ids>);

How to confirm your LFS usage data is accurate

  1. Cross-check the total LFS size against the overall git-lfs/storage directory: du -sh $BITBUCKET_HOME/shared/data/git-lfs/storage

  2. The sum of individual LFS folder sizes should equal the total — any significant discrepancy indicates orphaned LFS objects (not linked to any repository)

Updated on June 24, 2026

Still need help?

The Atlassian Community is here for you.