How to find the LFS store disk usage for each LFS enabled repository in Bitbucket Data Center
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
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, attaching a screenshot for clarity.
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.
環境
The solution has been validated in Bitbucket Data Center 7.x but may be applicable to other versions.
ソリューション
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