Increase GSI System Image size [Guide] - Android General

All praise and All thanks to God
Sometimes you are not able to install gapps or other zips from TWRP due to small size of system image.
Here are the steps to increase/decrease the system image size
1. Boot to TWRP and connect your phone through usb cable.
2. unmount system from TWRP
3. commands to execute:
adb shell
e2fsck -f /dev/block/by-name/system
resize2fs /dev/block/by-name/system 4G (Increasing size of system image size to 4gb, you can use any number you want, for example 2500M for 2500mb)
4. Mount the system in TWRP , now you have 4gb system image. check it by:
df system
5. Try installing the gapps or zip again. Done
Refer: https://linux.die.net/man/8/resize2fs

Dont work on Motorola One Power
chef:/ # resize2fs /dev/block/by-name/system_a 3500M
resize2fs 1.43.3 (04-Sep-2016)
The containing partition (or device) is only 655360 (4k) blocks.
You requested a new size of 896000 blocks.
Click to expand...
Click to collapse

matibu06 said:
Dont work on Motorola One Power
Click to expand...
Click to collapse
try a lower value ,maybe 2500M

Thanks! Confirmed working on a SM-G610M (a friend's Samsung J7 Prime/On NXT)

What is the exactly meaning of "unmount system from TWRP" sorry i'm french and this is not clear for me. Where i can go in TWRP to unmount the system.

i get this error
rosemary:/ # e2fsck -f /dev/block/by-name/system
e2fsck 1.45.4 (23-Sep-2019)
e2fsck: No such file or directory while trying to open /dev/block/by-name/system
Possibly non-existent device?
8|rosemary:/ #

I noticed, my rom has no system.img, which file I have to modify in this case ? I am on a Redmi Note 10s with this rom https://xiaomifirmwareupdater.com/miui/rosemary/stable/V12.5.15.0.RKLMIXM/ (the redmi note 10s have dynamic partition)

Sorry for my noob questions and responses but i'm noob in "Developement" lmao

Yanaoul said:
I noticed, my rom has no system.img, which file I have to modify in this case ? I am on a Redmi Note 10s with this rom https://xiaomifirmwareupdater.com/miui/rosemary/stable/V12.5.15.0.RKLMIXM/ (the redmi note 10s have dynamic partition)
Click to expand...
Click to collapse
you will need to resize it in fastbootd from the stock recovery.
flash the stock rec then "fastboot reboot fastboot" from bootloader.
then fastboot resize-logical-partition <partition> <size>

PS C:\Users\MohammedMehdiTBER> adb shell
prague:/ # e2fsck -f /dev/block/by-name/system
e2fsck 1.43.3 (04-Sep-2016)
e2fsck: No such file or directory while trying to open /dev/block/by-name/system
Possibly non-existent device?

Related

Can't mount storage on sony xperia L. Hard brick Xperia L during repartition.

here is what i did in my sony xperia L and now i anything that can help kindly let me know
I rooted my device and then i officially unlocked my bootloader but after unlocking bootloader the phone was stuck in bootlooop so i installed stock recovery in the phone using flashtool and phone was just fine then. I did all this in order to change the partition of my phone.
Now i installed cwm recovery and after that phone i did the following commands
Open a command window: CMD, then get into shell:
adb shell
Once in shell, type:
umount /storage
parted /dev/block/mmcblk0
print
This prints out the partition information of your phone's memory chip
You will see the partition numbers in the first column, partition names in the last one,
in between you have the start/end memory index and the partition size
------start---end---size
...
31---1795---3506---1711---userdata
32---3506---7818---4312---sdcard
In the above output, consider the values indicated in italic as not to be changed !
Now calculate (open a spreadsheed if you like) the new value for the end of the userdata partition,
and use the same value for the start of the sdcard partition
On your sheet it should look something like this if you added 2048 to the userdata size
------start---end---size
31---1795---5554---3759---userdata
32---5554---7818---2264---sdcard
Remove userdata and sdcard partitions:
rm 31
rm 32
Create the new userdata and sdcard partitions:
mkpartfs logical ext2 1795 5554
name 31 userdata
mkpartfs logical fat32 5554 7818
name 32 sdcard
Exit parted to go to the adb shell again:
quit
userdata partition (31) needs to have ext4 file system
The following will do the ext2->ext4 conversion:
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p31
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p31
e2fsck -fpDC0 /dev/block/mmcblk0p31
Now when i restart my phone or even open the phone in cwm recovery it says cannot mount storage.
I tried installing the Rom again using flashtool it does not work and device gets disconnected probably coz now i am not able to mount my storage.
I tried to start adb shell and revert the changes i made in the above command in order to bring phone back to normal but now adb says no device is found.
I went to the customer service centre of sony they said they will change the motherboard.
Now my question is there any way i can fix my phone kindly tell me. I will really appreciate it Since i am not a software developer so i do not know any commands. Is there any way i can change my storage settings so they can be mounted again kindly let me know.
py.puneet said:
here is what i did in my sony xperia L and now i anything that can help kindly let me know
I rooted my device and then i officially unlocked my bootloader but after unlocking bootloader the phone was stuck in bootlooop so i installed stock recovery in the phone using flashtool and phone was just fine then. I did all this in order to change the partition of my phone.
Now i installed cwm recovery and after that phone i did the following commands
Open a command window: CMD, then get into shell:
adb shell
Once in shell, type:
umount /storage
parted /dev/block/mmcblk0
print
This prints out the partition information of your phone's memory chip
You will see the partition numbers in the first column, partition names in the last one,
in between you have the start/end memory index and the partition size
------start---end---size
...
31---1795---3506---1711---userdata
32---3506---7818---4312---sdcard
In the above output, consider the values indicated in italic as not to be changed !
Now calculate (open a spreadsheed if you like) the new value for the end of the userdata partition,
and use the same value for the start of the sdcard partition
On your sheet it should look something like this if you added 2048 to the userdata size
------start---end---size
31---1795---5554---3759---userdata
32---5554---7818---2264---sdcard
Remove userdata and sdcard partitions:
rm 31
rm 32
Create the new userdata and sdcard partitions:
mkpartfs logical ext2 1795 5554
name 31 userdata
mkpartfs logical fat32 5554 7818
name 32 sdcard
Exit parted to go to the adb shell again:
quit
userdata partition (31) needs to have ext4 file system
The following will do the ext2->ext4 conversion:
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p31
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p31
e2fsck -fpDC0 /dev/block/mmcblk0p31
Now when i restart my phone or even open the phone in cwm recovery it says cannot mount storage.
I tried installing the Rom again using flashtool it does not work and device gets disconnected probably coz now i am not able to mount my storage.
I tried to start adb shell and revert the changes i made in the above command in order to bring phone back to normal but now adb says no device is found.
I went to the customer service centre of sony they said they will change the motherboard.
Now my question is there any way i can fix my phone kindly tell me. I will really appreciate it Since i am not a software developer so i do not know any commands. Is there any way i can change my storage settings so they can be mounted again kindly let me know.
Click to expand...
Click to collapse
Just a question here, why did you want to change the partition of your phone?_? And no there isnt a way to revert thats a hard brick
Changing the motherboard will be the quickest method for Sony, which will not cause any trouble for them. You could ask the price for doing a low level format and restoring the partitions etc. Though I don't if they can do this in this case.

Maybe Storage Brick, "Can't open /dev/block/platform/msm_sdcc.1/misc"

Hi guys,
I currently have an issue with a Nexus 5 which runs smothly the last 2 years but suddenly didn't booted anymore.
I figured out, that something with the partitions is wrong, but didn't found any solutions.
Here is what I've done so far to solve the issue:
At first i tried to reinstall the factorey images via fastboot (unlocked bootloader). The install script run without any error promts, but I wasn't still unable to boot the device (stuck at Google logo).
After some research I found this thread which I think matched my issue the most: [Q] Phone not mounting and unable to flash roms. I followed the instructions and installed Phils recovery
log:
Code:
PhilZ Touch 6.57.9
ClockworkMod v6.0.5.1
E: Can't mount /cache/recovery/log
E: Can't open /cache/recovery/log
E: Can't mount /cache/recovery/last_log
E: Can't open /cache/recovery/last_log
E: Can't mount /cache/recovery/last_install
E: Can't open /cache/recovery/last_install
E: Can't open /dev/block/platform/msm_sdcc.1/misc
(No Such file or directory)
Then I got adb shell access and typed the commands in cmd:
Code:
C:\Users\mw>adb shell
~ # e2fsck /dev/block/platform/msm_sdcc.1/misc
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: No such file or directory while trying to open /dev/block/platform/msm_sdcc.1/misc
Possibly non-existent device?
~ # e2fsck /dev/block/platform/msm_sdcc.1/system
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: No such file or directory while trying to open /dev/block/platform/msm_sdcc.1/system
Possibly non-existent device?
~ # e2fsck /dev/block/platform/msm_sdcc.1/userdata
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: No such file or directory while trying to open /dev/block/platform/msm_sdcc.1/userdata
Possibly non-existent device?
~ # cat /proc/partitions
major minor #blocks name
~ #
I think that of some reason all partition information (or somethink simliar) got lost, which course the errors.
I would be greatful if somebody could help me.
Greetings Bulkatos
I would re-flash the latest stock ROM and flash the userdata.img file last. Immediately after flashing userdata, use the buttons to boot directly to recovery and perform and wipe data, cache, and reboot.
audit13 said:
I would re-flash the latest stock ROM and flash the userdata.img file last. Immediately after flashing userdata, use the buttons to boot directly to recovery and perform and wipe data, cache, and reboot.
Click to expand...
Click to collapse
I allready did this alot and with different factory images (android versions). All flash processes were successfuly. But I'm still not able to boot into Android.
If I'm booting into recovery (thats the only Image I can flash and boot into) I allways get the same error messages (see first post)
Code:
C:\Users\mw>adb shell
~ # cat /proc/partitions
major minor #blocks name
~ # e2fsck -y /dev/block/platform/msm_sdcc.1/by-name/persist
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: No such file or directory while trying to open /dev/block/platform/msm_sdcc.1/by-name/persist
Possibly non-existent device?
~ #
~ # make_ext4fs /dev/block/platform/msm_sdcc.1/by-name/persist
open: No such file or directory
~ #
~ # make_ext4fs /dev/block/mmcblk0
Need size of filesystem
~ #
~ # make_ext4fs /dev/block/mmcblk0 32G
Need size of filesystem
~ #
Did you perform a factory wipe right after flashing userdata?
I'd recommend, download the full stom from google, go to fastboot, EXTRACT den ZIP file and flash every image file on your on with:
fastboot flash system system.img
fastboot flash radio radio.img
fastboot flash userdata userdata.img
fastboot flash boot boot.img
fastboot flash cache cache.img ...
then reboot, let the phone FULL boot. If the boot finished, shutdown, reflash recovery and your rom, and try adb shell again

Can't mount vendor and system image as RW

I try to mount system and vendor partitions by using command below
Code:
sudo mount -o loop -t ext4 vendor.img vendor
got this error message
Code:
mount: xxx/xxx/vendor: wrong fs type, bad option, bad superblock on /dev/loop20, missing codepage or helper program, or other error
This command use to work on system image on different phone with same android version.
But I'm able to mount as RO using achieve mounter on Ubuntu.
Is there any way that I can mount those image as RW then edit some file in there?
OOS locks the system partition. No way in as of yet.
BeardKing said:
OOS locks the system partition. No way in as of yet.
Click to expand...
Click to collapse
Thank you

Question No Permissions for /system/ but I have root

I tried
mount -o rw,remount /system/
But
mount: '/system/' not in /proc/mounts
system-as-root = system is mounted as /, not /system
Permissions are fine.
DavidxxxD said:
system-as-root = system is mounted as /, not /system
Permissions are fine.
Click to expand...
Click to collapse
I can't write to / still
Are you root?
What is output of
Bash:
id
Bash:
su -c mount -o remount,rw /
Also try this to find out more
Bash:
mount | grep "/ "
DavidxxxD said:
Are you root?
What is output of
Bash:
id
Bash:
su -c mount -o remount,rw /
Also try this to find out more
Bash:
mount | grep "/ "
Click to expand...
Click to collapse
Bash:
berlna:/ $ id
uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),1078(ext_data_rw),1079(ext_obb_rw),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid),3012 context=u:r:shell:s0
Bash:
berlna:/ $ su -c mount -o remount,rw /
'/dev/block/dm-8' is read-only
Bash:
berlna:/ $ mount | grep "/ "
/dev/block/dm-8 on / type ext4 (ro,seclabel,relatime,discard)
And yes I have root
I've never seen this output from trying to remount. Could be a permanent read-only attribute somewhere. /dev/block/dm-8 looks like your system is on an encrypted partition, this could have something to do with the error. You can try using the busybox version of mount command. Also, does your device have a super partition? That could explain it.
DavidxxxD said:
I've never seen this output from trying to remount. Could be a permanent read-only attribute somewhere. /dev/block/dm-8 looks like your system is on an encrypted partition, this could have something to do with the error. You can try using the busybox version of mount command. Also, does your device have a super partition? That could explain it.
Click to expand...
Click to collapse
This is the same error i also face in oneplus os12 and yes my dev dm-x also is ro even after root
Its super.img and also i try with busybox
But useless
The only way now i can see is unpack backup super
Unpack edit repack and flash back
But its not possible for me
Rewriting the super partition every time, seems to be the only way in your case.
The lpflash tools are used to work with super partitions.
I've attatched a statically linked 64-bit ARM version that can run on the device, built from this source.
Extract the system image using
Bash:
./lpunpack -p system super.img
Note: This can also be run directly on the block device, it only reads.
From there, you can modify the system and add it to a super image (the firmware usually has sparse ones that need to be decompressed first). You could also flash the new system image directly via fastbootd mode.
Note: Ignore any "invaild sparse header" messages from fastboot.
Don't flash unsparse images on Samsung devices! They will not like it!
Hope this is helpful.
DavidxxxD said:
Rewriting the super partition every time, seems to be the only way in your case.
The lpflash tools are used to work with super partitions.
I've attatched a statically linked 64-bit ARM version that can run on the device, built from this source.
Extract the system image using
Bash:
./lpunpack -p system super.img
Note: This can also be run directly on the block device, it only reads.
From there, you can modify the system and add it to a super image (the firmware usually has sparse ones that need to be decompressed first). You could also flash the new system image directly via fastbootd mode.
Note: Ignore any "invaild sparse header" messages from fastboot.
Don't flash unsparse images on Samsung devices! They will not like it!
Hope this is helpful.
Click to expand...
Click to collapse
Its a super.img thx

[GUIDE] Dual-Boot for any Android Device

Code:
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: General information
This done by creating a new system partition using Parted (shrink userdata partition and creat the new system partition)
To Boot from the new system partition: change the name of the new system partition to "system" and the name of old system partition to any name e.g. "system-b"
To Boot from the old system partition: change the name of the old system partition to "system" and the name of new system partition to any name e.g. "system-b"
Dual boot for P20 lite - demonstration video (I am using SHRP RECOVERY (like TWRP) with tweaks to change boot partition easily, instead of writing terminal commands. This a video shows the dual boot process)
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
Code:
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"
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
4- remove "userdata" partition which in my case number 59 using the following command
Code:
rm 59
5- create the new system partition (partition number 59 in my case ) using the following command
Code:
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:
Code:
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:
Code:
mkpart userdata ext4 11153MB 31.3GB
set 60 msftdata on
7- get the new partition list
Code:
p free
8- exit
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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]
You can also create two userdata profiles such as here
https://forum.xda-developers.com/t/a-simple-way-to-kind-of-dual-boot-an-android.4176415/
Did you get what you described on your phone and would you like to show it in a video?
ze7zez said:
Did you get what you described on your phone and would you like to show it in a video?
Click to expand...
Click to collapse
Yes. It is worked on my phone Huawei P20 lite ... I am using SHRP RECOVERY (like TWRP) with tweaks to change boot partition easily, instead of writing terminal commands. This a video shows the dual boot process
Flashable zip Files to switch easily between the two android os (you must have "System" and "System-b" partitions, other names not accepted)
Flash "Active-New-System-partition-arm64-v2" to active the new system partition
Flash "Active-Default-System-partition-arm64-v2" to active the default system partition
Anyone else tried this? I'm courious how safe this is... Someone warned me it's very easy to brick device
Abdelhay.ali said:
Code:
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: General information
This done by creating a new system partition using Parted (shrink userdata partition and creat the new system partition)
To Boot from the new system partition: change the name of the new system partition to "system" and the name of old system partition to any name e.g. "system-b"
To Boot from the old system partition: change the name of the old system partition to "system" and the name of new system partition to any name e.g. "system-b"
Dual boot for P20 lite - demonstration video (I am using SHRP RECOVERY (like TWRP) with tweaks to change boot partition easily, instead of writing terminal commands. This a video shows the dual boot process)
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
Code:
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
Code:
rm 59
5- create the new system partition (partition number 59 in my case ) using the following command
Code:
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:
Code:
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:
Code:
mkpart userdata ext4 11153MB 31.3GB
set 60 msftdata on
7- get the new partition list
Code:
p free
View attachment 5775221
8- exit
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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]
Click to expand...
Click to collapse
Is only GSI flashing possible with this method or any custom ROM?
It should work with any GSI/ROM..... It just change the name of the system partition.
Lord Sithek said:
Is only GSI flashing possible with this method or any custom ROM?
Click to expand...
Click to collapse
Abdelhay.ali said:
It should work with any GSI/ROM..... It just change the name of the system partition.
Click to expand...
Click to collapse
Well, I've tried that procedure on my secondary device but something got screwed and I ended up with the need of EDL flash. Maybe I made a mistake, idk, but it's definitely dangerous
Lord Sithek said:
Anyone else tried this? I'm courious how safe this is... Someone warned me it's very easy to brick device
Click to expand...
Click to collapse
Lord Sithek said:
Well, I've tried that procedure on my secondary device but something got screwed and I ended up with the need of EDL flash. Maybe I made a mistake, idk, but it's definitely dangerous
Click to expand...
Click to collapse
This can happen
Abdelhay.ali said:
Code:
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: General information
This done by creating a new system partition using Parted (shrink userdata partition and creat the new system partition)
To Boot from the new system partition: change the name of the new system partition to "system" and the name of old system partition to any name e.g. "system-b"
To Boot from the old system partition: change the name of the old system partition to "system" and the name of new system partition to any name e.g. "system-b"
Dual boot for P20 lite - demonstration video (I am using SHRP RECOVERY (like TWRP) with tweaks to change boot partition easily, instead of writing terminal commands. This a video shows the dual boot process)
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
Code:
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
Code:
rm 59
5- create the new system partition (partition number 59 in my case ) using the following command
Code:
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:
Code:
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:
Code:
mkpart userdata ext4 11153MB 31.3GB
set 60 msftdata on
7- get the new partition list
Code:
p free
View attachment 5775221
8- exit
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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]
Click to expand...
Click to collapse
look what i got
edit: appearently any name u put when u use the command mkpart doesn't register or smtg idk what's wrong tbh
edit2: i found a solution just do "name 38(in my case) userdata" and it'll name the partition
i accidentally hardbricked my xiaomi pad 5 by deleting the dbg partition (could not find any information about it online), can anybody help?
Does not the new system-b alias requires its own data partition? The new system image may not be compatible with data partition.
New Android OS requires its own data. Above approach will share the /data among different system images which is something not useful.
dual boot is nonsense because one can't share same userdata partition between ROMs
alecxs said:
dual boot is nonsense because one can't share same userdata partition between ROMs
Click to expand...
Click to collapse
Yes you can but it does not work with all apps.
I got an app in the Dualboot I made for Oneplus 6/7 series and had an app where you can choose which apps should be shared on both roms.

Categories

Resources