Page 1 of 4
Incorrect free space
Posted: June 19th, 2017, 1:16 am
by deejay01
I have sabnzbd version 2.1.0 running on a raspberry pi. Downloads automatically pause when the size is greater than the free space, which is fair enough, but a problem arises when the calculated free space doesn't match the actual free space. sabnzbd is saying that I have 700MB free space whereas the actual figure is about 60GB. So the question becomes how does it calculate its free space value?
Thanks in advance...
Re: Incorrect free space
Posted: June 19th, 2017, 1:43 am
by safihre
It does a basic request to the system service statvfs.
What is the output when you run that command on the command line?
Re: Incorrect free space
Posted: June 19th, 2017, 3:24 am
by deejay01
Does this help?
Code: Select all
#!/usr/bin/python
import os
print os.statvfs("/media/pi/SANDISK128");
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1278529L, f_bfree=247545L, f_bavail=176838L, f_files=333248L, f_ffree=203806L, f_favail=203806L, f_flag=1024, f_namemax=55)
Re: Incorrect free space
Posted: June 19th, 2017, 5:23 am
by safihre
We use f_bavail*f_bsize, where f_bavail=available blocks to the user and f_bsize=block size.
If I do that calculation on the data you provided it comes to 687MB. So maybe it's a permission issue?
Re: Incorrect free space
Posted: June 26th, 2017, 10:31 am
by .maxx
Same problem here.
- The 'complete' folder is on my NAS which has 4,xTB of free Space.
- My Mac shows me 4,xTB of free space.
- SAB 2.1.0 shows me 196GB of free space.
I've changed the folder to an other one, but still the same.
The permission in SAB is at 777.
Re: Incorrect free space
Posted: June 26th, 2017, 11:14 am
by safihre
Unfortunately, nothing we can do. This is what the OS is reporting to us. Maybe it's some permissions issue or some other network related problem that it's getting wrong information.
We just don't have another way to read it than using the system functions..
Re: Incorrect free space
Posted: June 26th, 2017, 11:16 am
by safihre
Maybe you can also run on the command line the same commands in python as above, and post what it outputs? (but with the path to your NAS of course)
Maybe we can diagnose!
Re: Incorrect free space
Posted: June 27th, 2017, 3:21 am
by .maxx
Sorry but I don't know how to use the statvfs command on macOS.
Re: Incorrect free space
Posted: June 27th, 2017, 3:35 am
by sander
.maxx wrote: ↑June 27th, 2017, 3:21 am
Sorry but I don't know how to use the statvfs command on macOS.
Do you know how to open a terminal / command prompt, and run python?
If so, run this, and post the output here
Code: Select all
python -c "import os; print os.statvfs('/home/me/');"
Example from my Linux:
Code: Select all
$ python -c "import os; print os.statvfs('/home/sander/');"
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=3916268L, f_bfree=509852L, f_bavail=305155L, f_files=1003680L, f_ffree=564690L, f_favail=564690L, f_flag=4096, f_namemax=255)
Re: Incorrect free space
Posted: June 27th, 2017, 3:45 am
by .maxx
Do you know how to open a terminal / command prompt, and run python?
If so, run this, and post the output here
Code: Select all
python -c "import os; print os.statvfs('/home/me/');"
Thanks got it:
Code: Select all
posix.statvfs_result(f_bsize=1048576, f_frsize=1024, f_blocks=2332848292, f_bfree=153868548, f_bavail=153868548, f_files=2332848290, f_ffree=153868548, f_favail=153868548, f_flag=2, f_namemax=255)
Re: Incorrect free space
Posted: June 27th, 2017, 5:00 am
by sander
Code: Select all
posix.statvfs_result(
f_bsize=1048576,
f_frsize=1024,
f_blocks=2332848292,
f_bfree=153868548,
f_bavail=153868548,
f_files=2332848290,
f_ffree=153868548,
f_favail=153868548,
f_flag=2,
f_namemax=255)
OK, good: no negative or strange values reported.
Can you also post the disk path you used in your command?
This is how sabnzbd calcutates:
Code: Select all
s = os.statvfs(_dir)
if s.f_blocks < 0:
disk_size = float(sys.maxint) * float(s.f_frsize)
else:
disk_size = float(s.f_blocks) * float(s.f_frsize)
if s.f_bavail < 0:
available = float(sys.maxint) * float(s.f_frsize)
else:
available = float(s.f_bavail) * float(s.f_frsize)
return disk_size / GIGI, available / GIGI
So
disk_size = float(s.f_blocks) * float(s.f_frsize) = 2332848292 * 1024 = 2224 GigiB
available = float(s.f_bavail) * float(s.f_frsize) = 153868548 * 1024 = 146 GigiB
Hmmm ... does that match what you reported what SAB was telling? Was the python run against the NAS path?
Re: Incorrect free space
Posted: June 27th, 2017, 5:16 am
by .maxx
Hi sander,
I used that command:
Code: Select all
python -c "import os; print os.statvfs('/Volumes/Medien/');"
The macOS Finder (10.12.5) tells me that my Synology NAS got:
- I mount it correctly via SMB and it shows up in /Volumes
- I restarted the NAS and my Mac several times
- I did a fresh SAB install
- SAB still tells me that I now only got 235,5GB (deleted some today)
Re: Incorrect free space
Posted: June 27th, 2017, 5:22 am
by sander
Strange.
What is the output of:
Re: Incorrect free space
Posted: June 27th, 2017, 5:26 am
by .maxx
df -h
Code: Select all
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk0s2 465Gi 40Gi 425Gi 9% 1289380 4293677899 0% /
devfs 180Ki 180Ki 0Bi 100% 626 0 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
//[email protected]/Medien 26Ti 22Ti 4.2Ti 84% 23560704746 4541947320 84% /Volumes/Medien
//[email protected]/Dokumente 26Ti 22Ti 4.2Ti 84% 23560704746 4541947320 84% /Volumes/Dokumente
df -h /Volumes/Medien/
Code: Select all
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
//[email protected]/Medien 26Ti 22Ti 4.2Ti 84% 23560704746 4541947320 84% /Volumes/Medien
df -h /Users
Code: Select all
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk0s2 465Gi 40Gi 425Gi 9% 1289383 4293677896 0% /
Re: Incorrect free space
Posted: June 27th, 2017, 7:20 am
by sander
Aha. We don't understand what is going on ... is statvfs() wrong (it is depcreceated, after all)? Are we calculating wrong? Is your disk size too big for statvfs()? Do you have quota enabled?
So we have to think about this. The problem is we can't reproduce it.