juicedata / juicefs

JuiceFS is a distributed POSIX file system built on top of Redis and S3.
https://juicefs.com
Apache License 2.0
10.97k stars 971 forks source link

"df" shows used space is not accurate #5203

Open frostwind opened 2 months ago

frostwind commented 2 months ago

What happened: We use Ceph 16.2.x RADOS as backend storage and use PostgreSQL 17 as metadata storage. After many operation of rsync/juicefs sync, "df" is showing much larger space usage(263GB) than its real use in both RADOS pool(29GB) and "du -sh " on juicefs. Seems "df" used space is reported from jfs_counter.usedSpace. I've tried all the command available in juicefs, eg gc/fsck/compact but none of them help to fix it. Seems there is not providing a function to recalculate jfs_counter.usedSpace from underlying metadata , if there is any available function to do so , please let me know. Thanks

[root@vbakjob05 jfs]# df -h Filesystem Size Used Avail Use% Mounted on JuiceFS:myjfs 2.0P 263G 2.0P 1% /jfs

[root@ceph1 ~]# ceph df|grep jfs --- POOLS --- POOL ID PGS STORED OBJECTS USED %USED MAX AVAIL jfs 59 32 29 GiB 57.34k 85 GiB 0.02 119 TiB

[root@vbakjob05 jfs]# du -sh 29G .

postgresql metadata

jfs=# select * from jfs_counter; name | value
---------------------+-------------- nextTrash | 7 nextSession | 32 nextInode | 507906 lastCleanupFiles | 1727581443 nextCleanupSlices | 1727581457 lastCleanupSessions | 1727581492 nextChunk | 475137 lastCleanupTrash | 1727578016 usedSpace | 281507139584 totalInodes | 251264 (10 rows)

Environment:

davies commented 1 month ago

We should provide a way to fix it.