server
server copied to clipboard
wrong user quota in the user administration
⚠️ This issue respects the following points: ⚠️
- [X] This is a bug, not a question or a configuration/webserver/proxy issue.
- [X] This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- [X] I agree to follow Nextcloud's Code of Conduct.
Bug description
Entering 10GB will allocate 10.7GB as the storage size. 1GB becomes 1.1GB, 500 becomes 575.5GB.
Steps to reproduce
- Go to user management 2.Specify an Arbitrary size for the user disk space and see how it becomes a different size.
Expected behavior
Installation method
Community Docker image
Nextcloud Server version
27
Operating system
None
PHP engine version
None
Web server
None
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 22 to 23)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- [X] Default user-backend (database)
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
I can replicate this using the NixOS configuration for nextcloud27
Encountered the same issue..
More or less same issue :
I have a user with 850GB of files. If I try to put 1000GB then it goes to unlimited and / or 1GB... I saw both.
Server configuration detail
Operating system: Linux 6.1.0-9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64
Webserver: Apache (fpm-fcgi)
Database: mysql 10.11.3
PHP version: 8.2.7
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, exif, msgpack, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache
Nextcloud version: 26.0.3 - 26.0.3.2
Updated from an older Nextcloud/ownCloud or fresh install:
Where did you install Nextcloud from: unknown
Signing status
[]
List of activated apps
Enabled:
- activity: 2.18.0
- admin_audit: 1.16.0
- analytics: 4.9.4
- announcementcenter: 6.6.1
- bookmarks: 13.0.1
- bruteforcesettings: 2.6.0
- calendar: 4.4.3
- carnet: 0.24.7
- checksum: 1.2.2
- circles: 26.0.0
- cloud_federation_api: 1.9.0
- collectives: 2.5.0
- comments: 1.16.0
- contacts: 5.3.2
- contactsinteraction: 1.7.0
- cookbook: 0.10.2
- dashboard: 7.6.0
- dav: 1.25.0
- deck: 1.9.2
- drawio: 2.1.1
- federatedfilesharing: 1.16.0
- files: 1.21.1
- files_external: 1.18.0
- files_mindmap: 0.0.28
- files_pdfviewer: 2.7.0
- files_rightclick: 1.5.0
- files_sharing: 1.18.0
- files_trashbin: 1.16.0
- files_versions: 1.19.1
- firstrunwizard: 2.15.0
- geoblocker: 0.5.11
- keeweb: 0.6.13
- logreader: 2.11.0
- lookup_server_connector: 1.14.0
- mail: 3.2.3
- maps: 1.0.2
- music: 1.8.4
- nextcloud_announcements: 1.15.0
- notes: 4.8.0
- notifications: 2.14.0
- oauth2: 1.14.0
- password_policy: 1.16.0
- photos: 2.2.0
- previewgenerator: 5.3.0
- privacy: 1.10.0
- provisioning_api: 1.16.0
- recommendations: 1.5.0
- related_resources: 1.1.0-alpha1
- serverinfo: 1.16.0
- settings: 1.8.0
- sharebymail: 1.16.0
- spreed: 16.0.4
- support: 1.9.0
- survey_client: 1.14.0
- systemtags: 1.16.0
- tasks: 0.15.0
- text: 3.7.2
- theming: 2.1.1
- twofactor_backupcodes: 1.15.0
- updatenotification: 1.16.0
- user_status: 1.6.0
- viewer: 1.10.0
- weather_status: 1.6.0
- workflowengine: 2.8.0 Disabled:
- encryption
- federation: 1.10.1
- suspicious_login: 4.3.0
- twofactor_totp
- user_ldap
Configuration (config/config.php)
{ "instanceid": "REMOVED SENSITIVE VALUE", "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusted_domains": [
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "******",
"dbtype": "mysql",
"version": "26.0.3.2",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"loglevel": 2,
"logtimezone": "Europe\/Paris",
"logfile": "\/var\/log\/nextcloud.log",
"log_rotate_size": 0,
"installed": true,
"memcache.local": "\\OC\\Memcache\\APCu",
"share_folder": "\/SharedWithMe",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtpmode": "smtp",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"maintenance": false,
"theme": "",
"default_phone_region": "FR",
"updater.release.channel": "stable",
"mail_smtpauth": 1,
"mail_sendmailmode": "smtp",
"mail_smtpauthtype": "LOGIN",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mysql.utf8mb4": true,
"trashbin_retention_obligation": "auto, 100",
"has_rebuilt_cache": true,
"app_install_overwrite": [
"files_reader"
],
"bulkupload.enabled": false
}
Cron Configuration: Array ( [backgroundjobs_mode] => cron [lastcron] => 1688364922 )
External storages: yes
External storage configuration
No mounts configured
Encryption: no
User-backends:
OC\User\Database
Talk configuration:
STUN servers
TURN servers
turn:*******- udp,tcp
Signaling servers (mode: default):
no custom server configured
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:109.0) Gecko/20100101 Firefox/114.0
Is there a fix for that? I have the same problem.
1. Entering manually "50 GB" ...
2. ... results in "unlimited"
3. ... which is shown as "0" after saving.
Selecting 10 GB from drop down results in 10,7 GB.
If you calculate, it is always 7.4% higher than that what you type in
I have it illimited :
Previously, it was consistent to have a warning because I gave the account only 900GB. I tried to put 1000GB, but nextcloud understood 1GB => I did put it back to unlimited.
Overall is also OK :
Note: It's an installation upgraded from release to release since multiple years. Recently I upgraded from bullsseye to bookworm then the nextcloud.
Got the same issue on a couple of Nextcloud 27 instances and an instance running 27.0.0 RC1. e: same in 27.0.1rc1
Same thing for me, all quotas set to 10GB are 10.7GB after the update. Also i noticed that more space is used. Did something within the calculation change?
It looks like the value entered will be treated as binary based values (2^x) but the display will be the decimal based value (10^x). Also when editing the quota value, the input field becomes empty (at least in my installation with NC 27) even when the quota is saved.
For example:
10 GB can be interpreted as decimal based value which is 10*1000*1000*1000
Bytes = 10,000,000,000 Bytes.
However it can also be: 10*1024*1024*1024
Bytes = 10,737,418,240 Bytes.
When the resulting value is then displayed as "decimal based" GB it will be become "10,7 GB" even the user has entered "10 GB" as value.
I would suggest to interpret units like "GB" or "MB" always as binary based since many operating systems and applications see "1 GB" as 1*1024*1024*1024
and not as 1*1000*1000*1000
- even if this is not completely correct since the unit for binary based values is "GiB" and not "GB". If no unit is entered but only a plain number, then treat the number as it is but still display it as "KB", "MB", "GB" depending on how large the value is.
So when I input "10 GB" this should mean 10*1024*1024*1024
and when I input "1000000" this will mean 1000000 bytes or 976.56 KB (maybe we also do a internal rounding for a maximum of two digits for fractional parts).
About displaying the quota values:
- When the quota is less then
1*1024
bytes: display as it is, e.g. "500". - When the quota is between
1*1024
and1024*1024-1
bytes: displayvalue/1024
as "KB", e.g. 2048 -> "2 KB" (2048/1024
) - When quota is between
1024*1024
and1024*1024*1024-1
bytes: displayvalue/1024/1024
as "MB", e.g. 52428800 -> "50 MB" (52428800/1024/1024
) - When quota is
1024*1024*1204
or more: displayvalue/1024/1024/1024
as "GB", e.g. 10737418240 -> "10 GB" (10737418240/1024/1024/1024
)
1. Entering manually "50 GB" ...
2. ... results in "unlimited"
3. ... which is shown as "0" after saving.
Selecting 10 GB from drop down results in 10,7 GB.
Nextcloud will store the limit corectly, just the initial view update is wrong. So if you enter "50 GB", press enter and then save the user, it will display "unlimited" first - but when you refresh the user list, you will see "53,68 GB" as value (because 50 GB
input will be interpreted as 50*1024*1024*1024
bytes but the display will then show the value devided as 50/1000/1000/1000
.
Nextcloud will store the limit corectly, just the initial view update is wrong. So if you enter "50 GB", press enter and then save the user, it will display "unlimited" first - but when you refresh the user list, you will see "53,68 GB" as value (because
50 GB
input will be interpreted as50*1024*1024*1024
bytes but the display will then show the value devided as50/1000/1000/1000
. You're right but it is not very intuitive ;-)
cc @nextcloud/server
I noticed that unit issue too, GB entered will be treated as GiB (gibibyte, base 2 (1024³)) but shown as GB (gigabyte, base 10 (1000³)).
I tried changing my quota a few different ways on Nextcloud 27.0.1 with macOS client version 3.9.1.
input method | input value | Admin GUI | Files app | occ | mac client |
---|---|---|---|---|---|
Admin GUI | 1 TB | 1.2 TB | 1.2 TB | 1.1 TB | 1,126 GB |
Admin GUI | 1000 GB | 1.2 TB | 1.2 TB | 1.1 TB | 1,126 GB |
Admin GUI | 1000000000000 | 1.1 TB | 1.1 TB | 1 TB | 1,024 GB |
Admin GUI | 1000000000000 B | 1.1 TB | 1.1 TB | 1 TB | 1,024 GB |
occ | 1TB | 1.1 TB | 1.1 TB | 1TB | 1,024 GB |
occ | "1\ TB" | 1.1 TB | 1.1 TB | 1 TB | 1,024 GB |
occ | "1\ TiB" | 1 B | 1 B | 1 TiB | 1 B |
occ | 1000000000000 | 1 TB | 1 TB | 1000000000000 | 931 GB |
occ | "1000000000000\ B" | 1 TB | 1 TB | 1000000000000 B | 931 GB |
Using the web interface never gives a correct result: "1 TB" is of course ambiguous; but while the user could have meant 1000 GB or 1024 GiB, "1,126 GB" is wrong. "1000000000000 B" is unambiguous; it's 10^12 bytes, 1000 GB, or 931 GiB, but "1,024 GB" is wrong.
Using occ
is better: If I set "1 TB" it's reasonable if not technically correct to get "1,024 GB" in the desktop client.
The only unambiguous way to set a quota, then, appears to be using occ
and a value in bytes.
occ user:setting <username> files quota 1000000000000
does the right thing, but the results are displayed inconsistently. The web UI displays the technically correct "1 TB" while the desktop client shows the incorrect-but-excusable "931 GB."
Anyway, I hope this is helpful to someone. Please let me know if I can be of assistance.
Just want to add that its not only the quota, but its just the way its shown on the nextcloud website. For example a folder that is really "99,7GB" on Windows will show "107,1GB" on the website.
Yea, this happens not only in admin user settings page but also in Files app on user quota display and folder display. But good news: On the users account profile settings the quota is shown correctly!
Yea, this happens not only in admin user settings page but also in Files app on user quota display and folder display. But good news: On the users account profile settings the quota is shown correctly!
You'r right
I have the same issues since I've updated Nextcloud from version 26 to 27... When I enter "100 GB" for example as user quota,
- the user quota input field jumps to "unlimited" after pressing "Enter", but seems to store a value (if correct, I don't know)
- the "files" app says "70.7 GB of 114,9 GB used"
- the user account profile (Personal info > Details) says "You are using 65.8 GB of 107 GB"
So both UI outputs are wrong, or different from what I've entered.
But looking into the real "data/user/files" folder with 'ncdu' and 'du -sh', I get: ncdu : 65,8 GiB du -sh : 66G
So yes, the user account UI seems "more correct", but I didn't enter 107 GB as quota, I did enter 100 GB! And even if it wouldn't matter because of just a different calculation, I think this is confusing for most users.
Bye... :-)
This issue doen't in milestone 27.0.2 https://github.com/nextcloud/server/milestone/230 I don't know the detail, but is this hard to fix? Or this is php8.2's issue?
I don't know the detail, but is this hard to fix? Or this is php8.2's issue?
No, it does not have anything to do with PHP 8.2. It happens with PHP 8.1 as well.
My PHP is extremely rusty, and I've never written TypeScript or Vue before. I think I can submit a patch for this, but I would like some advice on strategy.
Here's what I think is happening:
- There's a humanFileSize() which converts from a number of bytes like 1048576 to a pretty string like "1 MB"
- There's a computerFileSize() which does the inverse, it takes "1 MB" and gives "1048576".
- There are PHP and TypeScript version of each of these.
- The TypeScript version of humanFileSize() was replaced by a reference to "formatFileSize" from "@nextcloud/files" which uses SI prefixes, not binary ones.
- When a quota is set in the web interface, the input value is given to computerFileSize() as a validity check, then the result of that conversion is given to humanFileSize() to go back to human-readable, and that result is given to the server, which repeats the same process (in PHP this time).
Example:
- Admin sets a user's quota to "1 GB"
- (JS) computerFileSize("1 GB") gives "1073741824" (This function uses 2^30 bytes per GB)
- (JS) humanFileSize("1073741824") gives "1.1 GB" (This function uses 10^9 bytes per GB)
- "1.1 GB" is sent to the backend to be set as the user's quota.
- (PHP) computerFileSize("1.1 GB") gives "1181116006" (This function uses 2^30 bytes per GB)
- (PHP) humanFileSize("1181116006") gives ~~"1.2 GB"~~ "1.1 GB" (This function uses 2^30 bytes per GB)
- ~~"1.2 GB"~~ "1.1 GB" is stored as the user's quota.
Edit: The bad conversion only happens once before the value is stored, not twice.
See: core/src/OC/util.js:69 core/src/OC/util.js:81 lib/private/legacy/OC_Helper.php:80 lib/private/legacy/OC_Helper.php:117 apps/settings/src/components/Users/UserSettingsDialog.vue:437
It seems that the possible solutions are:
- Perform the computerFileSize() conversion, but send that result to the backend before the humanFileSize conversion. If the user enters "1 GB" send "1000000000 B" or "1073741824 B" to the backend.
- Update the TypeScript and PHP versions of computerFileSize and the PHP version of humanFileSize to use 1000 instead of 1024.
- Same as (2), but add support for KiB/MiB/GiB etc.
- Revert formatFileSize to 1024-multiples.
I personally like (1) because the frontend and backend are both computers, so it seems that there's no real reason for them to be exchanging human-friendly units.
@jjasoncool:
This issue doen't in milestone 27.0.2
Good to know, then maybe (hopefully) it is already fixed in version 27.0.2...? I am using stable updates, so I'm still on version 27.0.1.
@bguzzardi: Thank you for digging into the source code...! :-) I fully agree, also would prefer solution (1).
Still not fixed on 27.0.2 ...
Still not fixed on 27.0.2 ...
Sorry - but there is no need to comment about missing fixes. If the issue will be fixed, then you will see at least a pull request here for the code changes and issue itself would be closed as well.
Still not fixed on 27.0.2 ...
Sorry - but there is no need to comment about missing fixes. If the issue will be fixed, then you will see at least a pull request here for the code changes and issue itself would be closed as well.
Only said that cause the previous comment mentionned it might have already been fixed in the beta .2. We will wait it gets noticed 😄
@bguzzardi The quickfix seems to be to fix humanFileSize from @nextcloud/files
to use powers of 2 like the rest of the stack, no?
is this already beeing fixed?
is this already beeing fixed?
No. Otherwise this issue would not still be "Open".
I have the same problem.I has upload 2TB files.But it's always show 1.1TB in nextcloud.My nextcloud version is 27.