1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[k8s] Longhorn で ファイルを削除しても Volume のサイズが減らない問題

Posted at

問題

Volume 内の巨大なファイルを削除したのに Volume サイズが減らない

image.png

原因

Longhorn はブロック単位でストレージを管理しているため、ファイルを削除しても Volume サイズが減らない仕様らしい

Users can see by default the volume actual size is not shrunk after deleting the 4 Gi data. Longhorn is a block-level storage system. Therefore, the deletion in the filesystem only marks the blocks that belong to the deleted file as unused. Currently, Longhorn will not apply TRIM/UNMAP operations automatically/periodically. if you want to do filesystem trim, please check this doc for details.

解決策

UI 上で Volume を選択して、 Trim Filesystem を実行すると、ファイルシステムのトリムが実行され、Volume サイズが減少します。

Trim Filesystem を定期実行するためには、以下のように RecurringJob を作成します。

apiVersion: longhorn.io/v1beta1
kind: RecurringJob
metadata:
  name: trim-filesystem
spec:
  cron: "3 10 * * *"
  task: "filesystem-trim"
  groups:
    - default
  retain: 1
  concurrency: 2

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?