This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sanderjo
Recipients ned.deily, ronaldoussoren, sanderjo
Date 2021-03-27.10:36:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616841402.66.0.531178179964.issue43638@roundup.psfhosted.org>
In-reply-to
Content
MacOS BigSur (and older), python 3.9.2 (and older)

For disks >4TB, os.statvfs() shows a wrong value for available space: too low, and always rollover at each 4TB. 
As 4TB = 2^42, hypothesis: rollover in 32bit counter (with 10bit blocksize)

Example:

"df -m" does show the correct available space

df -m /Volumes/Frank/
Filesystem                                    1M-blocks    Used Available Capacity    iused       ifree %iused  Mounted on
//frank@SynologyBlabla._smb._tcp.local/Frank  21963360 2527744  19435615    12% 2588410474 19902070164   12%   /Volumes/Frank

So available space 19902070164 MB, so about 18.5 TB. Good.

Now python's os.statvfs():

>>> s = os.statvfs("/Volumes/Frank")
>>> s.f_bavail * s.f_frsize / 1024**2
2658399.39453125

So 2.5TB, and thus wrong

The difference is 16777216 MB which is exactly 4 times 4TB.

Problem seems to be in MacOS statvfs() itself; reproducable with a few lines of C code.

We have implemented a workaround in our python program SABnzbd to directly use MacOS' libc statfs() call (not statvfs() ). A solution / workaround in python itself would be much nicer.


No problem with python on Linux with >4TB drives.
History
Date User Action Args
2021-03-27 10:36:42sanderjosetrecipients: + sanderjo, ronaldoussoren, ned.deily
2021-03-27 10:36:42sanderjosetmessageid: <1616841402.66.0.531178179964.issue43638@roundup.psfhosted.org>
2021-03-27 10:36:42sanderjolinkissue43638 messages
2021-03-27 10:36:41sanderjocreate