Repository navigation
Description
Environment
- OpenCloud Version: 7.2
- Deployment: Docker
- Storage backend: POSIXFS
- Linux: Debian
- STORAGE_USERS_POSIX_WATCH_FS=true
Summary
After importing a large dataset into a POSIX-backed Space and performing large move operations via the Web UI, the reported folder sizes and space quota became incorrect.
The filesystem contents are correct and all files are accessible, but OpenCloud reports significantly smaller sizes than actually exist on disk.
Dataset
- ~199,886 user files
- ~609 GB of user data
- ~211,294 metadata files inside
.oc-nodes
Steps performed
- Created a POSIX-backed Space.
- Enabled:
STORAGE_USERS_POSIX_WATCH_FS=true- Imported approximately 200,000 files (~609 GB) directly into the POSIX filesystem.
- Waited until OpenCloud detected the files.
- Performed large move operations using the OpenCloud Web UI.
- During the move operation the following errors appeared repeatedly:
could not get spaceID and nodeID from cache
error="context canceled"
error in jetstream kv operation, retrying
error="context canceled"
- Restarted OpenCloud.
The cache-related errors disappeared after the restart, but the incorrect folder sizes and quota remained.
Expected behavior
The reported Space size, folder sizes and quota should match the actual filesystem usage.
Actual behavior
Filesystem:
- User data: 609 GB
- User files: 199,886
OpenCloud:
- Space size: 148 GB
- Quota used: 148 GB
Both values are incorrect.
Example
Filesystem:
Einsortieren/
170 GB
OpenCloud:
Einsortieren/
38 GB
Another folder:
Filesystem:
2025/
49 GB
OpenCloud:
51 GB
So some folders report correct sizes while others are significantly underestimated.
Additional observations
The filesystem appears completely consistent.
find . -type f | wc -l
199886
OpenCloud metadata:
find .oc-nodes -type f | wc -l
211294
Metadata directory sizes:
.oc-nodes 170 MB
.space 66 KB
.Trash 45 KB
.oc-tmp 512 B
No hardlinks exist:
find . -type f -links +1
returns no output.
Quota behavior
The quota is not correct initially, but is updated incrementally.
Example:
Initial state:
- Actual filesystem usage: 609 GB
- Reported quota: 148 GB
After uploading a new 600 MB file:
- Reported quota immediately increased to 148.6 GB
The uploaded file is added correctly, but the missing ~461 GB are still not reflected.
The reported Space size did not change after the upload.
What has been verified
- All files are accessible.
- Random files can be opened successfully.
- No missing folders found during manual verification.
- No duplicate user files exist.
- Filesystem usage is correct.
- Metadata directories are small.
- The issue only affects the reported quota and tree size.
Additional information
While searching the documentation I found the following note in the POSIXFS documentation:
"Editing or deleting large numbers of files may cause errors in tree size calculation."
This seems related to the behavior I am observing.
Although my scenario is slightly different (large initial import followed by large move operations in the Web UI), the result appears similar:
- incorrect tree size
- incorrect quota
- inconsistent folder sizes
- existing data remains accessible
- newly uploaded files increment the reported quota, but the initial values remain incorrect
I am therefore wondering whether the internal tree size / quota metadata may have become inconsistent during the import or move operations.
If this is expected behavior after very large operations, is there currently a supported way to rebuild or recalculate the tree size and quota metadata for an existing POSIXFS Space?
Question
Is there a supported way to rebuild or recalculate the POSIXFS tree size / quota metadata after very large imports or move operations?
Or could this be a bug in the POSIXFS tree size calculation?
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsPrio <= 3
Activity
overlinden commentedon Jul 14, 2026
After some systematic testing, I found additional information that may help identify the root cause.
Test setup
I created a small directory tree:
All files were fully assimilated by OpenCloud:
user.oc.idexistsuser.oc.parentidis correctuser.oc.blobsizeis correctThe files are visible in the Web UI and their individual file sizes are displayed correctly.
Initial observation
Several directories had
or no
user.oc.treesizeattribute at all, although they contain files.Experiment 1
I removed only the
user.oc.treesizexattr from a directory containing files.Creating a new file inside that same directory caused OpenCloud to recreate
user.oc.treesize, and the value was calculated correctly.This indicates that OpenCloud is capable of rebuilding a missing
treesize, but only for the directory where the write operation occurs.Experiment 2
I removed
user.oc.treesizefrom both a parent directory and its child directory.Then I created a file in the parent directory.
Result:
treesizewas recreatedtreesizewas still missingDeleting the newly created file caused the child directory to receive a
treesizeattribute, but this behaviour became inconsistent with deeper directory structures.Experiment 3 (three-level hierarchy)
I removed
user.oc.treesizefrom:Then I created a file in the parent.
Result:
treesizetreesize=0treesizeNext I created a small file directly inside the grandchild.
Result:
The parent directories only propagated the delta of the new file instead of recalculating their aggregated tree size.
Conclusion
The behaviour appears to be:
user.oc.treesize, a write operation inside that directory rebuilds its own tree size correctly.This leaves the metadata inconsistent if descendant directories have missing or invalid
treesizevalues.This behaviour would explain why:
blobsizevalues are correct,It seems that there is currently no recursive "rebuild tree size" operation, and once incorrect
treesizevalues exist, normal delta propagation cannot recover from them.This behaviour was reproduced multiple times with different directory structures and consistently produced the same results.
overlinden commentedon Jul 14, 2026
After some additional investigation, I found a workaround that successfully repaired the incorrect directory sizes and quota calculation in my environment.
The issue appears to be caused by incorrect or missing
user.oc.treesizexattrs after importing data directly into the POSIXFS backend (in my case viarsyncwhile using the POSIXFS collaborative mode). Files themselves were assimilated correctly (user.oc.id,user.oc.parentid,user.oc.blobsize, checksums, metadata, etc.), but many directoryuser.oc.treesizevalues were missing or incorrect.I wrote a small Python script that traverses the directory tree bottom-up, calculates the recursive sum of all regular file sizes for each directory, and updates the
user.oc.treesizexattr accordingly.After stopping OpenCloud, running the script, and starting OpenCloud again, the issue was resolved in my environment:
user.oc.treesizevalues.I have not observed any negative side effects so far. Nevertheless, I strongly recommend creating a backup of your xattrs or your storage before using the script, as it directly modifies filesystem metadata.
The script is attached to this comment in case it helps others who encounter the same issue. Please use it with caution and make sure to create a backup before modifying xattrs on a production system.
I still believe this should be fixed within OpenCloud itself, as a repair tool should not be necessary. However, until an official solution exists, this script may serve as a useful workaround.
opencloud_treesize_fix.py
erikboberg commentedon Jul 29, 2026
One of my folders had all subfolders registered as 0B in size after moving a lot of files into opencloud (migrating from seafile). I tried your script and it seems to have worked fine! Many thanks! I hope that this gets better implemented into the core opencloud application soon.
lucianomunoz commentedon Aug 11, 2026
Does it fix the missing data in open cloud,
i have data i see from the filesystem that OC was supposed to autodetect but never did.. Also to me the discrepacy is quite big, OC repords having 350gb while the data folder itself is about 4tb.
Thanks
micbar commentedon Aug 14, 2026
Autodetect is not enabled by default. See. https://docs.opencloud.eu/docs/next/admin/configuration/storage/storage-posix#posixfs-non-collaborative-mode
micbar commentedon Aug 14, 2026
@tbsbdr @aduffeck @rhafer setting p3.
It could be p2-ish
NickWalters commentedon Oct 6, 2026
Two open reva PRs address this:
context cancelederrors above), leaves the size in the old folder. That fits the folder that shows more than it holds (51 GB for 49 GB).About rebuilding the sizes: on 7.2.1 and later, a restart does it. The startup scan walks the whole storage and writes the tree sizes from disk, as long as
STORAGE_USERS_POSIX_SCAN_FSis on, which is the default. On 7.2.0 (reva v2.46.6) that scan skipped the storage root, which is probably why the restart here didn't help.