Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative used value on smbfsm osx 10.9.1 #484

Closed
giampaolo opened this issue May 23, 2014 · 9 comments
Closed

Negative used value on smbfsm osx 10.9.1 #484

giampaolo opened this issue May 23, 2014 · 9 comments

Comments

@giampaolo
Copy link
Owner

From Pre...@gmail.com on February 24, 2014 23:12:54

Disk usage on my nas (smb) reports used diskspace as negative value:

     usage(total=616329322496, used=-3369346490368, free=3985675812864, 
percent=-546.7)
    partition(device='//GUEST:@Tower._smb._tcp.local/AUTODOWNLOAD', 
mountpoint='/Volumes/AUTODOWNLOAD', fstype='smbfs', 
opts='rw,nosuid,ignore-ownership')

Original issue: http://code.google.com/p/psutil/issues/detail?id=484

@giampaolo
Copy link
Owner Author

From g.rodola on February 24, 2014 14:33:07

Mmm... you're talking about this, right?

    >>> psutil.disk_usage('/Volumes/AUTODOWNLOAD')

That looks like a precision issue. Point is psutil uses os.statvfs() in order 
to determine disk usage so the problem should originate from that (hence it's 
"Python's fault" hehe).

Can you paste the output of "import os; 
print(os.statvfs('/Volumes/AUTODOWNLOAD'))"?

@giampaolo
Copy link
Owner Author

From Pre...@gmail.com on February 24, 2014 14:53:32

    posix.statvfs_result(f_bsize=1048576, f_frsize=1024, f_blocks=601884104, 
f_bfree=3892261432, f_bavail=3892261432, f_files=4294967295, 
f_ffree=4294967295, f_favail=4294967295, f_flag=2, f_namemax=255)

@giampaolo
Copy link
Owner Author

From g.rodola on February 24, 2014 15:49:21

Problem is f_bavail (available size) which is way higher than f_blocks (total 
size), and that of course doesn't make sense.
I guess os.statvfs() just doesn't work well with SMB filesystems.

@giampaolo
Copy link
Owner Author

From Pre...@gmail.com on February 24, 2014 16:15:17

It works fine on my rpi againste the same share. Seems to be a osx issue, I'll 
see if I can tried a older osx version and try there. At least the free size is correct :p

@giampaolo
Copy link
Owner Author

From Pre...@gmail.com on March 10, 2014 17:01:33

The problem only accures with osx against a unraid share (ntfs). The size is 
correct if i mount a physical drive.

@giampaolo
Copy link
Owner Author

From g.rodola on March 10, 2014 18:02:10

Yep, I'd be keen on assuming this is an OSX bug. I guess the best we can do is 
to signal this in the doc.

@giampaolo
Copy link
Owner Author

From Pre...@gmail.com on March 29, 2014 12:22:25

I havnt had the chance to test it on other osx version other then 10.9.1.

@giampaolo
Copy link
Owner Author

I will assume this is an OSX bug and close this issue.

@albertvaka
Copy link

Hi @giampaolo. We found that df manages to return the size correctly even on MacOS (which, indeed, uses a type too small to hold sizes > 2Tb). I've checked the code for df and I found that they do some bitwise manipulation [1] and expand the number to a bigger type. I'm assuming this is what fixes the problem for them. Is this something that psutils could aim to do?

https://github.com/coreutils/gnulib/blob/master/lib/fsusage.c#L130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants