[DEV][ Expand System Partition To 4GB - P9 Lite ] - Huawei P9 Lite ROMs, Kernels, Recoveries, & Other

Hello !
Here you will find the information needed to change the system partition from 2GB to 4GB - this operation is somewhat useful for installing any version of GApps on your device using LOS 17.1 Android 10 : Huawei P9 Lite Kirin version !
Download mkfs.ext4 and parted from here : https://forum.xda-developers.com/attachments/parted_gdisk_fdisk_mkfs-ext4-arm-zip.4494671/
Warning I: the entire data partition will be deleted following this procedure, make sure you have backed up and saved it to a microsd card
Warning II: if you have sound issues, please check Step III !
Step I : extended system partition from about 2GB to 4GB ( example for a device with 16GB )
- extract "mkfs.ext4" and "parted" from previously download archive and put them into a new created tmp directory
- connect the device to the computer via the USB cable and bring the device into TWRP revovery with this command :
> adb reboot recovery
- copy the two executable files from the computer to the device :
> adb push tmp data/local
> adb shell
# cp -r data/local/tmp/mkfs.ext4 sbin/mkfs.ext4
# chmod 0777 sbin/mkfs.ext4
# cp -r data/local/tmp/parted sbin/parted
# chmod 0777 sbin/parted
- launch the "parted" function as follows :
# parted /dev/block/mmcblk0
- display all properties of all partitions : (I wrote what needs to be displayed as a command before pressing enter, so you just have to type "print" and press enter because (parted) is already displayed as promter ... be careful not to type (parted) twice in the following commands)
(parted) print
- go to line 44, which should be the same for all devices :
44 1057MB 3137MB 2080MB ext2 system msftdata
45 3137MB 3339MB 201MB ext4 cust msftdata
46 3339MB 3372MB 33.6MB ext4 version msftdata
47 3372MB 4010MB 638MB ext2 vendor msftdata
48 4010MB 4211MB 201MB ext4 product msftdata
49 4211MB 15.8GB 11.5GB userdata msftdata
Click to expand...
Click to collapse
- if line 44 is not identical to this one here, please stop the process by writing quit and enter, I'm waiting for a private message with what is written on line 44 in the case of your device so that I can guide you correctly .
- assuming that all devices have the same system partition ( the same 44 line ) - approximately 2GB, we go to the next steps:
- access the Mount menu in TWRP and uncheck Data, and follow the steps below step by step :
(parted) rm 49
(parted) rm 48
(parted) rm 47
(parted) rm 46
(parted) rm 45
(parted) rm 44
(parted) mkpart system ext2 1057 5319
(parted) name 44 system
(parted) set 44 msftdata on
(parted) mkpart cust ext4 5319 5521
(parted) name 45 cust
(parted) set 45 msftdata on
(parted) mkpart version ext4 5521 5554
(parted) name 46 version
(parted) set 46 msftdata on
(parted) mkpart vendor ext2 5554 6192
(parted) name 47 vendor
(parted) set 47 msftdata on
(parted) mkpart product ext4 6192 6393
(parted) name 48 product
(parted) set 48 msftdata on
- for devices with 16GB :
(parted) mkpart userdata 6393 15.8GB
- for devices with 32GB :
(parted) mkpart userdata 6393 31.3GB
- for devices with 64GB :
(parted) mkpart userdata 6393 62.5GB
(parted) name 49 userdata
(parted) set 49 msftdata on
(parted) quit
Step II : activating partitions for reuse :
# mkfs.ext4 /dev/block/mmcblk0p44
# mkfs.ext4 /dev/block/mmcblk0p45
# mkfs.ext4 /dev/block/mmcblk0p46
# mkfs.ext4 /dev/block/mmcblk0p47
# mkfs.ext4 /dev/block/mmcblk0p48
# 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
- copy the new updated of LOS 17.1 with system partition of 4GB into your device
- copy any GApps arm64 Android 10 to your device
- Install them like always, enjoy !
Reboot to System in order to enjoy your Android 10 with almost any version of GApps !
Step III: flash back product image to fix sound issues !
- download product.img md5: 848880f9b74686394b0b4667620b5682
- go to TWRP and copy product.img on your internal memory
- flash product image to product partition :
> adb shell
# dd if=/sdcard/product.img of=/dev/block/bootdevice/by-name/product
393216+0 records in
393216+0 records out
201326592 bytes (192 M) copied, 10.460969 s, 18 M/s
# reboot
Click to expand...
Click to collapse
That's all !

Del.

Hey @surdu_petru, thank you for outlining the steps because I wanted to upgrade to the recent version.
I followed along until rebooting from TWRP into TWRP:
- reboot device from TWRP to TWRP in order to use data again after formated !
Click to expand...
Click to collapse
However, at that point I cannot make it into TWRP anymore. Upon booting the phone only makes it into FASTBOOT&RESCUE MODE and an error is shown "reboot_enter_fastboot_common_func". The phone does not respond to any fastboot commands from PC at this point and I seem to be stuck. Not sure what went wrong here. Do you maybe have an idea what went wrong for me and I can get into TWRP? On the screen it says "PHONE Unlocked" and "FRP Locked". Before I was using your latest build from before May. Thanks a lot.
Edit: Never mind. I got it to boot into TWRP eventually. Not sure why it did not work initially. After being able to boot into TWRP I was able to follow through and now got the latest build installed and it solved my issue with F-Droid and subtracks.
Thanks for keeping this old phone alive, which my daughter can now use to listen to audiobooks.

alterschalter said:
Hey @surdu_petru, thank you for outlining the steps because I wanted to upgrade to the recent version.
I followed along until rebooting from TWRP into TWRP:
However, at that point I cannot make it into TWRP anymore. Upon booting the phone only makes it into FASTBOOT&RESCUE MODE and an error is shown "reboot_enter_fastboot_common_func". The phone does not respond to any fastboot commands from PC at this point and I seem to be stuck. Not sure what went wrong here. Do you maybe have an idea what went wrong for me and I can get into TWRP? On the screen it says "PHONE Unlocked" and "FRP Locked". Before I was using your latest build from before May. Thanks a lot.
Click to expand...
Click to collapse
I don't know exactly what you did wrong ... and my device has reached this state but I managed to start it in TWRP recovery! Since the device is in fastboot mode, hold down the power button until the device turns off, and at this point press and hold the plus volume key until TWRP recovery enters!
EDIT :
If you have FRP Locked, than you can't use fastboot comands ... try to enter into TWRP in order to recover your device !

Eventually I was able to boot into TWRP and could follow through. Thanks for the detailed description of all steps. Finally I can use the old phone with Android 10. Thanks a lot.

alterschalter said:
Eventually I was able to boot into TWRP and could follow through. Thanks for the detailed description of all steps. Finally I can use the old phone with Android 10. Thanks a lot.
Click to expand...
Click to collapse
I'm glad to hear you made it !

ciao vorrei espandere la partizione di sistema ma con adb non va che si fa per andare in recovery ma poi faccio adb push ma mi da errore non so come mi aiuti a farove? o se c'è un file zip più semplice aspetto una risposta grazie

hello I would like to expand the system partition but with adb it does not go that is I do to go to recovery but then I do adb push but it gives me an error I do not know how to do you help me to farove? or if there is a simpler zip file I wait for an answer thanks

Olliblacklist said:
hello I would like to expand the system partition but with adb it does not go that is I do to go to recovery but then I do adb push but it gives me an error I do not know how to do you help me to farove? or if there is a simpler zip file I wait for an answer thanks
Click to expand...
Click to collapse
No, there is no simple zip for install via TWRP, you should try to fix your issues by installing correct drivers and adb, fastboot commands on your desktop !

surdu_petru said:
No, there is no simple zip for install via TWRP, you should try to fix your issues by installing correct drivers and adb, fastboot commands on your desktop !
Click to expand...
Click to collapse
okay i try to install the drivers and i hope to succeed but the guide you posted can also be good for huawei p9?

Olliblacklist said:
okay i try to install the drivers and i hope to succeed but the guide you posted can also be good for huawei p9?
Click to expand...
Click to collapse
Yes, but you need to adjust it accordingly ...

surdu_petru said:
Yes, but you need to adjust it accordingly ...
Click to expand...
Click to collapse
in what way ? that is, isn't it the same as driving?

Olliblacklist said:
in what way ? that is, isn't it the same as driving?
Click to expand...
Click to collapse
ok so you are telling me the guide is not the same for the p9

Olliblacklist said:
in what way ? that is, isn't it the same as driving?
Click to expand...
Click to collapse
No, P9 it's not the same device like P9 Lite, it may have a different partition structure and also other sizes ...

Olliblacklist said:
ok so you are telling me the guide is not the same for the p9
Click to expand...
Click to collapse
Yes, this guide it's ONLY for P9 Lite , but it can be adjusted on almost any device if you know how to change it accordingly ... if not, better stay away - you can damage the device very quickly !

surdu_petru said:
No, P9 it's not the same device like P9 Lite, it may have a different partition structure and also other sizes ...
Click to expand...
Click to collapse
I understand sin I can not do it I thought that with the guide you posted I could do it

surdu_petru said:
> adb push tmp data/local
Click to expand...
Click to collapse
When I run that, I get an error, which is this one: (Using Huawei P9 Lite VNS-L31)
failed to copy 'tmp/parted' to 'data/local/parted': secure_mkdirs failed: No such file or directory
Could you please help me?
Thanks.
Here's the screenshot.
{
"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"
}

EndemicRocket said:
When I run that, I get an error, which is this one: (Using Huawei P9 Lite VNS-L31)
failed to copy 'tmp/parted' to 'data/local/parted': secure_mkdirs failed: No such file or directory
Could you please help me?
Thanks.
Here's the screenshot.
View attachment 5622609
Click to expand...
Click to collapse
What is the output of this command :
> adb shell ls -l data/local
Click to expand...
Click to collapse

surdu_petru said:
What is the output of this command :
Click to expand...
Click to collapse
ls: data/local: No such file or directory
By the way, I'm on TWRP Recovery (3.2.3-10).

EndemicRocket said:
ls: data/local: No such file or directory
By the way, I'm on TWRP Recovery (3.2.3-10).
Click to expand...
Click to collapse
Please check LOS 17.1 thread, it's state clearly what TWRP you should have on your device !
EDIT:
> adb shell ls -l data/local should return tmp, try to solve your issues !

Related

[TUTORIAL]How to unbrick your N4

How to unbrick your N4 ​I'm not responsible for anything that happens with your device!
I accidently flashed a S4 ROM.
After I noticed that, I tried to flash a factory image, but it booted for a very long time and WiFi, signal and other radio stuff didn't work.
Then I searched for help here, but anything they suggested didn't work, so you might be thinking that the only solution would be to send the device for repair.
But I searched for a solution anyway and found it
So this is what you need to download:
Nexus 4 Unbrick.zip
For Nexus 4 16GB you also need to download this files:
Nexus 4 Unbrick 16 GB Files.zip
OK let's start:
First thing we need to do is extracting everything and installing the LGNPST (this is for Windows 8, but I don't see why it shouldn't work on other versions).
Open your extracted Nexus 4 files folder
Open the LGNPST folder
Install "LGUnitedMobileDriver_S4981MAN38AP22_ML_WHQL_Ver_3.8.1.exe", it's located under "LG_USB_Driver"
Install "LGNPSTv1.3_Lab_Verison_RightClickReg.exe", located in root of the folder
Install "LGNPST_GenericModels_Ver_5_0_12_0", located under "NPST Generic Components and Models"
Install "LGNPST_Components_Ver_5_0_20_0", also located under "NPST Generic Components and Models"
Copy the Models folder to C:\LG Electronics\LGNPST\
Start a command prompt as admin
Type: regsvr32 "C:\LG Electronics\LGNPST\Models\LGNPST_LS970.dll" (yes, I know this is a .dll for the Optimus G)
That's it
If you got no ADB or fastboot drivers installed, install the Universal ADB Driver.
Now start the LGNPST and get your N4 into download mode:
Turn the phone off.
Make sure the phone is off.
Plug a USB cable into your PC, AND ONLY INTO YOUR PC. THE PHONE PART COMES NEXT.
Hold down the volume up and down buttons for 2 (two) seconds on your Nexus, and continue to hold the volume up and down buttons while pluging in the USB cable which is connected to your PC. Continue to hold the buttons until the download mode screen appears. Now step five.
Once the download mode screen comes up, let go of the volume buttons.
Thanks to @Connor Baker for sharing this method
Now you should get a screen like this:
{
"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"
}
Now your LGNPST should look like this:
In the bottom center you see DLL and BIN File.
Click on the folder symbol and select LGNPST_LS970.dll (and again, yes, I know it's for Optimus G, trust me I know what I'm doing)
Then select the .bin file you extracted before.
Now click start and it'll flash it.
Your N4 will reboot automatically, but the LGNPST reached only 85%, thats's normal (but please wait until the 67% changed to 85% before you close it)
The LGNPST will say you, that you should reboot again to download mode to finish the process, but the only thing it does is giving you an error message.
So now you have a developer firmware on your device and it's encrypted so you can do nothing.
Reboot into bootloader with Vol - and power button.
Now start flash_all.bat in the flashfactory folder and the program will do the things by itself.
Now you are completely on stock and should have a fully working device
Next steps for Nexus 4 16GB:
First thing I need to say: No, this doesn't work!
First step is rooting your phone (search through XDA if you don't know how; thanks to Rockstar600 for remembering me)
Copy the files you downloaded for the 16GB Version on your Nexus 4 (without the CWM Image).
If "dd" got renamed to "dd.bin" rename it back to "dd".
Install Root Browser or an similar app and copy the files to your /system directory.
Then flash the CWM Recory Image.
To do that open the folder that contains the Factory Image flashable with fastboot and do CTRL+Right Click in that folder and select "Open Command Prompt here" or something like that (don't know the exact name).
Get your device into fastboot mode with Vol- and Power.
Now type:
Code:
fastboot flash recovery recovery-clockwork-touch-6.0.4.7-mako.img
Then reboot into recovery.
I think you leaved CMD open.
So now type:
Code:
adb shell
mount /system
cp /system/dd /
chmod 755 /dd
/dd if=/dev/block/mmcblk0 of=/system/pgpt8G.img bs=512 count=34
/dd if=/dev/block/mmcblk0 of=/system/sgpt8G.img bs=512 skip=30777311
umount /data
umount /cache
umount /system
df -h
Now the output should look like this:
Code:
# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 911.7M 48.0K 911.6M 0% /dev
There shouldn't be a extra line.
If there is no extra line then continue with:
Code:
mount /system
/dd if=/dev/block/mmcblk0 of=/system/DDR bs=512 skip=15267840 count=2015
/dd if=/system/DDR of=/dev/block/mmcblk0 bs=512 seek=30775296 conv=notrunc
/dd if=/system/sgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
/dd if=/system/pgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
parted /dev/block/mmcblk0
Then type p and press enter and the output should look like this:
Code:
# parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext4 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 15.8GB 14.1GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
Notice that userdata partition is 14.1GB in size
In case parted reports an error I suggest to return back to the old 8G partition tables, see below.
You can close parted with simply typing quit.
Now reboot the phone into bootloader: type reboot and hold 'Up' button to enter bootloader menu.
Then type:
Code:
fastboot erase userdata
fastboot -w
Now again start the flash-all.bat in your folder.
Now you have your 16GB back
Return back to the old 8G partition tables:
In case parted reported an error, put the old 8G partition tables back. This should not happen but never say never:
Code:
/dd if=/system/sgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
/dd if=/system/pgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
Fix for Bluetooth and MAC adress:
For bluetooth:
- In /persist directory create bluetooth directory. Under the new directory create a file named .bdaddr (don't miss the dot!)
Edit the file and put 6 random characters in it. Even better, if you can do this in a hex editor and put 6 random bytes, not just printable characters.
- Set execute and read permissions for everybody on /persist/bluetooth directory and change owner of .bdaddr to bluetooth:bluetooth and permission to 660 (read/write for owner and group and nothing else). In command line:
Code:
chown root:root /persist/bluetooth
chmod 755 /persist/bluetooth
chown bluetooth:bluetooth /persist/bluetooth/.bdaddr
chmod 660 /persist/bluetooth/.bdaddr
For mac address:
- In /persist directory create wifi directory. In the new directory create a file named .macaddr (don't miss the dot!)
Edit the file and put 12 random hex numbers in it (0-9, A-F), save.
- Set execute and read permissions for everybody on /persist/wifi directory and change owner of .macaddr to wifi:wifi and permission to 660 (read/write for owner and group and nothing else). In command line:
Code:
chown root:root /persist/wifi
chmod 755 /persist/wifi
chown wifi:wifi /persist/wifi/.macaddr
chmod 660 /persist/wifi/.macaddr
- run /system/bin/conn_init program. Can be run in root explorer(choose Linux Script Handler when you open it), or in adb shell:
Code:
su
/system/bin/conn_init
Then reboot and check if the changes got applied in settings
Donate
Every $ helps me : Donate
Credits
Koush for his ADB Driver
Jhoopes517 for his tutorial to install LGNPST
FLYN's thread about unbricking a Nexus 4, because I got the parts for LGNPST from there
foil for his .tot files
Jbele for his picture from download mode xD
Google for the factory images
dvhexer for his guide to convert 8GB to 16GB
OK there's a problem: After using this method you get only 8GB and it seems like there's no fix for that
Does somebody know a solution?
PS: Yes, already tried that: http://forum.xda-developers.com/showthread.php?p=36673191#post36673191
Have you tried formatting data, not wipe, in recovery?
Try this: http://forum.xda-developers.com/showthread.php?t=2033692
meangreenie said:
Have you tried formatting data, not wipe, in recovery?
Click to expand...
Click to collapse
Yes.
RussianBear said:
Try this: http://forum.xda-developers.com/showthread.php?t=2033692
Click to expand...
Click to collapse
Mentioned it above, but forgot to remove postcount behind showthread, sry
nice!!
I know someone who can use this:
http://forum.xda-developers.com/showthread.php?t=2175663
I think I found a fix for the 8GB problem
But it needs a external sd so I need to make some changes
EDIT: Got it, I'll add this to the guide now
thanks !!!!!!!!!!!!!!!!!
I am from china.
i flash the 4.3 for s4.
and i know 2 person have the same problem like me in our forum.
SO happy i encounter the god-like person--you!
thanks a lot.
And i will quote your ways to save them, are you mind this?
tigerCHINA said:
I am from china.
i flash the 4.3 for s4.
and i know 2 person have the same problem like me in our forum.
SO happy i encounter the god-like person--you!
thanks a lot.
And i will quote your ways to save them, are you mind this?
Click to expand...
Click to collapse
Why on earth would you flash anything for the S4? I'm curious
Updated OP with Instructions to get your 16 GB back
tigerCHINA said:
I am from china.
i flash the 4.3 for s4.
and i know 2 person have the same problem like me in our forum.
SO happy i encounter the god-like person--you!
thanks a lot.
And i will quote your ways to save them, are you mind this?
Click to expand...
Click to collapse
No problem, it's there to help everyone
KiNG OMaR said:
Why on earth would you flash anything for the S4? I'm curious
Click to expand...
Click to collapse
Everyone does start as a beginner, one and a half year ago I thought there are universal ICS flashable zips (look here xD) , now look where I got
I wanna try 4.3 but i dont know i will fail
KiNG OMaR said:
Why on earth would you flash anything for the S4? I'm curious
Click to expand...
Click to collapse
I wanna try 4.3 but i dont know i will fail
Hi, thanks for your help. I have a Nexus 4 bricked, when a friend tried to flash Nexus 7 kernel. The phone is dead and have only a red blinking led. When i connect the nexus to my Windows 8, i see a DXUSB_ERROR (or something similar, i don't have now the phone). Do you think it will work your method?
Thanks
Regards
EDIT: I have no fastboot or download mode
cicciociccio333 said:
Hi, thanks for your help. I have a Nexus 4 bricked, when a friend tried to flash Nexus 7 kernel. The phone is dead and have only a red blinking led. When i connect the nexus to my Windows 8, i see a DXUSB_ERROR (or something similar, i don't have now the phone). Do you think it will work your method?
Thanks
Regards
EDIT: I have no fastboot or download mode
Click to expand...
Click to collapse
Hmmm....don't know, can you get into a download mode?
Give it a try, seems like you can't brick even more
Oh, didn't saw that edit.
No, without download mode you can't use this
Gigadroid said:
Oh, didn't saw that edit.
No, without download mode you can't use this
Click to expand...
Click to collapse
So i tought. That's a pity :'(
thanks for the guide! as i said you're my hero!! but i cant do the 16gb part. i think im doing something wrong first, i write the lines one by one right? second, when i type: cp /system/dd /
it says that cannot find the file, something like that. i have move the 3 files to /system of course. and no the dd file didnt renamed to dd.bin, i check it. can you help??
@OP,
Thanks a ton bro!!
johnxarma said:
thanks for the guide! as i said you're my hero!! but i cant do the 16gb part. i think im doing something wrong first, i write the lines one by one right? second, when i type: cp /system/dd /
it says that cannot find the file, something like that. i have move the 3 files to /system of course. and no the dd file didnt renamed to dd.bin, i check it. can you help??
Click to expand...
Click to collapse
Ignore, I was incorrect.
meangreenie said:
Lose the last space, it's a typo I believe. dd/ or just dd
Click to expand...
Click to collapse
thanks for the reply. but i dont understand you.. what part i must change to correct the code?
 @Gigadroid can you fix the typos in OP??
johnxarma said:
thanks for the guide! as i said you're my hero!! but i cant do the 16gb part. i think im doing something wrong first, i write the lines one by one right? second, when i type: cp /system/dd /
it says that cannot find the file, something like that. i have move the 3 files to /system of course. and no the dd file didnt renamed to dd.bin, i check it. can you help??
Click to expand...
Click to collapse
Yes, one by one.
Try to mount system partition, simply type:
Code:
mount /system
I'll add this to op
meangreenie said:
Lose the last space, it's a typo I believe. dd/ or just dd
Click to expand...
Click to collapse
It isn't a typo.
cp stands for copy, the first path says which file will be copied, the second path where it will be copied.
In this case we want the files in our root directory which is /
its very useful THX:good::good:

[wt88047] Redmi 2 -Resize system partition

Here is a guide to resize and repartition your redmi 2 emmc
Download and uncompress the attached View attachment parted.zip file
Download attached View attachment persist.img
Download latest twrp
Reeboot to bootloader(fastboot) and flash latest twrp
Code:
fastboot flash recovery twrp-3.1.1-0-wt88047.img
boot to the new twrp
Code:
fastboot boot twrp-3.1.1-0-wt88047.img
Copy the "parted" binary into your sdcard.
Use your file manager make new directory parted in sd card aand copy parted executable there.
now connect with adb:
Code:
adb shell
Change directory to external_sd/parted/ (where we copied the parted binary)
Code:
cd external_sd/parted/
Give permission to execute:
Code:
chmod +x parted
Use blkid to list out devices. My emmc is listed as
"/dev/block/mmcblk0" it should be same on all other devices too, its ok even if it is different
Code:
blkid
View attachment 4162723
now use parted command
Code:
./parted /dev/block/mmcblk0
Use option
Code:
p
to printout partition table
View attachment 4162725
we need to remove all partitions starting from 23 and recreate them. But when we recreate , everything except system and userdata should have the exact same number of sectors that they had before otherwise it wont boot.
use
Code:
u
to change units type in when it asks the unit
Code:
s
(for sectors)
here are the dfault sector sizes.... they should be same when we recreate them
24 655360s cache
25 6553 persist
26 65536s recovery
27 1024s keystore
28 64s config
29 131072s oem
View attachment 4162728
now remove all partitions upto system .
unmount /system and /data and /cache from twrp mounts menu before proceeding
Code:
rm 30
rm 29
rm 28
rm 27
rm 26
rm 25
rm 24
rm 23
View attachment 4162729
now we need to recreate partition table , first is system
syntax:
mkpart system ext4 [start sector] [end sector]
start sector is the end sector of the previous partition +1
for me its :
461919s+1s=461920s
each sector is 512B so calculate how many sectors you want.
for me resizing system to 1.2GB
1.2GB*1024*1024*1024=1288490188.8bytes
1288490188.8bytes/512bytes=2516582.4sectors
round it up 2516583s
end sector= required number of sectors +start sector -1s
=2516583s+461920s -1s =2978503s -1s
so my command is :
Code:
mkpart system 461920s 2978502s
due to bug in this parted name of partition was not set....
set it manually:
Code:
name 23 system
now create cache partion:
use p (print partition table) to find out start sectors
end sector=start sector+655360s -1s (refer table i posted, or your default partition table)
=2978503s+655360s-1s=3633862s
use:
Code:
mkpart cache 2978503s 3633862s
rename partition:
Code:
name 24 cache
similar way create persist:
end sector=start sector + 65536s -1s
Code:
mkpart persist 3633863s 3699398s
name persist:
Code:
name 25 persist
create recovery:
end sector=start sector + 65536s -1s
Code:
mkpart recovery 3699399s 3764934s
Code:
name 26 recovery
create partition keystore :
end sector=start sector + 1024s -1s
Code:
mkpart keystore 3764935s 3765958s
Code:
name 27 keystore
create partition config:
end sector=start sector + 64s -1s
Code:
mkpart config 3765959s 3766022s
Code:
name 28 config
create partition oem :
end sector =startsector + 131072s -1s
Code:
mkpart oem 3766023s 3897094s
Code:
name 29 oem
now create the last partition userdata ... userdata will shrink by as much as you increased in your system:
Code:
mkpart userdata 3897095s 100%
Code:
name 30 userdata
exit parted by typing
Code:
q
format the partitions /system(23) /cache(24) /persist(25) /userdata(30) :
Code:
make_ext4fs /dev/block/mmcblk0p23
make_ext4fs /dev/block/mmcblk0p24
make_ext4fs /dev/block/mmcblk0p25
make_ext4fs /dev/block/mmcblk0p30
run parted again and use p ,your partition table should look similar to this:
Code:
./parted /dev/block/mmcblk0
Use option
Code:
p
to printout partition table
View attachment 4162739
exit parted by typing
Code:
q
use command:
Code:
reboot bootloader
to boot into bootloader/fastboot
flash recovery:
Code:
fastboot flash recovery twrp-3.1.1-0-wt88047.img
flash persist:
Code:
fastboot flash persist persist.img
booot to recovery and reboot recovery:
Code:
fastboot boot twrp-3.1.1-0-wt88047.img
now you can flash any custom rom
please remember that some custom roms have a fixed system size and therefore you will have to resize the partition after installing rom from the twrp wipe menu/repair partition menu
Download links:
twrp: https://dl.twrp.me/wt88047/
parted: see attachment
persist: see attachment
Hope this helps
To revert to stock partition table :
download attachment extract and flash via fastboot:
View attachment gpt_both0.zip
Code:
fastboot flash partition gpt_both0.bin
@OP, how to revert back to default system partition? Via fastboot rom or ...? Thank you for providing the method bro!
Dyt199412syam said:
@OP, how to revert back to default system partition? Via fastboot rom or ...? Thank you for providing the method bro!
Click to expand...
Click to collapse
i have updated the post to include reverting instructions....
yes flashing the full fastboot stock rom will revert your partition table to default.
resize system partition to 1,5gb using fastboot, run partition.bat
download
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
can you explain how to make that partition.img file..... i am guessing its like "gpt_both0.bin"
jsidney96 said:
can you explain how to make that partition.img file..... i am guessing its like "gpt_both0.bin"
Click to expand...
Click to collapse
yes, but im using hex editor with some crc cheksum
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Will this work on the 8gb model? I mean, is not too big for it?, if it is, can you make a smaller version for 8gb devices?
Thanks
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Do i need to reinstall rom after i did system repartition used this method bro?
TecnoTailsPlays said:
Will this work on the 8gb model? I mean, is not too big for it?, if it is, can you make a smaller version for 8gb devices?
Thanks
Click to expand...
Click to collapse
yes, but i think 1.5gb is small for 64bit rom
Dyt199412syam said:
Do i need to reinstall rom after i did system repartition used this method bro?
Click to expand...
Click to collapse
sure, and all your data will be lost
inunxelex said:
resize system partition to 1,5gb using fastboot, run partition.bat
download
Click to expand...
Click to collapse
Can you give more details. i.e the fastboot command. Sorry for noob question and bad english.
hey can you make a bash script for linux users??
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)
This is the result:
Code:
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
Click to expand...
Click to collapse
Code:
~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: MMC HAG2e (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 67.1MB 134MB 67.1MB fat16 modem
2 134MB 135MB 524kB sbl1
3 135MB 135MB 524kB sbl1bak
4 135MB 136MB 1049kB aboot
5 136MB 137MB 1049kB abootbak
6 137MB 138MB 524kB rpm
7 138MB 138MB 524kB rpmbak
8 138MB 139MB 524kB tz
9 139MB 139MB 524kB tzbak
10 139MB 140MB 524kB hyp
11 140MB 141MB 524kB hypbak
12 141MB 142MB 1049kB pad
13 142MB 143MB 1573kB modemst1
14 143MB 145MB 1573kB modemst2
15 145MB 146MB 1049kB misc
16 146MB 146MB 1024B fsc
17 146MB 146MB 8192B ssd
18 146MB 156MB 10.5MB splash
19 201MB 201MB 32.8kB DDR
20 201MB 203MB 1573kB fsg
21 203MB 203MB 16.4kB sec
22 203MB 237MB 33.6MB boot
23 237MB 1310MB 1074MB system
24 1310MB 1646MB 336MB cache
25 1646MB 1679MB 33.6MB ext4 persist
26 1679MB 1713MB 33.6MB recovery
27 1745MB 1745MB 524kB keystore
28 1745MB 1745MB 32.8kB config
29 1745MB 1812MB 67.1MB oem
30 1879MB 15.8GB 13.9GB userdata
Click to expand...
Click to collapse
Code:
(parted) rm 30
rm 30
(parted) rm 29
rm 29
(parted) rm 28
rm 28
(parted) rm 27
rm 27
(parted) rm 26
rm 26
(parted) rm 25
rm 25
(parted) rm 24
rm 24
(parted) rm 23
rm 23
(parted) mkpart system 461920s 2978502s
mkpart system 461920s 2978502s
Warning: You requested a partition from 461920s to 2978502s.
The closest location we can manage is 3345504s to 3345504s.
Is this still acceptable to you?
Yes/No? Yes
Click to expand...
Click to collapse
I think that rm 30, ... rm 23 dose not delete de partitions
Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]
(parted) name 26 recovery
[email protected] ~/Descargas/Redmi 2 $ adb shell
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
~ # mount -a
mount: mounting /dev/block/mmcblk0p23 on /system failed: Invalid argument
mount: mounting /dev/block/mmcblk0p30 on /data failed: Invalid argument
mount: mounting /dev/block/mmcblk0p24 on /cache failed: Invalid argument
mount: mounting /dev/block/mmcblk0p25 on /persist failed: Invalid argument
mount: mounting /usb_otg on auto failed: No such file or directory
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
/dev/block/mmcblk0p1 64.0M 44.6M 19.4M 70% /firmware
~ # umount /firmware/
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
Click to expand...
Click to collapse
Do you think how can I format the disk and regenerate partitions to install a new rom?
Best regards, Julio.
Back to default
I execute the 1.5gb system partition file on post, and work... after i flash custom rom based lineage os, my system partition is back to default, how to fix it ? i repair via wipe menu partition it doesn't work...
help,
or what rom support custom partition ??
jriosa said:
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)
This is the result:
Code:
~ # blkid
Code:
~ # parted /dev/block/mmcblk0
Code:
(parted) rm 30
rm 30
(parted) rm 29
rm 29
(parted) rm 28
rm 28
(parted) rm 27
rm 27
(parted) rm 26
rm 26
(parted) rm 25
rm 25
(parted) rm 24
rm 24
(parted) rm 23
rm 23
I think that rm 30, ... rm 23 dose not delete de partitions
Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]
(parted) name 26 recovery
Do you think how can I format the disk and regenerate partitions to install a new rom?
Best regards, Julio.
Click to expand...
Click to collapse
I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom
jsidney96 said:
I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom
Click to expand...
Click to collapse
Hello, thanks for your help.
I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result
target reported max download size of 268435456 bytes
sending 'partition' (33 KB)...
OKAY [ 0.005s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.027s
Click to expand...
Click to collapse
I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.
I do not know how can I unlock the internal disk and format the disk and install a new operating system.
Best regards.
Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:
A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard
But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.
Hi, I am in the same situation as @jriosa, with a redmi 2. Moreover, when using parted, having rooted and given permissions, the commands
Code:
rm <partition_number>
even though they don't throw any error, don't remove the targeted partitions.
Is there anything we could do to unbrick our phones? Any help will be really appreciated. Thanks!
jriosa said:
Hello, thanks for your help.
I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result
I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.
I do not know how can I unlock the internal disk and format the disk and install a new operating system.
Best regards.
Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:
A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard
But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.
Click to expand...
Click to collapse
I dont have a solution for this problem, i dont have a wt86047
reserved
My Redmi 2 sdcard and otg not working can it done by only internal storage.
I have tried and from 23 to 29 I have removed but 30 userdata is not removing giving error that first unmount it, when I will unmount it then parted directory will not be accessible.
What to do is there any way without ext sdcard or otg.
Pls help.
I used the "fastboot flash partition gpt_both0.bin" code and mi phone got black screen without recovery or fastbtoot boot...just black screen. What can I do?
This is the Console log:
fastboot flash partition gpt_both0.bin
Sending 'partition' (33 KB) OKAY [ 0.011s]
Writing 'partition' OKAY [ 0.046s]
Finished. Total time: 0.061s

Data partition can’t format

I have a Chinese version of k20 pro, and a friend gave it to me because it could not be repaired. Bootloader has been unlocked and can enter fastboot and twrp recovery at present. But recovery shows
"primary block device ‘/dev/block/bootdevice/by-name/userdata’ for mount point ‘/data’ is not present!
Failed to mount ‘/data’(invalid argument)”
I tried format data and change file system in twrp, but it didn't work. I also tried fastboot flash userdata, and he displayed
"failed (remoteartition not found).
I also downloaded the official system and used fastboot to execute "flash_all.sh". Halfway through the execution, it displayed
"error:cannot load'./images/ system.img' :value too large for defined data type. flash system error”
Is there a way to solve it? I'm not in China, so I can't send it back to official repairs.
(I don’t have a windows pc to use it now) The previous fastboot operation was done using raspberry pi 4
xperiazu21 said:
I have a Chinese version of k20 pro, and a friend gave it to me because it could not be repaired. Bootloader has been unlocked and can enter fastboot and twrp recovery at present. But recovery shows
"primary block device ‘/dev/block/bootdevice/by-name/userdata’ for mount point ‘/data’ is not present!
Failed to mount ‘/data’(invalid argument)”
I tried format data and change file system in twrp, but it didn't work. I also tried fastboot flash userdata, and he displayed
"failed (remoteartition not found).
I also downloaded the official system and used fastboot to execute "flash_all.sh". Halfway through the execution, it displayed
"error:cannot load'./images/ system.img' :value too large for defined data type. flash system error”
Is there a way to solve it? I'm not in China, so I can't send it back to official repairs?.
(I don’t have a windows pc to use it now) The previous fastboot operation was done using raspberry pi 4?
Click to expand...
Click to collapse
what happens if
Fastboot erase userdata
[email protected] said:
what happens if
Fastboot erase userdata
Click to expand...
Click to collapse
Thanks in advance for your reply! After I tried it, he showed
"failed(remote: check device console.).“
If I erase other partitions, such as cache, it can be finished.
I also tried to extract userdata.img to flash from the official fastboot. Use fastboot flash userdata userdata.img, it displays
"failed(remote;partition not found)"
Try flashing from mi flash tool... From an windows pc. Do not choose lock option.
---------- Post added at 07:25 PM ---------- Previous post was at 06:55 PM ----------
Try this also
The data partition is sda31 for this device so
Go to recovery.. Terminal... Type Belo command
mke2fs -T ext4 /dev/block/sda31
tune2fs –L userdata /dev/sda31
Then reboot
Flash a fastboot image... System etc
If fastboot failed to flash system.img take the image to sdcard install image from recovery.
Tell me what happens.
[email protected] said:
Try flashing from mi flash tool... From an windows pc. Do not choose lock option.
---------- Post added at 07:25 PM ---------- Previous post was at 06:55 PM ----------
Try this also
The data partition is sda31 for this device so
Go to recovery.. Terminal... Type Belo command
mke2fs -T ext4 /dev/block/sda31
tune2fs –L userdata /dev/sda31
Then reboot
Flash a fastboot image... System etc
If fastboot failed to flash system.img take the image to sdcard install image from recovery.
Tell me what happens.
Click to expand...
Click to collapse
I will find windows pc to try miflash during the holiday!
I tried the command in the terminal, it showed
"the file /dev/block/sda31 does not exist and no size was specified".
I changed the recovery to orange fix, and used the file browser to view /dev/block, but I didn't see sda31:crying:
Show me the output of below command in orange fox terminal
fdisk -l
And also
fdisk /dev/sda
p
[email protected] said:
Show me the output of below command in orange fox terminal
fdisk -l
And also
fdisk /dev/sda
p
Click to expand...
Click to collapse
I tried the fdisk -l and fdisk /dev/sda commands, and the message in the picture was displayed.
{
"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"
}
(Sorry I can't save the screenshot to the usb device)
-------Update-------
I tried to replace the recovery with wzsx150's twrp
and execute command “parted /dev/block/sda”
The GPT table seems to be damaged, can it be repaired?
Y.. After the last ss inside parted..
Type p enter
Show me the ss..
You have to recreate partition table tru parted
[email protected] said:
Y.. After the last ss inside parted..
Type p enter
Show me the ss..
You have to recreate partition table tru parted
Click to expand...
Click to collapse
I'm sorry for my bad English:crying:
I don't know what you mean very much, what should I do now?
Parted /dev/block/sda
Inside parted cmd prompt type
(parted) print
Show me the screen shot
Use orange fox latest recovery... F disk will work there
[email protected] said:
Show me the output of below command in orange fox terminal
fdisk -l
And also
fdisk /dev/sda
p
Click to expand...
Click to collapse
[email protected] said:
Parted /dev/block/sda
Inside parted cmd prompt type
(parted) print
Show me the screen shot
Use orange fox latest recovery... F disk will work there
Click to expand...
Click to collapse
Thank you for your detailed explanation!
I downloaded the latest version of orange fix recovery and executed parted command. The message is still the same as before.
Use fdisk in latest orange fox.
Check details first. Get partition table
[email protected] said:
Use fdisk in latest orange fox.
Check details first. Get partition table
Click to expand...
Click to collapse
I typed "fdisk /dev/block/sda”, and then typed “p” in the command, showing all the partitions.
The end sector of the userdata partition seems to be a problem?
Ok... See partition no 31 which is data partition has start and end address wrong. Thats the issue.
Just re create this partition... It will start working then.
Type fdisk /dev/sda
Type d to proceed to delete a partition
Type 31 to select the 31st partition and press enter
This will delete data partition.
Then create it
[email protected] said:
Ok... See partition no 31 which is data partition has start and end address wrong. Thats the issue.
Just re create this partition... It will start working then.
Type fdisk /dev/sda
Type d to proceed to delete a partition
Type 31 to select the 31st partition and press enter
This will delete data partition.
Then create it
Click to expand...
Click to collapse
I cannot use the /dev/sda path, I can only use the /dev/block/sda path
How should I delete partition 31? It has only 4 actions and no delete option
My mistake...
/dev/block/sda
This guide will help u
https://tldp.org/HOWTO/Partition/fdisk_partitioning.html
Btw hw r u taking screen shot of orange fox?
/ $ su
:/ # busybox fdisk /dev/block/sda
Note: sector size is 4096 (not 512)
Found valid GPT with protective MBR; using GPT
Command (m for help): p
Disk /dev/block/sda: 237158400 sectors, 704M
Logical sector size: 4096
Disk identifier (GUID): 6ca8833f-cde5-e7e6-50f2-77495c5b84a2
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 29644794
Number Start (sector) End (sector) Size Name
1 6 7 8192 switch
2 8 15 32768 ssd
3 16 23 32768 dbg
4 24 31 32768 bk01
5 32 63 128K bk02
6 64 127 256K bk03
7 128 255 512K bk04
8 256 383 512K keystore
9 384 511 512K frp
10 512 1023 2048K bk05
11 1024 2047 4096K misc
12 2048 3071 4096K vm-data
13 3072 4095 4096K bk06
14 4096 6143 8192K logfs
15 6144 8191 8192K bk07
16 8192 12287 16.0M oops
17 12288 16383 16.0M devinfo
18 16384 20479 16.0M oem_misc1
19 20480 24575 16.0M metadata
20 24576 32603 31.3M bk08
21 32604 40959 32.6M splash
22 40960 49151 32.0M bk09
23 49152 65535 64.0M persist
24 65536 81919 64.0M persistbak
25 81920 98303 64.0M logdump
26 98304 131071 128M minidump
27 131072 163839 128M rawdump
28 163840 180223 64.0M recovery
29 180224 245759 256M cache
30 245760 507903 1024M cust
31 507904 29644794 111G userdata
Command (m for help):
Given partition table for a correct device. Taken in my own device.
[email protected] said:
My mistake...
/dev/block/sda
This guide will help u
https://tldp.org/HOWTO/Partition/fdisk_partitioning.html
Btw hw r u taking screen shot of orange fox?
Click to expand...
Click to collapse
Use the volume down and power button, the photo will be stored in /tmp, copy the image to usb_otg.
Thank you very much, you saved this phone, I flashed it to miui eu rom, it works well!
In the end, I did not use fdisk to modify, but gdisk.
fdisk seems to be unable to perform too many operations on the gpt format. Using gdisk is similar to fdisk.
Thank you again, and google translate XD.
Now you help two person in future...
And then tell them to help two and so on recursively.
Also let me know gdisk binary details.. Where u got it...?
[email protected] said:
Now you help two person in future...
And then tell them to help two and so on recursively.
Also let me know gdisk binary details.. Where u got it...?
Click to expand...
Click to collapse
When I was searching for how to use fdisk to delete partitions, I found this discussion. There are partition tools like gdisk and fdisk available for download
https://forum.xda-developers.com/mi-9t/help/mi-9t-hard-brick-miui11-test-t3975347/page6/
i have bootloader unlocked but cant install fastboot rom via mi flash
i have k2o pro device
i have try to install fastboot rom manually but i got error coundnt read sparse file or now i stuck on erase boot
any help!!!!
bootloader unlock
cant it be a hardware promblem

[DEV][ Expand System Partition To 5GB - MediaPad M3 ]

Hello !
Here you will find the information needed to change the system partition from 2GB to 5GB - this operation is somewhat useful for installing any version of GApps on your device : Huawei MediaPad M3 8.4 Kirin version ( BTV-DL09; BTV-L0J; BTV-W09 )
Thanks to @accerian for his help, and you can also check out this tutorial for more information !
Download mkfs.ext4 and parted from here : https://forum.xda-developers.com/attachments/parted_gdisk_fdisk_mkfs-ext4-arm-zip.4494671/
Warning : the entire data partition will be deleted following this procedure, make sure you have backed up and saved it to a microsd card
Step I : extended system partition from about 2GB to 5GB ( example for a 32GB device, for 64GB devices the procedure is 99% similar, only one operation differs which will be specified at the appropriate time ) - also this example is for BTV-DL09 which is with LTE capabilities.
- extract "mkfs.ext4" and "parted" from previously download archive and put them into a new created tmp directory
- connect the device to the computer via the USB cable and bring the device into TWRP revovery with this command :
> adb reboot recovery
- copy the two executable files from the computer to the device :
> adb push tmp data/local
> adb shell
# cp -r data/local/tmp/mkfs.ext4 sbin/mkfs.ext4
# chmod 0777 sbin/mkfs.ext4
# cp -r data/local/tmp/parted sbin/parted
# chmod 0777 sbin/parted
- launch the "parted" function as follows :
# parted /dev/block/mmcblk0
- display all properties of all partitions : (I wrote what needs to be displayed as a command before pressing enter, so you just have to type "print" and press enter because (parted) is already displayed as promter ... be careful not to type (parted) twice in the following commands)
(parted) print
- go to line 43, which should be the same for all devices :
43 1174MB 3255MB 2080MB ext2 system msftdata
44 3255MB 3456MB 201MB ext4 cust msftdata
45 3456MB 3490MB 33.6MB ext4 version msftdata
46 3490MB 4127MB 638MB ext2 vendor msftdata
47 4127MB 4329MB 201MB ext4 product msftdata
48 4329MB 4333MB 4194kB hisitest2 msftdata
49 4333MB 31.3GB 26.9GB userdata msftdata
Click to expand...
Click to collapse
- if line 43 is not identical to this one here, please stop the process by writing quit and enter, I'm waiting for a private message with what is written on line 43 in the case of your device so that I can guide you correctly .
- assuming that all devices have the same system partition ( the same 43 line ) - approximately 2GB, we go to the next steps:
- access the Mount menu in TWRP and uncheck Data, and follow the steps below step by step :
(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 6501
(parted) name 43 system
(parted) set 43 msftdata on
(parted) mkpart cust ext4 6501 6702
(parted) name 44 cust
(parted) set 44 msftdata on
(parted) mkpart version ext4 6702 6736
(parted) name 45 version
(parted) set 45 msftdata on
(parted) mkpart vendor ext2 6736 7374
(parted) name 46 vendor
(parted) set 46 msftdata on
(parted) mkpart product ext4 7374 7575
(parted) name 47 product
(parted) set 47 msftdata on
(parted) mkpart hisitest 7575 7579
(parted) name 48 hisitest2
(parted) set 48 msftdata on
- for devices with 32GB :
(parted) mkpart userdata 7579 31.3GB
- for devices with 64GB :
(parted) mkpart userdata 7579 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
- copy the new updated of LOS 17.1 with system partition of 5GB into your device
- copy any GApps arm64 Android 10 to your device
- Install them like always, enjoy !
Mention :
- if your device is WiFi only, you may have fewer partitions .... the above instructions can be easily adapted from case to case !
The main idea is that we must first find out what position the system partition is in, in this case it was at position 43 which corresponds to /dev/block/mmcblk0p43 - then we need to delete all partitions from userdata to system, and recreate them in the same order !
To calculate the start and end position, it is again very easy : for example the system partition starts from the initial position 1174, which is the same as the end position of the previous partition 42 (42 1160MB 1174MB 14.7MB reserved3 msftdata), and the end position was incremented by 5327 in this case (almost 5GB), resulting in 6501. .. the next partition 44 (cust) will have the starting position 6501, and the end position will be incremented by 201 (i.e. 201MB) as shown on line 44 (44 3255MB 3456MB 201MB ext4 cust msftdata)
If really needed, a concrete example will be added here for WiFi only devices !
Thanks for this guide.
Thank you surdu_petru.
The internal storage size of BTV-L0J is 16GB, is the above procedure effective?
Is it possible to restore a partition size back to its original size? I sometimes use a dd command as a way to restore from LineageOS to stock ROM. So I need to restore it to its original size before using a dd command.
According to z3DD3r, who created a tool to resize the Nexus 5 system partition, it is recommended that after changing the partition size, TWRP should also be changed.
z3DD3r said:
Because TWRP includes size of system partition. This size should match the size of system partition on device. Otherwise bad things can happen...
Click to expand...
Click to collapse
Is there any problem without changing TWRP?
I am sorry for asking so many questions. I am cautious about changing the partition size because it is perilous.
Me said:
Thank you surdu_petru.
The internal storage size of BTV-L0J is 16GB, is the above procedure effective?
Is it possible to restore a partition size back to its original size? I sometimes use a dd command as a way to restore from LineageOS to stock ROM. So I need to restore it to its original size before using a dd command.
According to z3DD3r, who created a tool to resize the Nexus 5 system partition, it is recommended that after changing the partition size, TWRP should also be changed.
Is there any problem without changing TWRP?
I am sorry for asking so many questions. I am cautious about changing the partition size because it is perilous.
Click to expand...
Click to collapse
If you still have 49 partitions, and partition 43 (system) shows that in the above tutorial then the procedure is identical, you just have to put a lower value of the user data partition in the last corresponding line of 16GB!
- for devices with 16GB:
(parted) mkpart userdata 7579 ?? GB
Click to expand...
Click to collapse
There is no need to change anything, neither TWRP nor the partition to the initial value ... the most important thing is to pay attention to the Start and End position of system partition to make the calculations as accurate as possible !
I can help you if you can send me a screenshot of what the command below displays on your device (from the system down to the last partition):
> adb shell
# parted /dev/block/mmcblk0 print
surdu_petru said:
If you still have 49 partitions, and partition 43 (system) shows that in the above tutorial then the procedure is identical, you just have to put a lower value of the user data partition in the last corresponding line of 16GB!
There is no need to change anything, neither TWRP nor the partition to the initial value ... the most important thing is to pay attention to the Start and End position of system partition to make the calculations as accurate as possible !
I can help you if you can send me a screenshot of what the command below displays on your device (from the system down to the last partition):
> adb shell
# parted /dev/block/mmcblk0 print
Click to expand...
Click to collapse
Thank you for your reply.
It is good news that if each partition has the same number it is effective.
I am currently not having trouble with the size of system partitions, so I will give it some more thought.
@surdu_petru - many thanks for this guide, I found it very clear and straightforward. I wasn't sure if you were wanting confirmation that these instructions work with other models of the tablet - if so, I can confirm it works perfectly with my (wifi only, 32GB) BTV-W09.
Herby007 said:
@surdu_petru - many thanks for this guide, I found it very clear and straightforward. I wasn't sure if you were wanting confirmation that these instructions work with other models of the tablet - if so, I can confirm it works perfectly with my (wifi only, 32GB) BTV-W09.
Click to expand...
Click to collapse
Thanks for confirmation. I'm not waiting especially confirmation, but it's always better if you can confirm. I'm here to help in case that something goes wrong.
I'm going for the 3rd time as the first I messed up. Second I did it right but I think I have to switch it up a little as I have the WIFI, and I can't do mkfs.ext4 after doing the parted commands. But I'll keep on it to see if all the partitions are exactly correct. I know 43 is the same as the directions said to make sure. 3rd times the charm. Good luck out there
Hey man, things are kinda messed up for me at the moment.
I've followed your steps however my cmd crashed for some reason during the process. Now I can't mount data to start the process again. Using the genuine EMUI Recovery offerd at startup doesn't work because the partitions are messed up and my own recovery points are inaccessible probably due to a currupted ext sd card (you can't make this up )
Do you have any tips on how to regain control? Or are all hopes lost?
I've tried using pro-team multi tool, however their database/website seems to be unavailable at the moment...
Edit: I have it fixed now, using a sd-card I did a force update to stock firmware, that fixed the storage. Had to restart the entire process starting with TWRP installation, device was still unlocked though. Don't be stupid like me and always check your recovery data before and not after you already messed things up
hey guys,
I somehow messed it up and I'm getting this error message
/data is not present!
Failed to mount '/data'
Partitions are formatted:
43 1174MB 6501MB 5327MB ext4 system msftdata
44 6501MB 6702MB 201MB ext4 cust msftdata
45 6702MB 6736MB 33.6MB ext4 version msftdata
46 6736MB 7374MB 638MB ext4 vendor msftdata
47 7374MB 7575MB 201MB ext4 product msftdata
48 7575MB 7579MB 4194kB hisitest2 msftdata
49 7579MB 31.3GB 23.7GB userdata msftdata
Here is an output of "df" command:
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.8G 184.0K 1.8G 0% /dev
tmpfs 1.8G 2.0M 1.8G 0% /tmp
/dev/block/mmcblk0p36 232.0M 756.0K 223.6M 0% /cache
/dev/block/mmcblk0p46 582.4M 468.0K 563.7M 0% /vendor
/dev/block/mmcblk1p1 59.5G 5.0G 54.5G 8% /external_sd
I can't continue with "TWRP -> Wipe"
Any ideas what went wrong?
BlueLife98 said:
Hey man, things are kinda messed up for me at the moment.
I've followed your steps however my cmd crashed for some reason during the process. Now I can't mount data to start the process again. Using the genuine EMUI Recovery offerd at startup doesn't work because the partitions are messed up and my own recovery points are inaccessible probably due to a currupted ext sd card (you can't make this up )
Do you have any tips on how to regain control? Or are all hopes lost?
I've tried using pro-team multi tool, however their database/website seems to be unavailable at the moment...
Edit: I have it fixed now, using a sd-card I did a force update to stock firmware, that fixed the storage. Had to restart the entire process starting with TWRP installation, device was still unlocked though. Don't be stupid like me and always check your recovery data before and not after you already messed things up
Click to expand...
Click to collapse
hey man, how did you install the stock firmware? tried to install these firmware's but didn't work at all https://firmwarefile.com/huawei-mediapad-m3-btv-dl09

Dual boot for P-Smart

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 P-Smart that keep Stock rom untouched and install any GSIs. It allows two Android os installed at the same time and switch between them using SHRP Recovery for dual boot.
This method tested and worked on Fig-la1
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/SHRP
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/SHRP
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
name 59 system-b
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
name 60 userdata
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 to stock recovery to make factory reset
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- You can now switch between two systems using either of these two methods
Spoiler: Using SHRP Recovery
SHRP is a beautiful TWRP-based recovery with modern UI, custom layout, useful functions, and more.
In this method you must have "System" and "System-b" partitions, other names not accepted
1- Download SHRP Recovery for DUAL Boot from here
2- Flash it on recovery_ramdisk or erecovery_ramdisk
3- from the main screen choose tweaks
A- Active new system partition and new data profile
(Important Note: Now "System partition" is the new created partition and "System-b partition" is the default system partition)
B- Active default system partition and default data profile
(Important Note: Now "System partition" is the default system partition and "System-b partition" is the new created partition)
Reboot before make any change
Spoiler: manually
A- 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
B- 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
-------------------------------------------------------
@Abdelhay.ali hey bro, can i use shrp recovery to root FIG-LA1?
and which system (rom) will be used as second system?

Categories

Resources