{"record":{"id":"4e87a2cae68f4d2d","repo":"juicedata/juicefs","slug":"stat-fs-v","errorCode":null,"errorMessage":"stat fs: %v","messagePattern":"stat fs: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/status.go","lineNumber":66,"sourceCode":"}\n\n// Status retrieves the status of the filesystem\nfunc Status(ctx context.Context, m Meta, trash bool, sections *Sections) error {\n\tformat, err := m.Load(true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load setting: %v\", err)\n\t}\n\tformat.RemoveSecret()\n\n\tsessions, err := m.ListSessions()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"list sessions: %v\", err)\n\t}\n\n\tstat := &Statistic{}\n\tvar totalSpace uint64\n\tif err = m.StatFS(Background(), RootInode, &totalSpace, &stat.AvailableSpace, &stat.UsedInodes, &stat.AvailableInodes); err != syscall.Errno(0) {\n\t\treturn fmt.Errorf(\"stat fs: %v\", err)\n\t}\n\tstat.UsedSpace = totalSpace - stat.AvailableSpace\n\n\tif trash {\n\t\tprogress := utils.NewProgress(false)\n\t\tdefer progress.Done()\n\t\ttrashFileSpinner := progress.AddDoubleSpinner(\"Trash Files\")\n\t\tpendingDeletedFileSpinner := progress.AddDoubleSpinner(\"Pending Deleted Files\")\n\t\ttrashSlicesSpinner := progress.AddDoubleSpinner(\"Trash Slices\")\n\t\tpendingDeletedSlicesSpinner := progress.AddDoubleSpinner(\"Pending Deleted Slices\")\n\t\terr = m.ScanDeletedObject(\n\t\t\tWrapContext(ctx),\n\t\t\tfunc(ss []Slice, _ int64) (bool, error) {\n\t\t\t\tfor _, s := range ss {\n\t\t\t\t\ttrashSlicesSpinner.IncrInt64(int64(s.Size))\n\t\t\t\t}\n\t\t\t\treturn false, nil\n\t\t\t},","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/status.go#L48-L84","documentation":"`juicefs status` calls StatFS on the root inode to report space usage. StatFS returns an errno; if that errno is non-zero (not the success sentinel 0), Status wraps it as 'stat fs'. It means the metadata engine could not compute total/available space or inode counts.","triggerScenarios":"Running `juicefs status META-URL` when Meta.StatFS returns an errno: metadata inconsistency for the root inode, backend timeout under load, or an engine-specific failure computing used space.","commonSituations":"Querying a volume with a corrupted/damaged metadata root entry; backend saturated (Redis blocked, DB long transaction) causing timeouts; extremely large inode counts making the stat scan slow and triggering timeouts on flaky networks.","solutions":["Read the wrapped errno: EIO/ENOENT suggests metadata damage; ETIMEDOUT/timeout suggests backend load.","Retry when the backend is less loaded; check redis latency doctor / mysql slow queries.","If ENOENT on root inode, the volume metadata is damaged — restore from a `juicefs dump` backup.","Ensure the client version is compatible with the volume (old client reading metadata written by a newer one); upgrade JuiceFS."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := execStatus(metaURL); err != nil && strings.Contains(err.Error(), \"stat fs\") {\n    // retry once after backend settles, then check metadata integrity\n    time.Sleep(5 * time.Second)\n    if err := execStatus(metaURL); err != nil { log.Fatalf(\"metadata may be damaged, restore from dump: %v\", err) }\n}","preventionTips":["Keep metadata backend load and long transactions in check","Schedule regular juicefs dump backups for corruption recovery","Run a JuiceFS client version compatible with the volume's metadata version"],"tags":["cli","metadata","statfs","redis","mysql"],"backgroundTag":"database-query-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}