trapexit / mergerfs

a featureful union filesystem
http://spawn.link
Other
4.3k stars 174 forks source link

mergerfs return 0 available space if directory does not exist on local file system #1236

Closed claym closed 1 year ago

claym commented 1 year ago

Describe the bug

A clear and concise description of the unexpected behavior.

Doing a free space check in my mergerfs directory returns 0 available space if the checked folder does not exist on the local system.

To Reproduce

Steps to reproduce the behavior. List all steps to reproduce. All settings.

➜  ~ df -h /mnt/unionfs/Media/Comics
Filesystem      Size  Used Avail Use% Mounted on
mergerfs        1.8T   99G  841G  11% /mnt/unionfs
➜  ~ df -h /mnt/unionfs/Media/Comics/Marvel
Filesystem      Size  Used Avail Use% Mounted on
mergerfs        914G   64G     0 100% /mnt/unionfs

Expected behavior

I would expect it to return similar stats as the parent directory, as they are both on the same mount

System information:

OS, kernel version: Linux <hostname> 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux mergerfs version: mergerfs version: 2.36.0

Description=MergerFS Mount
After=network-online.target
[Service]
Type=forking
GuessMainPID=no
ExecStart=/usr/bin/mergerfs \
  -o category.create=ff,async_read=true,cache.files=partial \
  -o dropcacheonclose=true,minfreespace=0,fsname=mergerfs \
  -o xattr=nosys,statfs=full,statfs_ignore=nc,umask=002,noatime \
  /mnt/local=RW:/mnt/remote=NC /mnt/unionfs
ExecStop=/bin/fusermount -u /mnt/unionfs
Filesystem                                 Size  Used Avail Use% Mounted on
tmpfs                                      3.2G  3.6M  3.2G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv          914G   78G  799G   9% /
tmpfs                                       16G  4.0K   16G   1% /dev/shm
tmpfs                                      5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1p2                             2.0G  276M  1.6G  16% /boot
/dev/nvme0n1p1                             1.1G  6.1M  1.1G   1% /boot/efi
tmpfs                                      3.2G  4.0K  3.2G   1% /run/user/1001
revenge.local:/mnt/storage/media            13T  443G   13T   4% /mnt/nfs/revenge/Media
revenge.local:/mnt/storage/saltbox_backup   13T  1.2G   13T   1% /mnt/nfs/revenge/Backups
/mnt/nfs/revenge                           914G   64G  850G   7% /mnt/remote
mergerfs                                   1.8T  141G  799G  16% /mnt/unionfs
loop0                     squashfs    4.0                                                         0   100% /snap/core20/2015
loop1                     squashfs    4.0                                                         0   100% /snap/core20/1974
loop2                     squashfs    4.0                                                         0   100% /snap/snapd/19457
loop3                     squashfs    4.0                                                         0   100% /snap/lxd/24322
loop4                     squashfs    4.0                                                         0   100% /snap/snapd/19993
nvme0n1
├─nvme0n1p1               vfat        FAT32          2784-8365                                   1G     1% /boot/efi
├─nvme0n1p2               ext4        1.0            e16d998b-e656-4802-9fac-9d92d2448c0e      1.5G    14% /boot
└─nvme0n1p3               LVM2_member LVM2 001       6hIUAK-XcRE-0Mhe-Owww-LADx-txUZ-ZYlHi2
  └─ubuntu--vg-ubuntu--lv ext4        1.0            61743f95-e6af-4ab3-abe1-0c4af727b3f7    798.1G     8% /

Additional context

Remote system is NFS - accessed via rclone alias

trapexit commented 1 year ago

You set statfs=full so it is doing exactly as you told it to do. Only consider the full relative paths when calculating statfs for a path.

claym commented 1 year ago

Well that seems to be it. Thank you!