Removing device encryption on a Samsung Galaxy S3 (i9300) running CyanogenMod 10.1
I couldn't disable the full-device encryption on my phone even by doing factory
resets both from Android and the recovery mode, the later being unable to mount
There was a lot of people complaining about this on the internet but nobody
provided a working solution so I had to investigate this myself.
Note: this will erase everything as would a factory reset do.
I hope this bit of knowledge will be useful to you.
TL;DR: recreate ext4 partition on /data
1. Get ADB
ADB can be found in the ADT bundle of the Android SDK 
On debian-based distributions,
ia32-libs needs to be installed for ADB to
run. If you get a "file not found" error when running
adb, run the following
$ dpkg --add-architecture i386 $ apt-get update $ apt-get install ia32-libs
2. Boot your device into recovery and launch ADB
To boot the i9300 into recovery mode, turn it off and turn it on while holding the "home" and "volume up" buttons. When the "Samsung SIII" logo appears, release the buttons.
Plug the phone to the computer via USB and run the following commands:
$ adb usb $ adb root $ adb -d shell
You are know in a BusyBox environment running on your phone.
3. Obtain the partition number for USERDATA
To get the partition number for / run parted and the parted
$ parted /dev/block/mmcblk0 GNU Parted 184.108.40.206.179-aef3 Using /dev/block/mmcblk0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print print Model: MMC VTU00M (sd/mmc) Disk /dev/block/mmcblk0: 15.8GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 4194kB 8389kB 4194kB BOTA0 2 8389kB 12.6MB 4194kB BOTA1 3 12.6MB 33.6MB 21.0MB ext4 EFS 4 33.6MB 41.9MB 8389kB PARAM 5 41.9MB 50.3MB 8389kB BOOT 6 50.3MB 58.7MB 8389kB RECOVERY 7 58.7MB 92.3MB 33.6MB RADIO 8 92.3MB 1166MB 1074MB ext4 CACHE 9 1166MB 2777MB 1611MB ext4 SYSTEM 10 2777MB 3364MB 587MB ext4 HIDDEN 11 3364MB 3372MB 8389kB OTA 12 3372MB 15.8GB 12.4GB USERDATA
/data is partition number 12 (USERDATA) on my device. The block device is
3. Create a new partition on
mke2fs -t ext4 on the block device you got at the previous step.
$ mke2fs -t ext4 /dev/block/mmcblk0p12 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 755904 inodes, 3022848 blocks 151142 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=3095396352 93 block groups 32768 blocks per group, 32768 fragments per group 8128 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
Reboot your device, you should see the CyanogenMod welcome/install screen instead of the Android password prompt.