SABnzbd fails to regist correct disk space
Forum rules
Help us help you:
Help us help you:
- Are you using the latest stable version of SABnzbd? Downloads page.
- Tell us what system you run SABnzbd on.
- Adhere to the forum rules.
- Do you experience problems during downloading?
Check your connection in Status and Interface settings window.
Use Test Server in Config > Servers.
We will probably ask you to do a test using only basic settings. - Do you experience problems during repair or unpacking?
Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Re: SABnzbd fails to regist correct disk space
http://docs.python.org/library/statvfs.html
Deprecated since version 2.6: The statvfs module has been deprecated for removal in Python 3.0. [-_-]' how to replace this ? visibly it doesn't work with big filesystems
Deprecated since version 2.6: The statvfs module has been deprecated for removal in Python 3.0. [-_-]' how to replace this ? visibly it doesn't work with big filesystems
Re: SABnzbd fails to regist correct disk space
I looked the sabnzb sources and I found where freespace where used :
misc.py, line 1222 :
#------------------------------------------------------------------------------
# Diskfree
try:
os.statvfs
import statvfs
# posix diskfree
def diskfree(_dir):
""" Return amount of free diskspace in GBytes
"""
try:
s = os.statvfs(_dir)
return (s[statvfs.F_BAVAIL] * s[statvfs.F_FRSIZE]) / GIGI
except OSError:
return 0.0
def disktotal(_dir):
""" Return amount of total diskspace in GBytes
"""
try:
s = os.statvfs(_dir)
return (s[statvfs.F_BLOCKS] * s[statvfs.F_FRSIZE]) / GIGI
except OSError:
return 0.0
and after there is a specific part for windows.
Since os.statvfs is deprecated, why don't use a specific system call for unix/linux to replace this ? Something like system("df -kP") with appropriated string management ?
misc.py, line 1222 :
#------------------------------------------------------------------------------
# Diskfree
try:
os.statvfs
import statvfs
# posix diskfree
def diskfree(_dir):
""" Return amount of free diskspace in GBytes
"""
try:
s = os.statvfs(_dir)
return (s[statvfs.F_BAVAIL] * s[statvfs.F_FRSIZE]) / GIGI
except OSError:
return 0.0
def disktotal(_dir):
""" Return amount of total diskspace in GBytes
"""
try:
s = os.statvfs(_dir)
return (s[statvfs.F_BLOCKS] * s[statvfs.F_FRSIZE]) / GIGI
except OSError:
return 0.0
and after there is a specific part for windows.
Since os.statvfs is deprecated, why don't use a specific system call for unix/linux to replace this ? Something like system("df -kP") with appropriated string management ?
Re: SABnzbd fails to regist correct disk space
Yeah sure, and taking into account the 10.000 different flavours of Linux/BSD/Whatever distributionsSpark wrote:I looked the sabnzb sources and I found where freespace where used :
Since os.statvfs is deprecated, why don't use a specific system call for unix/linux to replace this ? Something like system("df -kP") with appropriated string management ?
We use Python as an abstraction layer for OS quirks.
Only for Windows and OSX we use platform-specific calls.
But these OSses have shown reasonable backward-compatibility over the years.
Have you checked if all statvfs fields are off?
There are quite a few:
import os
s = os.statvfs("/volume1")
print s
Specifically, what is the value of f_ffree and f_favail ?
Re: SABnzbd fails to regist correct disk space
Here is the result :
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=-1181073360, f_bfree=-1181318537, f_bavail=-1181344137, f_files=790888448, f_ffree=790887260, f_favail=790887260, f_flag=0, f_namemax=255)
With df , then -P is a posix standard
[ root@Synology: ~ ] $ df --help
BusyBox v1.16.1 (2011-06-29 11:52:19 CST) multi-call binary.
Usage: df [-Pkmh] [FILESYSTEM]...
Print filesystem usage statistics
Options:
-P POSIX output format
-k 1024-byte blocks (default)
-m 1M-byte blocks
-h Human readable (e.g. 1K 243M 2G)
df -kP will normally works on all Linux/BSD/Aix platforms
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=-1181073360, f_bfree=-1181318537, f_bavail=-1181344137, f_files=790888448, f_ffree=790887260, f_favail=790887260, f_flag=0, f_namemax=255)
With df , then -P is a posix standard
[ root@Synology: ~ ] $ df --help
BusyBox v1.16.1 (2011-06-29 11:52:19 CST) multi-call binary.
Usage: df [-Pkmh] [FILESYSTEM]...
Print filesystem usage statistics
Options:
-P POSIX output format
-k 1024-byte blocks (default)
-m 1M-byte blocks
-h Human readable (e.g. 1K 243M 2G)
df -kP will normally works on all Linux/BSD/Aix platforms
Re: SABnzbd fails to regist correct disk space
[ root@Synology: ~ ] $ df -P /volume1/downloads/
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/vg1/volume_1 12455575744 980708 12454492636 0% /volume1
[ root@Synology: ~ ] $ df -Pk /volume1/downloads/
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/vg1/volume_1 12455575744 980708 12454492636 0% /volume1
I think you can use this method for linux as you use specific code for windows.
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/vg1/volume_1 12455575744 980708 12454492636 0% /volume1
[ root@Synology: ~ ] $ df -Pk /volume1/downloads/
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/vg1/volume_1 12455575744 980708 12454492636 0% /volume1
I think you can use this method for linux as you use specific code for windows.
Re: SABnzbd fails to regist correct disk space
The statvfs function on Synology's Python isn't capable of handling your disk size. Bad luck.
Please complain to Synology as well.
The os.statvfs function itself isn't deprecated, only the constants like statvfs.F_FRSIZE are.
I'll change the code accordingly, but that won't solve your problem.
BTW: I don't think it's a good idea to run a process every time the queue page is refreshed (potentially every second).
So I'm not going to use the "df" command.
Please complain to Synology as well.
The os.statvfs function itself isn't deprecated, only the constants like statvfs.F_FRSIZE are.
I'll change the code accordingly, but that won't solve your problem.
BTW: I don't think it's a good idea to run a process every time the queue page is refreshed (potentially every second).
So I'm not going to use the "df" command.
Re: SABnzbd fails to regist correct disk space
I understand. But I'm pretty sure that statvfs calls df or wathever system call backsides :p
Re: SABnzbd fails to regist correct disk space
A system call is much cheaper than the whole enchilada of starting an external process.
Re: SABnzbd fails to regist correct disk space
BTW: I can replace a negative number by something like "plenty".
Or leave it out altogether.
Also, I can interpret a negative number as being on the safe side of your limit.
The limit will only be effective when the free space has dropped far enough.
Or leave it out altogether.
Also, I can interpret a negative number as being on the safe side of your limit.
The limit will only be effective when the free space has dropped far enough.
Re: SABnzbd fails to regist correct disk space
I made a dirty modification to my misc.py (and after deleted misc.pyo)
def diskfree(_dir):
""" Return amount of free diskspace in GBytes
"""
try:
proc=subprocess.Popen( "df -kP "+_dir, stdout=subprocess.PIPE, shell=True )
result=int(proc.stdout.read().split("\n")[1].split()[3]) / ( 1024 * 1024 )
proc.wait()
return result
except :
return 0.0
def disktotal(_dir):
""" Return amount of total diskspace in GBytes
"""
try:
proc=subprocess.Popen( "df -kP "+_dir, stdout=subprocess.PIPE, shell=True )
result=int(proc.stdout.read().split("\n")[1].split()[1]) / ( 1024 * 1024 )
proc.wait()
return result
except :
return 0.0
and it works perfectly
A better solution is to place my downloads folder in a smaller directory. I think there is a 8To limit for statvfs to work fine.
def diskfree(_dir):
""" Return amount of free diskspace in GBytes
"""
try:
proc=subprocess.Popen( "df -kP "+_dir, stdout=subprocess.PIPE, shell=True )
result=int(proc.stdout.read().split("\n")[1].split()[3]) / ( 1024 * 1024 )
proc.wait()
return result
except :
return 0.0
def disktotal(_dir):
""" Return amount of total diskspace in GBytes
"""
try:
proc=subprocess.Popen( "df -kP "+_dir, stdout=subprocess.PIPE, shell=True )
result=int(proc.stdout.read().split("\n")[1].split()[1]) / ( 1024 * 1024 )
proc.wait()
return result
except :
return 0.0
and it works perfectly
A better solution is to place my downloads folder in a smaller directory. I think there is a 8To limit for statvfs to work fine.
Re: SABnzbd fails to regist correct disk space
1. Just don't set the refresh rate too highSpark wrote:I made a dirty modification to my misc.py (and after deleted misc.pyo)
and it works perfectly
I think there is a 8To limit for statvfs to work fine.
2. The implementer of os.statvfs clearly didn't think ahead.
The numbers are returned as short integers instead of long
To paraphrase Bill Gates: "8T should be enough for anyone".
Re: SABnzbd fails to regist correct disk space
I made a small modification. I replace int by float and return result by return round(result,2). It looks much better. I expect the return value should be a float because it was displayed with 2 digits, and in the exception code we have : except : return 0.0
Re: SABnzbd fails to regist correct disk space
Just another problem, the icon showing the left space seems to not working. Or it is the 8To limit which slaps again
Re: SABnzbd fails to regist correct disk space
I'm just going to limit the numbers to the highest possible values.
So in your case 8T would be shown as disk size.
BTW: whoever ported Python to the Synology platform made an error.
The amount of free/total blocks should be returned as long integers, not standard integers.
(1000L vs. 1000).
Which version of Python do you have? Python 2.6 and 2.7 do it right (at least on Ubuntu).
I don't have access to Python 2.5 for Linux.
So in your case 8T would be shown as disk size.
BTW: whoever ported Python to the Synology platform made an error.
The amount of free/total blocks should be returned as long integers, not standard integers.
(1000L vs. 1000).
Which version of Python do you have? Python 2.6 and 2.7 do it right (at least on Ubuntu).
I don't have access to Python 2.5 for Linux.
Re: SABnzbd fails to regist correct disk space
[ root@Synology: ~ ] $ /usr/local/python26/bin/python -V
Python 2.6.6
Python 2.6.6