I use a Nokia N9 as my cell phone, largely because its MeeGo operating system is Linux based and in fact the command-line can be used very similarly to any other Debian system. This also means Linux sysadmining skills can be used to work around bugs in this sadly no longer supported platform.
The N9 stores a lot of its state including contacts, messages, and
call logs in an SQLite database called
tracker. It turns
out many people have had trouble with it
failing, resulting in the contacts app showing the error
import contacts and the messaging the phone apps also showing no
data. Those threads offer various solutions on how to get your phone
back to a working state. In my case, I followed the instructions, and
my phone worked fine for several months before failing in the same way
I followed the instructions a second time but noticed that it was giving
disk full errors. On further inspection, it was clear that the
disk wasn't actually full: it was actually out of inodes. After some
work which led to
my previous blog post, I found
/home/user/.cache/telepathy/avatars/gabble/jabber/ had hundreds of thousands
of files (and I don't have that many friends).
Simply deleting them freed up all of the inodes and I haven't had any
troubles since, although I've been making regular backups just in case.
Recovering (some) lost data#
While the files have been deleted, they may not have been overwritten
yet, so there may be some hope of a partial recovery. The data for
tracker is stored in
df has the
useful side effect of revealing which filesystem a directory is on:
$ df /home/user/.cache/tracker/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mmcblk0p3 2064208 793712 1165640 41% /home
Attempting data recovery on a mounted partition is a bad idea as the
unused space might get overwritten by new files; it's best to make a
copy of it. Now that we know where the filesystem is, we can copy it
dd if=/dev/mmcblk0p3 | ssh $hostname dd of=$file
Then we can examine the partition offline. Particularly
grep with its
options can search for known strings like names and phone numbers
and nearby content. For example, searching for a phone number without
spaces should find at least some of the associated text messages:
strings partdump | grep -A3 -B3 -F '+19175551212'
Unfortunately, this method is slow and unreliable. I've used it to recover a few text messages and a few phone numbers, but there's no clear way to automate it, so do not expect to recover all of your contacts and text messages this way.