Page MenuHomePhabricator
Paste P25307

swift size calculation
ArchivedPublic

Authored by MatthewVernon on Apr 19 2022, 10:25 AM.
Tags
None
Referenced Files
F35058006: swift size calculation
Apr 19 2022, 10:25 AM
Subscribers
None
root@thanos-be1002:/etc/swift# python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> st = os.statvfs("/dev/sdb3")
>>> free_bytes = st.f_frsize * st.f_bavail
>>> size_bytes = st.f_frsize * st.f_blocks
>>> free_percent = float(free_bytes) / float(size_bytes) * 100
>>> free_bytes
67380469760
>>> size_bytes
67380469760
>>> free_percent
100.0
root@thanos-be1002:/etc/swift# df -l /dev/sdb3
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 97608128 48573124 49035004 50% /srv/swift-storage/sdb3

Event Timeline