OK so this is on an iPad Pro but I'm asking you guys because this is about the underlying Unix system behind iOS/OS X, not really iPad specific. (And yes I spent hours reading all relevant StackExchange's about "no space left on device" first.)
Problem #1: I can't create files larger than 2-8MB (it varies upon reboot). This renders the iPad virtually unusuable. Many apps won't launch, apps won't install, etc. It reports "no space left on device" when you try to create a file larger than the bizarre 2-8MB limit, despite having gigs of free space.
Problem #2: Disk space constantly keeps disappearing. I kept uninstalling apps (before this "no space left on device" issue began) and no matter how many I deleted, it would act full a few days later. At first it acted full at 1GB free. Then over several weeks it eventually became 2GB, then 3...4... 6...8... and eventually even with 9GB free, the device still acted like it was full! So I knew a HUGE amount of disk space was unaccounted for bc I had uninstalled dozens of gigs of apps.
Precipitating Incident: Something catastrophic happened a few months ago when I was legitimately very low on disk space and tried updating several apps at once. The iPad froze and several system databases were corrupted, and the iPad began asking me to setup certain passwords again, etc. Ever since then I've had various issues with it but was able to use it mostly. Until last week!
I ended up Jailbreaking the iPad because I'm at the end of my wits and going to have to erase the device if I can't solve it, and I was absolutely DYING to run a "du -h -d 1" to see just WHAT was consuming roughly 60GB of missing space!!
I ran a fsck_hfs on the drive (which was incredibly difficult to do!!) and SURE ENOUGH, it said something like 2 million blocks free - should be 16 million, and I did the math and it made perfect sense! The fsck completed and rebooted and BAM! Suddenly my missing space is back and I've got 71GB free!
But that's around the time the problem got so bad that I can't create any files bigger than 2-8MB. I literally ran:
dd if=/dev/zero of=testfile.bin bs=1M count=10
..and it will fail at a certain number that almost always is a perfect MiB power of 2 (like 2, 4, or 8MiB) with "No space left on device". BUT I CAN ALWAYS WRITE AS MANY MORE FILES OF THAT SIZE AS I WANT! Let's say the limit is 4.0MiB today. I can do that DD command with incremental filenames over and over. I've done it 7 times in a row creating 7 files and every time it worked perfectly. If I made it 4.1MiB, it fails. Even though I just created 7x4 (32MiB) of files!
And STILL, the disk space CONTINUES to shrink on its own, this morning its down to 39GB free. If I fsck_hfs it again, it will go back to the ~70GB free mark, and slowly begin dwindling once again.
I'm at a loss. Just HOW can the device give "No space left on device" errors when there's dozens of GB free? The iPad only has 1 disk, divided into a 4GB /System partition and the rest on /private/var. My System partition is only 75% full which is normal for any iOS device.
I even checked the inodes with df and there's something like 4 billion inodes free on the Data disk (/dev/disk0s1s2).
Here are some relevant printouts (from various days):
iPad:/private root# df Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on /dev/disk0s1s1 9316200 6795912 2427128 74% 125137 4294842142 0% / devfs 99 99 0 100% 172 0 100% /dev /dev/disk0s1s2 486135960 476137152 9998808 98% 1217291 4293749988 0% /private/var iPad:/private root# df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk0s1s1 4.4Gi 3.2Gi 1.2Gi 74% 125137 4294842142 0% / devfs 50Ki 50Ki 0Bi 100% 172 0 100% /dev /dev/disk0s1s2 232Gi 227Gi 4.8Gi 98% 1217291 4293749988 0% /private/var iPad-Pro-256GB:/sbin root# mount /dev/disk0s1s1 on / (hfs, local, journaled, noatime) devfs on /dev (devfs, local, nobrowse) /dev/disk0s1s2 on /private/var (hfs, local, nodev, nosuid, journaled, noatime, protect) iPad-Pro-256GB:~ root# pwd /var/root iPad-Pro-256GB:~ root# dd if=/dev/zero of=test3.bin bs=1M count=20 dd: error writing 'test3.bin': No space left on device 9+0 records in 8+0 records out 8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.671137 s, 12.5 MB/s
Excerpt from one of the first fsck_hfs I ran when the device had about 9GB free but should've had 70GB free:
** Checking volume bitmap. Volume bitmap needs minor repair for orphaned blocks Volume bitmap needs repair for under-allocation ** Checking volume information. Invalid volume free block count (It should be 16884367 instead of 2063604)
A complete successful fsck_hfs:
iPad-Pro-256GB:/ root# umount -f /private/var && killall backboardd && fsck_hfs -f -y /dev/disk0s1s2 umount: /private/var: not currently mounted iPad-Pro-256GB:/ root# fsck_hfs -f -y /dev/disk0s1s2 ** /dev/rdisk0s1s2 Executing fsck_hfs (version hfs-366.30.3). ** Checking Journaled HFS Plus volume. ** Detected a case-sensitive volume. The volume name is Data ** Checking extents overflow file. ** Checking catalog file. Incorrect size for file MediaLibrary.sqlitedb (It should be 1343488 instead of 1564672) ** Checking multi-linked files. ** Checking catalog hierarchy. ** Checking extended attributes file. ** Checking volume bitmap. Volume bitmap needs minor repair for orphaned blocks ** Checking volume information. Invalid volume free block count (It should be 16972349 instead of 14633343) ** Repairing volume. Limited repair mode, not all repairs available ** Rechecking volume. ** Checking Journaled HFS Plus volume. ** Detected a case-sensitive volume. The volume name is Data ** Checking extents overflow file. ** Checking catalog file. ** Checking multi-linked files. ** Checking catalog hierarchy. ** Checking extended attributes file. ** Checking volume bitmap. ** Checking volume information. ** Trimming unused blocks. ** The volume Data was repaired successfully.
A. Nothing relevant on the syslog when large files fail to create.
B. Device: iPad Pro 9.7" 256GB iOS 10.2.1 HFS (not APFS which was introduced later in 10.3). Never jailbroken UNTIL long after this problem started.