Skip to content

Instantly share code, notes, and snippets.

Last active Oct 9, 2020
What would you like to do?
Removing device encryption on a Samsung Galaxy S3 (i9300) running CyanogenMod 10.1

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 /data. 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 [1] 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 commands:

$ dpkg --add-architecture i386
$ apt-get update
$ apt-get install ia32-libs

[1] :

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 print command:

$ parted /dev/block/mmcblk0
GNU Parted
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) 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 then /dev/block/mmcblk0p12.

3. Create a new partition on /data.

Run 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.

4. Reboot

Reboot your device, you should see the CyanogenMod welcome/install screen instead of the Android password prompt.


This comment has been minimized.

Copy link

@slisznia slisznia commented Dec 2, 2013

Your instructions worked great on Nexus 10 - CM-10.2. I suggest title change to:
"Removing device encryption with ClockworkMod Rrecovery"


This comment has been minimized.

Copy link

@clschnei clschnei commented Dec 4, 2013

This won't wipe "sdcard" correct?


This comment has been minimized.

Copy link

@gioannou gioannou commented Feb 25, 2014


My device just randomly crashed one day while I was charging it, and it refused to boot after the fact.

Device: Galaxy S3 - GT-I9300
Firmware: CM 11 - 4.4.2 (Nightly)
Recovery: CWM
Encryption: YES

Because of the encryption I was unable to flash the device using ODIN, HEIMDALL, or Samsung Kies. They all just gave up either immediatley or after some time.

I would like to follow the above the steps, but when I use the following command in the ADB shell:

parted /dev/block/mmcblk0

it points me to the EXTERNAL sd card, not the internal one. If I remove the external card, then I get no results.

Where should I go from here to completely wipe the device?

Thank you very much,



This comment has been minimized.

Copy link
Owner Author

@L-P L-P commented Mar 10, 2014

@clschnei 'sdcard' is the (idiotic) name of the internal memory IIRC so it will be wiped. I don't have the device anymore so I can't confirm.

@gioannou no idea.


This comment has been minimized.

Copy link

@andyg54321 andyg54321 commented Apr 30, 2014

Great post. I would add: Leave at least a 16 KB space at the end so that encryption can be re-enabled later.

My S3 had the same numbers as OP. I used the following command that allowed encrypting again afterwards:
mke2fs -T ext4 -L data /dev/block/mmcblk0p12 12058624



This comment has been minimized.

Copy link

@paul-nelson-baker paul-nelson-baker commented Aug 26, 2014

I found this in google but it didn't work for me. I had to install TWRP recovery and force wipe everything. By everything I mean everything. I had to reinstall CM from recovery again because the rom itself was wiped. This was the only way I was able to remove encryption.


This comment has been minimized.

Copy link

@tmhpfnr tmhpfnr commented Oct 25, 2014

Ty, that helped me.

FYI: On my device Galaxy Tab 2 (P5110) the data portion name is DATAFS and number 7.


This comment has been minimized.

Copy link

@guilhermehecosta guilhermehecosta commented May 6, 2016

Thanks so much! Worked very fine for me. I'm using Cyanogem 13, Android 6.


This comment has been minimized.

Copy link

@amini8 amini8 commented Jan 29, 2017

Thanks, CM 14, Android 7
Can I translate it to Persian and put my github page ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment