自动备份元数据会计算 --subdir 配额的 inode 数量,但会将整个卷备份
What happened:
When a client is mounted with --subdir and that subdirectory has a quota, the automatic metadata backup (--backup-meta) takes the inode count from the quota, but dumps the whole volume. Backup gets the count with m.StatFS(ctx, meta.RootInode, ...) (backup.go#L72). With --subdir, checkRoot(RootInode) returns the mounted subdirectory (base.go#L645-L654), and StatFS then reports UsedInodes of its quota (base.go#L1115-L1159). The dump starts from inode 0, the root of the volume (backup.go#L124).
Both checks that use the count get the small number: the skip for more than 1e6 inodes with an interval of 1 hour or less (backup.go#L73-L77) does not fire; fast mode turns on when the count is below 1e5 (backup.go#L87), so for SQL and TKV engines the dump loads the metadata of the whole volume into memory (sql.go#L4905-L4912).
A --subdir mount with a quota is the usual setup in juicefs-csi-driver: each dynamically provisioned PV is a subdirectory with a quota, and --backup-meta stays at the default 1h. juicedata/juicefs-csi-driver#1648 (mount pod OOMKilled hourly, stops with --backup-meta 0) may be related, but I have not confirmed that this is the cause there.
内容来源: juicedata/juicefs