[Android General] Abdelhay.ali:
disclaimer
/*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,

*/

Hello

This Guide to make Dual-Boot for any android device that can be useful. It allows two Android os installed at the same time and switch between them almost as easily as a simple reboot.

Spoiler content hidden.

Requirements​

TWRP

Parted (attached arm and arm64, unzip the file)

Latest fastboot and ADB commands installed

Backup all your data because you will make a factory reset and format data partition

Steps:​

Boot to TWRP

Run the following commands

adb push /path/to/parted /sbin/parted
adb shell
chmod 777 /sbin/parted
parted /dev/block/mmcblk0
p free

note: parted /dev/block/xxxxx according do your device

3- it will show the list of partition "save this you may use it later". remember the number of old system partition which is in my case "52"

View attachment 5772225

4- remove "userdata" partition which in my case number 59 using the following command

rm 59

5- create the new system partition (partition number 59 in my case ) using the following command

mkpart name fs_type start end

name: name of new partition e.g "system-b"

fs_type: file system type e.g "ex4"

start: the end value in MB of the previous partition, in my case "7153MB"

end: equal to start + size where size will be the size of the target partition. in my case in need 4GB partition so end=7153MB + 4GB =11153MB

In my case I'll type:

mkpart system-b ext4 7153MB 11153MB
set 59 msftdata on

6- create the "userdata" partition (partition number 60 in my case, start= 11153MB )

In my case I'll type:

mkpart userdata ext4 11153MB 31.3GB
set 60 msftdata on

7- get the new partition list

p free

View attachment 5775221

8- exit

quit

9- format userdata and the new system partition using "mkfs.type /dev/block/mmcblk0pxx" (in my case partition number 59 and 60). you may need to reboot before doing that or make factory reset using your recovery

adb push /path/to/mkfs.ext4 /sbin/mkfs.ext4
adb shell
chmod 777 /sbin/mkfs.ext4
mkfs.ext4 /dev/block/mmcblk0p59
mkfs.f2fs /dev/block/mmcblk0p60

10- To Boot from your new system partition > boot to twrp and run the following command

adb push /path/to/parted /sbin/parted
adb shell
chmod 777 /sbin/parted
parted /dev/block/mmcblk0
name 52 system-b
name 59 system

or from TWRP terminal write the following

parted -s /dev/block/mmcblk0 name 52 system-b
parted -s /dev/block/mmcblk0 name 59 system

change the number 52 and 59 according to your partition list (in my case 59: new system partion, 52 old system partition ). Then reboot TWRP and flash your new android os

11- To Boot from your old system partition > boot to twrp and run the following command

adb push /path/to/parted /sbin/parted
adb shell
chmod 777 /sbin/parted
parted /dev/block/mmcblk0
name 59 system-b
name 52 system

or from TWRP terminal write the following

parted -s /dev/block/mmcblk0 name 59 system-b
parted -s /dev/block/mmcblk0 name 52 system

change the number 52 and 59 according to your partition list (in my case 59: new system partion, 52 old system partition ). Then reboot

-------------------------------------------------------

You may create flashable zip or modify TWRP file to switch between the two android os easily[/CODE]