Daniel Keast

Managing Android disk usage

linux

I find the MTP implementation on Android to be very flaky. On multiple operating systems with multiple Android devices I’ve had it just hang at some point when transferring files.

My son’s phone started warning that it was low on storage. He barely had any apps installed, and nothing was obviously taking up the space. There wasn’t enough space to install any apps that would help, so I thought I’d just plug it in to the laptop and see what I could find. The usual happened though, and after three attempts with the connection hanging when trawling the file system I thought I’d try to find another approach.

The Amaze file manager was already on the phone, and has an FTP server feature, I turned that on and checked it worked by browsing the file system through my web browser.

curlftpfs is a program that uses libcurl and fuse to mount an ftp server without root privileges. It’s packaged in Debian and is very simple:

$ mkdir /tmp/phone-mount
$ curlftpfs ftp://192.168.1.231:2211 /tmp/phone-mount
$ ls /tmp/phone-mount/Android
data  media  obb

The program ncdu is an ncurses based application for managing disk usage that is also in Debian.

ncdu

The up and down arrow keys select from the menu, enter goes into a directory, and ‘d’ deletes an entry. A really simple application that does one thing well.

I found the files that were taking up the space, it turns out that lots of games had left files (sometimes gigabytes of them) inside the Android directory, which weren’t clearup up when he uninstalled them.