19-09-2019, 11:28 PM
This is a step by step guide on how to fix the 0 MB internal storage / data encryption (decrypt data, enter password) issue in TWRP. This issue doesn't mean there's a problem with your ported TWRP recovery, it simply means your device has encrypted userdata. This issue results in your custom recovery being unable to mount userdata partition.
![[Image: twrp-data-decrypt-password-0mb-internal-storage.jpg]](https://www.hovatek.com/blog/bpyeki/uploads/2019/09/twrp-data-decrypt-password-0mb-internal-storage.jpg)
Ensure to read the important notice section at the end of the guide
Method 1 - Patching fstab in /vendor partition using file manager + root access
Note that this method will only be doable if your device rooted
See the video below or @ https://youtu.be/YSSaGE2CW7A- Install a file manager with root access e.g File Explorer Root Browser bu Jrummy apps from Play Store
- Launch the file manager and note that you might need to enable root access depending on the app. For Xplore, click the three dots at the top right hand corner > configuration > root access > superuser + mount writable
- Return back to the file manager then navigate to /vendor/etc/fstab.**
- Edit the fstab file by long pressing it then select Edit
- Search for the word "encrypt", you'll find it on the same line containing userdata's mount point e.g as seen below, the full word in this example is forceencrypt
Code:/dev/block/platform/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev wait,check,quota,formattable,resize,forceencrypt=/dev/block/platform/bootdevice/by-name/metadata,
- Replace only "forceencrypt" with "encryptable" e.g as seen below
Code:/dev/block/platform/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev wait,check,quota,formattable,resize,encryptable=/dev/block/platform/bootdevice/by-name/metadata,
- Save the file
- Also navigate to /vendor/nvdata/fstab.** , edit and make the same modification (if you can't find fstab in this location then skip it)
- Flash back your stock recovery.img
- Boot into stock recovery mode and do a factory reset
- Reboot to home screen (system) then flash back your TWRP
- Boot into TWRP and confirm that encryption issue is fixed
Method 2 - Flashing no-verity-opt-encrypt.zip in TWRP
- Download no-verity-opt-encrypt.zip @ https://build.nethunter.com/android-tool...t-encrypt/
- Copy this zip into external_sd or USB-OTG storage
- Reboot your device into TWRP recovery
- Click Install > Select Storage > ExtSD or USB-OTG (depending on where you stored the zip file) > Navigate to & select the no-verity-opt-encrypt.zip > Swipe the slider to flash
- If successful, reboot TWRP then confirm if encryption issue is fixed
- If it's not then reflash no-verity-opt-encrypt.zip then Format /data partition (TWRP > Wipe > Format Data > Type yes)
- Then reboot TWRP and confirm if encryption issue is fixed
Method 3 - Patching fstab in /vendor partition using TWRP + Text editor
Note that this method will only be doable if you're able to mount vendor partition in TWRP > Mount. If you can then proceed with the steps below if not then try a different method
- Boot to TWRP
- Mount vendor partition in TWRP > Mount
- Return to TWRP homescreen > Advanced > File Manager
- Navigate to /vendor/etc/ then copy fstab.** to external_sd or USB-OTG storage
- Navigate to /vendor/nvdata/ then copy fstab.** to a different folder in external_sd or USB-OTG storage (if you can't find fstab in this location then skip it)
- Now to edit the fstab file(s) you just copied, either reboot your device to homescreen and use a text editor from play store or while in TWRP, you can copy the file to your PC (only if MTP works in TWRP)
- Edit the fstab file using any text editor
- Search for "forceencrypt", you'll find it on the same line containing userdata's mount point e.g as seen below
Code:/dev/block/platform/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev wait,check,quota,formattable,resize,forceencrypt=/dev/block/platform/bootdevice/by-name/metadata,
- Replace only "forceencrypt" with "encryptable" e.g as seen below
Code:/dev/block/platform/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev wait,check,quota,formattable,resize,encryptable=/dev/block/platform/bootdevice/by-name/metadata,
- Save the file, copy it back into external_sd or USB-OTG storage
- Reboot to TWRP, copy the newly modified fstab file(s) to their various locations and replace the existing files
- Format /data partition (TWRP > Wipe > Format Data > Type yes)
- Then reboot TWRP and confirm if encryption issue is fixed
Important Notice
- If you end up with unknown baseband and null IMEI then set permission for the modified fstab file(s) to 644
- Since this method involves wiping userdata, ensure to backup your important stuff before proceeding
- If you don't see "forceencrypt" within the fstab file but rather you see "forcefdeorfbe" or "fileencryption" then change it to "encryptable"
- If you modify fstabs in vendor but they keep getting restored, then flash Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip @ https://androidfilehost.com/?fid=4349826312261749617 to disable force encryption then format /data
- If you happen to format /data and reboot and your device keeps booting back to TWRP, then flash back and boot into stock recovery.img then perform a factory reset. You can flash back TWRP once factory reset is successful
- There's no guarantees that any method will work on your device so be sure to try each method, hopefully one works
- On some devices, check vendor/build.prop . Look for ro.crypto.volume.contents_mode=adiantum and ro.crypto.volume.filenames_mode=adiantum then change adiantum to footer