3
$ cp a b
Cannot write to 'b' (Quota exceeded).
# df -h .
Filesystem     Size  Used  Avail Use% Mounted on
/data/media    110G  102G  7.8G  93%  /storage/emulated

I can copy the file perfectly fine in the app's filesystem so it isn't a hardware failure

/dev/block/dm-2 /data

0

1 Answer 1

4

Android introduced filesystem quotas in Android 8 to get Faster Storage Statistics i.e. to make auditing and enforcing space usage limits to apps easy:

"This quota feature also improves system stability by preventing any single app from using more than 90% of disk space or 50% of inodes."

Particular usage is to clear apps' cached data files as the storage runs short and apps exceed their limits. OS calculates these limits based on different criteria and saves to file /data/system/cachequota.xml.

Disk Quotas is Linux kernel's feature which can be controlled from userspace using tools like quota-tools. They also work on Android:

~# quota -s -u 2000
Disk quotas for user #2000 (uid 2000): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
     /dev/loop1      4K  20480K  20480K               1       0       0
~# dd if=/dev/zero of=mountpoint/filler status=none bs=1M count=21
dd: error writing 'test/filler': Quota exceeded

However on Android "The quota feature is part of the default implementation of installd" - the daemon which handles (un)installation of apps at back end. If quota option is found in fstab file for userdata partition, quota mount options are enabled when init mounts the partition on boot. So in order to disable filesystem quota on Android, you need to remove quota option from fstab. See What is default “fstab” file in Android?

Simple approach is to delete unnecessary files the app is holding in storage. Or you can use a different app (with different UID) for copying as quotas are allotted on per UID basis.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .