Removing encryption from recovery I'm running CyanogenMod 12 nightly on my G900T (klte). Everything works great except for the default encryption password, which causes my phone to boot loop.

I've formatted data and done factory resets, but /data is still encrypted and shows up as /dev/dm-0. 

Is there a command that I can do to remove the encryption? I don't care about the data, I want it all gone. I just want to get back to having /data and the internal storage being stored in plaintext on disk to be able to boot into CyanogenMod. 

How can I use adb shell to remove the encryption on these partitions?
The answer for me involved a number of things, but I think one is really the key.

Use the "recovery" Command, bro

This uses CyanogenMod's/AOSP's recovery program to wipe the user data and disable encryption. (found in this answer on Stack Overflow) Boot into your recovery, and then from your computer run

adb shell recovery --wipe_data --set_filesystem_encryption=off


Your phone will reboot into system and things should hopefully work as planned. 

If you need to run it from the phone itself (ie: you don't have a computer nearby to adb with):

recovery --wipe_data --set_filesystem_encryption=off


It should wipe, disable encryption, and reboot system.

If All Else Fails

Don't use this method unless the above doesn't work or apply to your scenario.

Destroy the LUKS Header for Filesystem Encryption


You need a recovery which will allow you to drop to a shell as root, so TWRP works in my case. 
Locate the userdata partition by looking around in /dev/block/platform/*/by-name/userdata. 
Write out a ton of zeroes to the beginning of that partition to wipe the LUKS header:

dd if=/dev/zero of=$PATH_TO_YOUR_USERDATA bs=4096 count=512


I claim no responsibility for what you do with this command. If you screw this up, you can brick your phone by overwriting your bootloader or other critical partitions. Make sure that $PATH_TO_YOUR_USERDATA points to the real userdata partition. Check the size of that partition to make sure you're wiping the right thing. I have a 16GB phone and userdata is 10.4GB, with the rest being dedicated to system, but your phone will be different.
Reformat that partition as ext4 using make_ext4fs $PATH_TO_YOUR_USERDATA. 

There might be errors, but usually they relate to not being able to find the internal "sdcard," this is okay.


After all this, reboot recovery again and then run a factory reset just to be safe.

Why Does This Work?

Simply doing a factory reset seemed to not do anything for me, the phone would still see a LUKS partition there. I assume that this is because the LUKS header still existed at the disk level and the ext4 partition was just overlaid on top of it. For some reason, Android prioritized detection of a LUKS partition over an ext4 partition and attempts (and succeeds) to mount that.

Where to Go from Here

(If you know what you're doing, you might also want to wipe system and install your ROM from scratch. Again, I take no responsibility for anything you do with the information contained in this post.)

Worked for me on a klte G900T (Samsung Galaxy S5 T-Mobile). Your mileage may vary.