[Huawei Mediapad M3 ROMs, Kernels, Recoveries, & Ot] surdu_petru:
Fix Data Partition Size !!!

Hello !

I will explain here how the partition /data should be resized in order to be able to Encrypt device on any custom ROM based Android 10 !

From the total of data size, we need to reserve 32768 bytes for encryption stuff.

First, your device should be running Android 10 with TWRP 3.3.1-2 installed ( if you are here, I guess this is already done - what follows is not for Android Pie or for another version of TWRP )

Connect USB cable and type : ( it doesn't matter if you are now on TWRP or a custom ROM based Android 10, btw, make sure you have already enabled "Android debugging" if you're not on TWRP )

You're now on bootloader mode, here only fastboot commands are allowed !

Determine total size of /data partition by typing this command :

Because there are three versions of data storage size : 16GB, 32GB & 64GB - the response to the above command will vary depending on the capacity of your device !

Something like this you'll see after above command :

Let's assign a name to this value, to make it easier to explain what to do next:

I'll call "sectors" the value "0x5xxxxxxxx" which means the total size of your data partition !

If you have any questions so far, then it's time to ask for help, before going any further: because we'll perform some operations with "sectors", and you should already understand what "sectors" mean ... basicly it's a value equale with the total size of youre data partition returned by fastboot !

Convert "sectors" from hex to decimal using any converter online hex-to-decimal !

"sectors" it'll be now a number made up of digits from 0 to 9 !

Subtract now from "sectors", 32768 .... something like this : "new_sectors" = "sectors" - 32768

The new sectors "new_sectors" will be smaller by 32768 than the one convert from hex to decimal !

Now, this last value ("new_sectors") must be divided to 512 : "new_new_sectors" = "new_sectors" : 512

Let's go back to the "sectors", so we'll rename "new_new_sectors" to "sectors" , so the final value of "sectors" will be smaller by 32768 than the one convert from hex to decimal and also divided to 512 !

Finally, we can summarize all the above operations to this one :

As soon as you have the final value and everything went clarity, we need to format data under twrp with this final value of "sectors" !

Reboot device from bootloader mode :

Reboot device to TWRP :

Warning : all data will be lose because we need to format /data :

In order to reformat data Unmount data & type those commands :

Unmount data : check "Mount" & under "Select Partitions to Mount:" deselect/uncheck "Data" !

Instead "sectors" you"ll must introduce the value of "sectors" which is a number made up of digits from 0 to 9 !

Reboot your device again to TWRP in order to be able to use /data !

That's ALL ... you can now install the new TWRP 3.3.1-3 ( please check OP for download ) with /data decrypt support and also the new LOS 17.1 ( released ) where you'll be able to Encrypt tablet without issues !

Warning :

Starting from now you should never format data again into TWRP in this way : Wipe -> Format Data !

This operation will remove "data" encrypt/decrypt support and your device will not be able to be encrypted under any custom ROMs Android 10 !