df diskspace calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am wondering if the calculations for disk space can be improved?

If we look at my current root filesystem, the available space is reported as 163GiB, but I think it would be more reasonable to report this as 158GiB. This is because we have to deduct any metadata allocation what would happen when filling up the filesystem.

df and btrfs fi usage numbers:
==============
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       234G   71G  163G  31% /

# btrfs fi us /
Overall:
    Device size:                 233.47GiB
    Device allocated:             75.03GiB
    Device unallocated:          158.44GiB
    Device missing:                  0.00B
    Used:                         70.36GiB
    Free (estimated):            162.55GiB      (min: 162.55GiB)
    Data ratio:                       1.00
    Metadata ratio:                   1.00
    Global reserve:              192.73MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:73.00GiB, Used:68.88GiB (94.36%)
   /dev/sda3      73.00GiB

Metadata,single: Size:2.00GiB, Used:1.47GiB (73.63%)
   /dev/sda3       2.00GiB

System,single: Size:32.00MiB, Used:16.00KiB (0.05%)
   /dev/sda3      32.00MiB

Unallocated:
   /dev/sda3     158.44GiB
==============

If we follow the numbers:
* Data / Metadata ratio = 68.88/1.47 = 46.54.
* Estimated metadata usage when full: Unallocated + (73.00-68.88) / 46.54 + 1,47 = 4.96, round up to 5.00 GiB

So I think that df's "Avail:" and btrfs fi usage's "Free (estimated):" should be: * Estimated available user data space: 158.44 + (73.00-68.88) - 5.00 ~ 157,56GiB

This calculation is probably harder with multiple devices. But I think we can use same principle of estimating based on current allocation ratios between data and metadata.



 ~ Anders






[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux