This process is extremely dangerous. You may brick your device. Do it only if you know what you are doing! I am not responsible of bricked devices or dead sdcards.
I've decided to write this guide since this seems to be the only way to resize system partition to install larger GSIs.
Before starting remember to always make a backup since you will loose all your data.
Also DO NOT DO a simple copy-paste compare with yours first and if you have any doubts write in the comments before enter the doubtful command. Prevention is better than cure!!
This process has been tested on my own device but it has not been tested restoring stock firmware.
(You can also join the telegram group to ask for help https://t.me/MotorolaOneAction)
- Latest TWRP downloaded (to be booted through fastboot later)
- Parted arm64 static binary (attached below)
- Latest fastboot and ADB commands installed
- Boot to TWRP from fastboot
- Run the following commands:
adb push /path/to/parted /sbin/parted adb shell chmod 777 /sbin/parted parted /dev/block/sda p free
- Now parted will list your partition table which should be like this:
- Save the output of the command above (this is very important to restore original partition table if you will run into issues in the next parts)
- Now with extreme attention type
rm 42 rm 41 rm 40 rm 39
- Once you removed these partition it's time to recreate them following the original order but increasing the target partition size, in our case system_b. Type
mkpart name fs_type start end
mkpart system_b ext4 5630MB 9851MB mkpart oem_a ext2 9851MB 9918.1MB mkpart oem_b ext2 9918.1MB 9985.3MB mkpart userdata ext4 9985.3MB 128GB
- Now restore the partition flags typing
set partition_number msftdata on
set 39 msftdata on set 40 msftdata on set 41 msftdata on set 42 msftdata on
- Now type again
- Reboot to bootloader and boot again into TWRP
- If in the logs you see lot of red lines saying it could not mount oem partition and userdata partition don't panic, it is normal since they have not been formatted yet (they are registered into fstab with a different file system type). Type:
adb shell mkfs.fs_type /dev/block/sdapartition_number
adb shell mkfs.ext4 /dev/block/sda39 mkfs.ext2 /dev/block/sda40 mkfs.ext2 /dev/block/sda41 mkfs.f2fs /dev/block/sda42
- Now reboot to bootloader and again into TWRP. Logs now should be free of red lines and you should be able to mount all partitions again.
- You have done it!! Now you are able to flash larger GSI (I suggest you doing it from TWRP since fastboot may have some problem recognizing the resized partition size, also remember to change the active slot to the resized one, in my case the slot b)