The web is replete with advice to encrypt Android phones before resetting the phone for recycling. Using my old-school computer understanding (which may be out of date), the reason is that "normal" deletion simply marks file space as free for future use without overwriting the contents.

I am using CyanogenMod 12 with a 1st generation Moto G, so most of the online info isn't applicable. Since I am not a developer (either for Android of any other environment), I have to find the least technically involved method possible to encrypt and reset. For encryption, I found Lekensteyn's answer to be helpful. For some reason, however, my adb shell does not support pipelines, so my slight modification is, verbatim (except for the password and resulting Hex for the ASCII):

root@falcon_umts:/ # head -1 | tr -d '\n' | hexdump -ve '1/1 "%.2x"'
head -1 | tr -d '\n' | hexdump -ve '1/1 "%.2x"'
FF00FF00FFroot@falcon_umts:/ # vdc cryptfs enablecrypto wipe password 6d6f746f47
vdc cryptfs enablecrypto wipe password 6d6f746f47
200 0 -1

This process took a split second, so I'm not sure if it worked. From the background I've found online, encryption should take a good portion of an hour. Is there any way to check whether the phone is encrypted? I can still use the adb shell commands "ls" and "find" on the /data directory, though I'm not sure if that is the right path for me to worry about. I'm only interested in making the user-specific data inaccessible, i.e., Contacts, Calendar, personally created folders in File Manager, logins for GMail (IMAP) and Exchange Server. I have no apps or media files that I need to protect, nor do I have any cloud accounts apart from email accounts above (though I did use the Google store to download a PDF reader once).

Just from playing around (without necessarily a full appreciation), the "mount" command returns a whole whack of entries, while "ls mnt" only returns a handful.

Based on this site, the next step after ensuring encryption is to use Factory Reset. However, TWRP also has a Wipe function, with options to "Advance Wipe" and "Format Data". "Advance Wipe" has checkboxes for "Dalvik Cache", "Data", "Internal Storage", "Cache", "System", "USB OTG", which don't all have similarly named folders under the path "/" (so I'm not sure if they map to the file hierarchy). "Format Data" is described as wiping, so I'm not clear on whether this does the requisite overwriting of physical bits in the nonvolatile memory. For that matter, the above Stack Exchange solution isn't clear about this either, and I am assuming that the overwriting with indecipherable data is thing being sought in the encryption.

In summary, the questions about safely erasing the phone are:

  1. Is the encryption meant to do the required overwriting?
  2. Does the above Stack Exchange solution accomplish this? 2a. Since it happened so fast, how can I confirm its success?
  3. Is the /data folder tree that I should be focused on?
  4. Is the Settings->Factory Reset sufficent after #2?
  5. Does the default TWRP wipe accomplish this, along with erasure?
  6. Is the "Advance Wipe" or "Format Data" feature needed?

I am assuming that #4 is not required after #5 and/or #6.


P.S. I'm operating under the following constraints: I don't want to use Nuke My Phone because I no longer want to connect it to the internet, and I don't want to install any apps. I might try dd if=/dev/urandom of=random.txt bs=1G count=2 if I can't sort about my issue above, but the last thing I want to end up with is a crippled system that is only half cleansed. I will also look into how to extract the data critical parts for destruction, as I'm not interested in selling the phone. I'm avoiding upgrades to CM because it needs a TWRP upgrade, which requires a bootloader upgrade, which I'm reluctant to do ever since Motorola's handset division got sold overseas. Note that this page misses many of the points of interest, as it doesn't clarify whether "wiping" does the requisite overwriting, nor the odd encryption behaviour that I encounter.

2017-11-05 UPDATE: I have been unable to get the original ROM to install in order to enable encryption of the solid state drive. Based on the prospects of wear levelling, I have doubts about the effectiveness anyway. At this point, my only certain solution is to disassemble the device as much possible, separate away the components that are obviously not electronic, then physically pulverize the rest with a hammer (and with the components in a milk bag to keep them from scattering).

  • I said that if I don't get encryption working, I want to kill the data-sensitive hardware components and recycle the rest in an environmentally responsible fashion. While I didn't find anything useful from googling securely-destroy-moto-g, I did find some hardware teardown/service guides: teardown; and (linked to from the teardown page), servicing. Oct 9, 2017 at 20:19
  • For question #2 above, this page shows that Settings->Security should display "Encrypted" under the Encryption option if you succeed in encrypting. It turns out that I did not succeed, and I am now dissecting the other answers on the source page for alternatives. It's all seem very tuned to developers, however, who are familiar with the commands cited. Oct 9, 2017 at 20:24
  • Frederick Nord's solution refers to an explanation at forum.cyanogenmod.org for why he reduces the size of the partition. That URL doesn't seem valid at this time. Would anyone know where I might find an archived version? Oct 10, 2017 at 5:02


You must log in to answer this question.

Browse other questions tagged .