1
0

More than 3 years have passed since last update.

GitLabCEで利用ファイルサイズが大きいプロジェクトを表示する一行コマンド

Last updated at Posted at 2020-01-12

自前運用のGitLabのバックアップサイズが、最近やけに増えたので、原因となっているリポジトリを探したコマンドです。

環境は以下の通りです。

  • GitLabCE (12.1.6)
  • Amazon Linux (ver1)
  • yumインストール

やり方はシンプルで以下の通り。

du -sm /var/opt/gitlab/git-data/repositories/*/* | sort -n

/var/opt/gitlab/git-data/repositories/ 配下に Group名/Project名 という形式で保管されてるので

  • ファイル容量を出力してくれる du コマンドに -s でサマライズしつつ、 -m で Mega 表記で出力
  • 並び替えをする sort コマンドで -n で数字の昇順にソート

しています。

表示サンプルは以下の通り。一番サイズが大きいプロジェクトは 487M で、 fuga/documents ということが分かります。表示が長ければ tail などで刻むのが良いでしょう。

[root@aws-morihaya-gitlab01 ~]# du -sm /var/opt/gitlab/git-data/repositories/*/*
227     /var/opt/gitlab/git-data/repositories/hoge/moristem-moge.git
312     /var/opt/gitlab/git-data/repositories/piyo/ROOT.war.git
369     /var/opt/gitlab/git-data/repositories/piyo/old_moristem-piyo.git
392     /var/opt/gitlab/git-data/repositories/hoge/item-hoge.git
487     /var/opt/gitlab/git-data/repositories/fuga/documents.git

この後は該当プロジェクトの管理関係者に「あなたのリポジトリのサイズが大きいんですが...?」とツッコミを入れる流れです。それでは良いGitLabライフを。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0