Linux 上 ZFS 的配额使用如何工作?

841*_*104 6 zfs zfsonlinux

我有一个用户根据 ZFS 达到他们的配额。但是,我无法找到他们如何使用所有空间。这个文件系统没有后代文件系统,根据手册页the userquota space calculation does not include space that is used by descendent datasets, such as snapshots and clones.为什么 zfs 和 find&du 有如此大的分歧?

# zfs get -H userquota@user1 zpool/zfs1 && zfs get -H userused@user1 zppol/zfs1
zpool/zfs1  userquota@user1  20G              local
zpool/zfs1  userused@user1  20.0G           local

# find $(zfs get -H -o value mountpoint zpool/zfs1) -user user1 -print0 | du -hc --files0-from=- | tail -n 1
5.9G    total
Run Code Online (Sandbox Code Playgroud)

此外,我还有另一个用户似乎遇到了相反的问题。

# zfs get -H userquota@user2 zpool/zfs1 && zfs get -H userused@user2 zpool/zfs1
zpool/zfs1  userquota@user2 50G local
zpool/zfs1  userused@user2  14.9G   local
# find $(zfs get -H -o value mountpoint zpool/zfs1) -user user2 -print0 | du -hc --files0-from=- | tail -n 1
81G total
Run Code Online (Sandbox Code Playgroud)

And*_*orn 2

在第一种情况下,也许 user1 的某些文件无法被 find(1) 发现,因为它们被安装在它们之上的某些文件系统隐藏了?

在第二种情况下,也许某些东西安装在 zfs1 安装点下的某个位置,并且您将其包含在空间计算中?

顺便,

zfs get -H -o value mountpoint zpool/zfs1
Run Code Online (Sandbox Code Playgroud)

将仅打印安装点,因此您不需要 cut(1)。