core icon indicating copy to clipboard operation
core copied to clipboard

Wrong total size and usage percentage

Open manumeter opened this issue 12 years ago • 32 comments

Sync client Version 1.5.0 (build 1913) on Windows displays a wrong storage and usage size. Tested on multiple Clients. Server: RaspberryPi with Debian wheezy (current), Apache2 (current), MySQL (current)

$ df -h Filesystem Size Used Avail Use% Mounted on rootfs 58G 32G 24G 58% / /dev/root 58G 32G 24G 58% / devtmpfs 235M 0 235M 0% /dev tmpfs 49M 212K 49M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 98M 0 98M 0% /run/shm /dev/mmcblk0p1 56M 19M 38M 34% /boot

client web

manumeter avatar Dec 19 '13 15:12 manumeter

Server: ownCloud 6.0.0a (stable)

manumeter avatar Dec 19 '13 15:12 manumeter

@dragotin Any idea?

karlitschek avatar Dec 19 '13 16:12 karlitschek

The screenshots do not tell anything. Please do a wireshark or mitmproxy run and seek out for the PROPFIND request doing the quota check. Thanks.

dragotin avatar Dec 19 '13 16:12 dragotin

How much data do you have in your own cloud ?

The total size shown in the client is the size used by ownCloud, not the total size of the whole partition (which seem to be rootfs here)

PVince81 avatar Dec 19 '13 16:12 PVince81

@dragotin:

PROPFIND /remote.php/webdav/ HTTP/1.1

<?xml version="1.0" ?>
<d:propfind xmlns:d="DAV:"><d:prop><d:quota-available-bytes/><d:quota-used-bytes/></d:prop></d:propfind>

HTTP/XML 937 HTTP/1.1 207 Multi-Status

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns"><d:response><d:href>/remote.php/webdav/</d:href><d:propstat><d:prop><oc:id>00000002occb62605c3f</oc:id><d:quota-available-bytes>25186250752</d:quota-available-bytes><d:quota-used-bytes>2147483647</d:quota-used-bytes></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>

@PVince81: As it's shown correctly in the web frontend, about 28.1 GB. There is no quota set for current user and everything is stored on rootfs in /var/owncloud. oc1 I just noticed that it's also wrong here: oc3

manumeter avatar Dec 20 '13 10:12 manumeter

Ok, so it's probably the filecache that doesn't have the correct sizes. Let's try this:

select * from oc_storages;

Find out the numeric_id of the user that has the problem. Let's call it $numeric_id

Then run:

select fileid,path,parent,size from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path like 'files%' order by path;

It should show the size of all your folders. Please check whether there are some with the incorrect size "-1". Then try the sum:

select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path like 'files%' order by path;

PVince81 avatar Dec 20 '13 10:12 PVince81

Okay, thanks. There are no incorrect size values ("-1"), only some empty ones ("0").

mysql> select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path like 'files%' order by path;
+-------------+
| sum(size)   |
+-------------+
| 91121822769 |
+-------------+
1 row in set (0.04 sec)

manumeter avatar Dec 20 '13 10:12 manumeter

91 gb ? I don't see how that fits on your root partition :confused:

Can you add a "/" in the like statement ? (forgot it)

select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path like 'files/%' order by path

This should give the value that is displayed in the UI.

PVince81 avatar Dec 20 '13 10:12 PVince81

Thats because you sum folders recursively. Here you are:

mysql> select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path like 'files/%' order by path;
+-------------+
| sum(size)   |
+-------------+
| 82663265991 |
+-------------+
1 row in set (0.00 sec)

I think the following should be correctly, but there is one more shared folder I don't know how to join:

mysql> select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path regexp '^files/[^/]*$';
+-------------+
| sum(size)   |
+-------------+
| 30120729213 |
+-------------+
1 row in set (0.06 sec)

manumeter avatar Dec 20 '13 11:12 manumeter

Ok, so it's correct in the cache. How about the total size of the "files" folder alone ?

select * from oc_filecache where path='files' and storage=1;

That one is supposed to be the same as the last sum you posted above.

PVince81 avatar Dec 20 '13 11:12 PVince81

Ah, NOT correct:

mysql> select size from oc_filecache where path='files' and storage=1;
+------------+
| size       |
+------------+
| 2147483647 |
+------------+
1 row in set (0.34 sec)

manumeter avatar Dec 20 '13 11:12 manumeter

Can you re-check the personal page, in case the bug has fixed itself somehow while we were looking ?

PVince81 avatar Dec 20 '13 11:12 PVince81

Nope. (Modified my comment, it's NOT correct.)

manumeter avatar Dec 20 '13 11:12 manumeter

Ok sorry, didn't read the value... (trying to investigate multiple quota/storage issues at the same time.)

And I guess that when you upload files, that value also doesn't update correctly ? Normally when you add/update files, the folder sizes will be propagated from the target dir up to the root.

PVince81 avatar Dec 20 '13 11:12 PVince81

Yes, that's right. I just uploaded a 10 KB file and the value didn't change:

mysql> select size from oc_filecache where path='files' and storage=1;
+------------+
| size       |
+------------+
| 2147483647 |
+------------+
1 row in set (0.38 sec)

But the subfolders did update:

mysql> select sum(size) from oc_filecache where storage=1 and mimetype=(select id from oc_mimetypes m where m.mimetype='httpd/unix-directory') and path regexp '^files/[^/]*$';
+-------------+
| sum(size)   |
+-------------+
| 30120738949 |
+-------------+
1 row in set (0.06 sec)

manumeter avatar Dec 20 '13 11:12 manumeter

+1, I have the exact same problem running owncloud 6.0.0a on raspberry Pi and windows client v1.5.0

giovanisp avatar Dec 22 '13 15:12 giovanisp

Hi I suppose this is the same issue as here: https://github.com/owncloud/core/issues/6535# It is due to 32bit version of php and cast - integers. you can also check here http://forum.owncloud.org/viewtopic.php?f=26&t=18676 It would be nice if it could be fixed as proposed in the forum.

bernic avatar Jan 01 '14 02:01 bernic

Thanks for pointing this out @giovanisp According to the forum post, it looks like this is an issue with PHP 5.3.3 on 32 bits systems.

@manumeter can you confirm that your environment is also using PHP 5.3.3 ?

PVince81 avatar Jan 07 '14 09:01 PVince81

@PVince81 No, I'm currently using PHP/5.4.4-14+deb7u7 with Apache/2.2.22 (Debian).

manumeter avatar Jan 07 '14 09:01 manumeter

This is a 32-bit issue - raspberry is an ARM system, which is always 32-bit AFAIK

DeepDiver1975 avatar Jan 07 '14 10:01 DeepDiver1975