Droid Incredible: Free At Last

A week or so ago, I started getting the much-mentioned, not-resolved error on my Droid Incredible: “Low on space: Phone storage space is getting low.” After trying a few quick fixes suggested by some Google searches, I finally rooted the phone last night and got to the bottom of it.

As this ZDNet article notes, the error message is confounding, because it’s only supposed to appear when you have less then 10MB of storage free on your “phone memory”, yet you can see in Settings→SD card & phone storage that there are hundreds of MB free. It turns out that the problem is that the “phone storage area” is divided into two partitions. One of these is approximately 748MB, is mounted on /data, and is where user-installed applications are stored. The other is about 150MB, is mounted on /data/data, and is where applications store their data. What the SD card & phone storage settings page shows you is the partition that is mounted on /data, but what was running out of space was /data/data.

So, how do you figure out what’s taking up all the space?

  1. Root your phone. This is now a trivial matter, thanks to unrevoked3. This will install the very useful ClockworkMod recovery image, as well as adding a “Superuser Permissions” app that will allow you to grant root access to applications that request it.
  2. Install the Android SDK.
  3. Connect the phone to your computer via USB, and enable USB debugging (under Settings→Applications→Development).
  4. Reboot your phone into the ClockworkMod recovery image, either by using adb reboot recovery from the Android SDK, or powering the phone on while holding the volume-down button, then selecting “recovery” from the HBOOT screen.
  5. Mount the data partition. In ClockworkMod, go to partitions→mount /data.
  6. Get a root shell on your phone by running adb shell on your computer.
  7. Mount the /data/data partition by running the following command from the shell you have on your phone: mount /dev/block/mtdblock6 /data/data
    .
  8. cd to /data/data, and use du (du -sk * | sort -n is a useful pipeline) to find out what’s taking up all the space. (As an aside, it’s way easier to poke around the filesystem from the recovery image rather than using su to get root when the phone’s running normally. The set of command-line tools provided in Android is very bare-bones—you don’t even have cp—while you’ve got a well-equipped BusyBox in the recovery image.)

In my case, I found that the com.android.providers.contacts directory was taking up over 100MB, 90MB of which was in a SQLite database. I had no contacts stored locally, so I just mounted the SD card, copied the directory to that for backup/forensic purposes, and deleted it from /data/data. After rebooting the phone and resyncing my contacts with GMail, the space being used in that directory was cut down by an order of magnitude. I do note that I can no longer sync Facebook contacts, but I’m not certain that that is a result of this—that may not have been working before the “low on space” debacle. If this problem re-occurs, I’ll dig into that SQLite DB to try to find out what was taking up all the space. For the moment, though, the problem is resolved.

Now that I have a rooted phone, I’m very tempted to install the leaked Android 2.2+Sense leaked ROM