[Huawei Mediapad M3 Guides, News, & Discussion] surdu_petru:
REVERT SYSTEM PARTITION FROM 5GB TO STOCK ( about 2GB )

Go to OP and assure you that you already have sbin/mkfs.ext4 & sbin/parted in your device with the right permissions

STEP I:

adb shell

# parted /dev/block/mmcblk0

(parted) rm 49

(parted) rm 48

(parted) rm 47

(parted) rm 46

(parted) rm 45

(parted) rm 44

(parted) rm 43

(parted) mkpart system ext2 1174 3255

(parted) name 43 system

(parted) set 43 msftdata on

(parted) mkpart cust ext4 3255 3456

(parted) name 44 cust

(parted) set 44 msftdata on

(parted) mkpart version ext4 3456 3490

(parted) name 45 version

(parted) set 45 msftdata on

(parted) mkpart vendor ext2 3490 4127

(parted) name 46 vendor

(parted) set 46 msftdata on

(parted) mkpart product ext4 4127 4329

(parted) name 47 product

(parted) set 47 msftdata on

(parted) mkpart hisitest 4329 4333

(parted) name 48 hisitest2

(parted) set 48 msftdata on

- for devices with 32GB :

(parted) mkpart userdata 4333 31.3GB

- for devices with 64GB :

(parted) mkpart userdata 4333 62.5GB

(parted) name 49 userdata

(parted) set 49 msftdata on

(parted) quit

Step II : activating partitions for reuse :

# mkfs.ext4 /dev/block/mmcblk0p43

# mkfs.ext4 /dev/block/mmcblk0p44

# mkfs.ext4 /dev/block/mmcblk0p45

# mkfs.ext4 /dev/block/mmcblk0p46

# mkfs.ext4 /dev/block/mmcblk0p47

# mkfs.ext4 /dev/block/mmcblk0p49

- go to TWRP -> Wipe -> Advanced Wipe -> select System -> Repair or Change File System -> Change File System -> EXT4 -> Swipe to Change

- go to TWRP -> Wipe -> Advanced Wipe -> select Vendor -> Repair or Change File System -> Change File System -> EXT4 -> Swipe to Change

- go to TWRP -> Wipe -> Format Data -> yes

- reboot device from TWRP to TWRP in order to use data again after formated !

- go to TWRP -> Wipe -> Advanced Wipe -> select Dalvik/ART Cache, Cache, Data, Internal Storage, System, Vendor -> Swipe to wipe

Now you are able to use only custom ROM based 2GB system partition ( or unmodified system partitions )

Note:

If a custom rom does not specify what kind of system partition it uses, it is because it implicitly uses the stock system partition of 2GB

Note II:

after each operation to increase/decrease the storage capacity of the system partition, the product partition will be wiped, that mean you need to flash ( your stock EMUI5.x ) product partition on your device after each operation !

So, you need to extract PRODUCT.IMG from your UPDATE.APP ( UPDATE.APP from stock EMUI5.x firmware ) , convert/sparse image with simg2img ( simg2img PRODUCT.IMG product.img ) and flash to device :

You can flash product.img into TWRP/LOS17.1 or LOS 18.1 in this way :

copy product.img to a tmp directory

adb push tmp data/local

adb root

adb shell

# dd if=/data/local/tmp/product.img of=/dev/block/bootdevice/by-name/product

The example above was for using LOS, if you use TWRP, the process is almost identical, you just need to know exactly where you copied product.img to put the correct path to (if=/your_folder_name/product.img)

NOTE III :

simpler and safer, to be sure that you have all the partitions correctly activated and ready for reuse, it would be advisable to use the dload method to reinstall the whole EMUI 5.x firmware ( UPDATE.APP ) - just after the system partition was resized to stock 2GB and you activated the partitions following the STEP II