At least three times since I have my Fairphone, I have got into a crisis in which the phone does not start up normally because the storage is full. Specifically, what happens is that first the phone crashes and goes off or reboots itself. When I attempt to turn it on again, it displays a message saying "Can't create log file" (or the like). Then, it goes off again and enters recovery mode.
The way I have found to fix this problem is by using Android Debug Bridge (adb) to access the filesystem of the phone from a computer and find a large file (typically a video) that I can mostly safely remove.
The steps are as follows:
-
Install adb in the computer, following this guide: doc.e.foundation/pages/install-adb
-
Connect the phone to a computer with a USB cable.
-
With the phone showing the recovery screen, navigate to Adavanced, then Enable ADB.
-
Check that adb is detecting the phone with
./adb devices
-
Start an interactive shell with
./adb shell
. This allows to more easily inspect the filesystem with linux commands. -
A problem seems to be that, at least on my Fairphone, disk encryption is used, so there is no direct access to the data and the files structure. We need to mount the relevant directory:
mkdir -p /mnt/userdata
mount /dev/block/bootdevice/by-name/userdata /mnt/userdata/
Massive credit to tcecyk for pointing this out here.
-
Now we can change directory to
/mnt/userdata/
where we can see some meaningful directories, for example/mnt/userdata/media/
. -
We can figure out which are the largest files in the media directory with the following command:
find /mnt/userdata/media/ -type f -printf '%s %p\n' | sort -nr | head -10
-
To decide which file(s) to delete, we can check their creation dates and file types (
ls -lh
) -
After deleting one or more large files, we should be able to reboot the phone, but first unmount the directory with
umount /mnt/userdata/
and exit the shell withexit
.