Search found 16 matches

by blackntan
March 27th, 2021, 4:52 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

so, something like this? #!/usr/bin/env python3 import os, sys def disk_free_os_df(directory): # On any any POSIX with any disksize, "df" is always right, but heavy as it needs a process directory = '"' + directory + '"' cmd = "df -m " + directory # show in MB for thisl...
by blackntan
March 26th, 2021, 4:12 pm
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

Absolutely. Thanks!
by blackntan
March 26th, 2021, 2:34 pm
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

works like a champ!
by blackntan
March 25th, 2021, 1:50 pm
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

hmmm ... i'm not getting a coredump, i am JUST running the ```linux_disk_free_clib_statfs``` though .. are you sure it's coming from linux_disk_free_clib_statfs?
by blackntan
March 25th, 2021, 9:55 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

yes, I didn't define the entire struct ... but this works for linux: def linux_disk_free_clib_statfs(directory): class statfs(Structure): _fields_ = [ ("f_type", c_int64), ("f_bsize", c_int64), ("f_blocks", c_ulong), ("f_bfree", c_ulong), ("f_bavail"...
by blackntan
March 25th, 2021, 6:35 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

changing the calculation to use f_bavail (instead of f_bfree) results in identical values to df ... so df must be using f_bavail ... which is probably what we want anyway, as sabnzbd would not be running as root ... free_size_MB = fs_info.f_bavail * fs_info.f_bsize / 1024**2 dir is /Volumes/Big_One/...
by blackntan
March 25th, 2021, 4:47 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

smaller drive: dir is /Volumes/Macintosh HD df is always right, so: Disk size, and free (in MB): (1908108, 221060) python's os.statvfs() says (1908108, 221060) clib statfs32 says (1908108.27734375, 1893752.52734375) Measure time it takes for X loops: 1000 disk_free_os_df() method: --- 4.901981830596...
by blackntan
March 24th, 2021, 7:42 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

I spoke too soon that it was working on linux as well I guess ... I just compared the output (with the same filesystem) on linux and on macos ... macos: args ['./statfs.py', '/Volumes/Big_One/'] statfs result 0 f_blocks 9766352886 f_bsize 4096 f_bavail 9293011673 Total Space KB 39065411544.0 Total F...
by blackntan
March 24th, 2021, 5:40 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

@sander - sorry, I would share via pastebin, but as a 'newbie' I can't post links ;-) I'll attempt to place it here. Also, feel free to implement, I'm completely unfamiliar with sabnzbd's source code and contribution procedures ... #!/usr/bin/env python3 from ctypes import CDLL, Structure, c_uint32,...
by blackntan
March 23rd, 2021, 9:39 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

This works for both linux and macos: print("args", str(sys.argv)) if (len(sys.argv) < 2): print("pass path") exit() kern = CDLL(util.find_library('c'), use_errno=True) fs_info = statfs32() # put the path to any file on the mounted file system here root_volume = create_string_buff...
by blackntan
March 23rd, 2021, 9:16 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

statfs64 works fine as well ... kern = CDLL('/usr/lib/system/libsystem_kernel.dylib') fs_info = statfs64() # put the path to any file on the mounted file system here root_volume = create_string_buffer(b'/Volumes/Big_One/') result = kern.statfs64(root_volume, byref(fs_info)) print("f_blocks"...
by blackntan
March 23rd, 2021, 8:41 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

yes, that works ... kern = CDLL('/usr/lib/system/libsystem_kernel.dylib') fs_info = statfs32() # put the path to any file on the mounted file system here root_volume = create_string_buffer(b'/Volumes/Big_One/') result = kern.statfs(root_volume, byref(fs_info)) print("f_blocks", fs_info.f_b...
by blackntan
March 23rd, 2021, 6:05 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

@sander - sure i'll run it periodically and post. cheers, j EDIT: for a little more info, I ran a quick C program to compare statfs and statvfs on macos ... it looks like statfs returns correct info and statvfs is fubar. So maybe use a statfs python binding? statfs ------------------ mounted on /Vol...
by blackntan
March 23rd, 2021, 5:20 am
Forum: Bug Reports
Topic: 3.2.0 [7be9281] - Free Space is wrong [MacOS]
Replies: 41
Views: 18418

Re: 3.2.0 [7be9281] - Free Space is wrong [MacOS]

@sander - sure thing, here is the output ... dir is /Volumes/Big_One/ statvfs results: Partition (MB): 4595384 Available (MB): 3453177 df -m results: Partition (MB): 38149815 Available (MB): 37007608 --- @sander & @safihre also something to note from Apple's docs on statvfs: "portable appli...