Unable to Fastboot flash system.img - Xiaomi Mi A2 Lite Questions & Answers

Tried two offical Xiaomi fastboot Pie images, and system.img doesn't flash. Other smaller in size system images I flashed to see what would happen do go through, but they don't work. Pie image is 2.1 GB. Other partitions are all flashed.
Each attempt via Xiaomi flash tool ends with: Chunk data size exceeds partition size.
Log:
$fastboot -s 08f97d930705 flash system_a C:\XiaoMi\XiaoMiFlash\Source\ThirdParty\Google\Android\daisy_global_images_V10.0.10.0.PDLMIXM_9.0\\images\system.img ||
[10:26:06 AM 08f97d930705]:target reported max download size of 534773760 bytes
[10:26:06 AM 08f97d930705]:sending sparse 'system_a' 1/3 (462332 KB)...
[10:26:06 AM 08f97d930705]KAY [ 59.062s]
[10:26:06 AM 08f97d930705]:writing 'system_a' 1/3...
[10:26:06 AM 08f97d930705]:error:FAILED (remote: Chunk data size exceeds partition size)
[10:26:06 AM 08f97d930705]:flashSuccess False
Fastboot flash_all.bat gives:
fastboot getvar product 2>&1 | findstr /r /c:"^product: *d
aisy" ||
The system cannot find message text for message number 0x8 in the message file f
or System.
Fastboot flash system sends sparse chunks and gives:
data too large
So, what gives? Any ideas greatly appreciated.

MarkR7 said:
Tried two offical Xiaomi fastboot Pie images, and system.img doesn't flash. Other smaller in size system images I flashed to see what would happen do go through, but they don't work. Pie image is 2.1 GB. Other partitions are all flashed.
Each attempt via Xiaomi flash tool ends with: Chunk data size exceeds partition size.
Log:
$fastboot -s 08f97d930705 flash system_a C:\XiaoMi\XiaoMiFlash\Source\ThirdParty\Google\Android\daisy_global_images_V10.0.10.0.PDLMIXM_9.0\\images\system.img ||
[10:26:06 AM 08f97d930705]:target reported max download size of 534773760 bytes
[10:26:06 AM 08f97d930705]:sending sparse 'system_a' 1/3 (462332 KB)...
[10:26:06 AM 08f97d930705]KAY [ 59.062s]
[10:26:06 AM 08f97d930705]:writing 'system_a' 1/3...
[10:26:06 AM 08f97d930705]:error:FAILED (remote: Chunk data size exceeds partition size)
[10:26:06 AM 08f97d930705]:flashSuccess False
Fastboot flash_all.bat gives:
fastboot getvar product 2>&1 | findstr /r /c:"^product: *d
aisy" ||
The system cannot find message text for message number 0x8 in the message file f
or System.
Fastboot flash system sends sparse chunks and gives:
data too large
So, what gives? Any ideas greatly appreciated.
Click to expand...
Click to collapse
It could be an error from the tool or maybe you need to delete some logs that can cause a conflict anyway did you try using just fastboot command to flash just system? if not trying finding which is your current slot and then flash it directly to it.
I guess size image support is around 2,5GB.

SubwayChamp said:
It could be an error from the tool or maybe you need to delete some logs that can cause a conflict anyway did you try using just fastboot command to flash just system? if not trying finding which is your current slot and then flash it directly to it.
I guess size image support is around 2,5GB.
Click to expand...
Click to collapse
I direct fastboot flashed system multiple times, also flash all bat, I also restored Oeeo from TWRP backup multiple timea, Oreo working fine, now that I think of it, Mi Flash tool seems to be from 2017 and it seems old to me, I got it from their link somewhere, but could the newest one be that old? Need to check that.

MarkR7 said:
I direct fastboot flashed system multiple times, also flash all bat, I also restored Oeeo from TWRP backup multiple timea, Oreo working fine, now that I think of it, Mi Flash tool seems to be from 2017 and it seems old to me, I got it from their link somewhere, but could the newest one be that old? Need to check that.
Click to expand...
Click to collapse
This seems to be the latest stable version https://c.mi.com/thread-1329226-1-0.html and although this is newer use the tool from 2017 but ever worked for me https://xiaomifirmware.com/downloads/mif anyway you have too the option to flash through edl

I think someone had a problem due to fastboot being too old.
The partition should be 2.5Gb so unless you or someone else resized partitions, it should be large enough.
I can use fdisk from a running phone to print partition info. If you can't boot, perhaps you can check from twrp?
Code:
# fdisk /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Command (m for help): p
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 60 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Name
1 34 49 8192 fsc
2 50 65 8192 ssd
3 66 81 8192 dpo
4 82 113 16384 sec
5 114 145 16384 bk1
6 146 185 20480 bk2
7 186 249 32768 DDR
8 250 313 32768 limits
9 314 377 32768 config
10 378 505 65536 bk3
11 506 761 128K lksecapp
12 762 1017 128K lksecappbak
13 1018 1529 256K devcfg_a
14 1530 2041 256K devcfg_b
15 2042 2553 256K apdp
16 2554 3065 256K msadp
17 3066 4089 512K sbl1_a
18 4090 5113 512K sbl1_b
19 5114 6137 512K rpm_a
20 6138 7161 512K rpm_b
21 7162 8185 512K mota
22 8186 9209 512K keystore
23 9210 10233 512K syscfg
24 10234 12281 1024K cmnlib_a
25 12282 14329 1024K cmnlib_b
26 14330 16377 1024K cmnlib64_a
27 16378 18425 1024K cmnlib64_b
28 18426 20473 1024K keymaster_a
29 20474 22521 1024K keymaster_b
30 22522 24569 1024K misc
31 24570 26617 1024K aboot_a
32 26618 28665 1024K aboot_b
33 28666 30713 1024K dip
34 30714 32761 1024K bk4
35 32762 36857 2048K tz_a
36 36858 40953 2048K tz_b
37 40954 49145 4096K mcfg
38 49146 65529 8192K devinfo
39 65530 81913 8192K fsg
40 81914 98297 8192K modemst1
41 98298 114681 8192K modemst2
42 114682 131065 8192K bk5
43 131066 163833 16.0M splash
44 163834 196601 16.0M dsp_a
45 196602 229369 16.0M dsp_b
46 229370 262137 16.0M bk6
47 262138 327673 32.0M mdtp_a
48 327674 393209 32.0M mdtp_b
49 393210 458745 32.0M persist
50 458746 524281 32.0M persistbak
51 524288 655359 64.0M boot_a
52 655360 786431 64.0M boot_b
53 786432 917503 64.0M logdump
54 917504 1179647 128M modem_a
55 1179648 1441791 128M modem_b
56 1441792 6684671 2560M system_a
57 6684672 11927551 2560M system_b
58 11927552 13500415 768M vendor_a
59 13500416 15073279 768M vendor_b
60 15073280 122142686 51.0G userdata
Command (m for help): q

a1291762 said:
I think someone had a problem due to fastboot being too old.
The partition should be 2.5Gb so unless you or someone else resized partitions, it should be large enough.
I can use fdisk from a running phone to print partition info. If you can't boot, perhaps you can check from twrp?
Code:
# fdisk /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Command (m for help): p
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 60 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Name
1 34 49 8192 fsc
2 50 65 8192 ssd
3 66 81 8192 dpo
4 82 113 16384 sec
5 114 145 16384 bk1
6 146 185 20480 bk2
7 186 249 32768 DDR
8 250 313 32768 limits
9 314 377 32768 config
10 378 505 65536 bk3
11 506 761 128K lksecapp
12 762 1017 128K lksecappbak
13 1018 1529 256K devcfg_a
14 1530 2041 256K devcfg_b
15 2042 2553 256K apdp
16 2554 3065 256K msadp
17 3066 4089 512K sbl1_a
18 4090 5113 512K sbl1_b
19 5114 6137 512K rpm_a
20 6138 7161 512K rpm_b
21 7162 8185 512K mota
22 8186 9209 512K keystore
23 9210 10233 512K syscfg
24 10234 12281 1024K cmnlib_a
25 12282 14329 1024K cmnlib_b
26 14330 16377 1024K cmnlib64_a
27 16378 18425 1024K cmnlib64_b
28 18426 20473 1024K keymaster_a
29 20474 22521 1024K keymaster_b
30 22522 24569 1024K misc
31 24570 26617 1024K aboot_a
32 26618 28665 1024K aboot_b
33 28666 30713 1024K dip
34 30714 32761 1024K bk4
35 32762 36857 2048K tz_a
36 36858 40953 2048K tz_b
37 40954 49145 4096K mcfg
38 49146 65529 8192K devinfo
39 65530 81913 8192K fsg
40 81914 98297 8192K modemst1
41 98298 114681 8192K modemst2
42 114682 131065 8192K bk5
43 131066 163833 16.0M splash
44 163834 196601 16.0M dsp_a
45 196602 229369 16.0M dsp_b
46 229370 262137 16.0M bk6
47 262138 327673 32.0M mdtp_a
48 327674 393209 32.0M mdtp_b
49 393210 458745 32.0M persist
50 458746 524281 32.0M persistbak
51 524288 655359 64.0M boot_a
52 655360 786431 64.0M boot_b
53 786432 917503 64.0M logdump
54 917504 1179647 128M modem_a
55 1179648 1441791 128M modem_b
56 1441792 6684671 2560M system_a
57 6684672 11927551 2560M system_b
58 11927552 13500415 768M vendor_a
59 13500416 15073279 768M vendor_b
60 15073280 122142686 51.0G userdata
Command (m for help): q
Click to expand...
Click to collapse
I don't know what the hell is going on. Just tried to flash again with newer late 2018 Xiaomi Flash tool and included fastboot. This time the thing didn't run erase commands before flashing partitions and ended up with the same Chunk Size Data exceeds partition size error. I restored to Oreo from my TWRP backups. TWRP shows partition size as normal 2.5 GB. Never touched the partition table. Smaller GSI images flash in there. Oreo is 1.7 GB, I think, it restores. On Oreo everything works, encryption disabler, Magisk. Just can't flash the lousy official Pie system, tried 10.0.03.0 Whatever, tried 10.0.10 from June, same thing. Somebody suggested I convert to ext4 image, but why the hell does it not just work? Like it can't handle the size of the system image somehow. Will try your commands, thanks. Maybe even newer Xiaomi tool. Damn
Thanks for help.
What is really bloody funny is I have puny Redmi Go running Lineage 16 and all set up without any trouble. Just hilarious.

MarkR7 said:
I don't know what the hell is going on. Just tried to flash again with newer late 2018 Xiaomi Flash tool and included fastboot. This time the thing didn't run erase commands before flashing partitions and ended up with the same Chunk Size Data exceeds partition size error. I restored to Oreo from my TWRP backups. TWRP shows partition size as normal 2.5 GB. Never touched the partition table. Smaller GSI images flash in there. Oreo is 1.7 GB, I think, it restores. On Oreo everything works, encryption disabler, Magisk. Just can't flash the lousy official Pie system, tried 10.0.03.0 Whatever, tried 10.0.10 from June, same thing. Somebody suggested I convert to ext4 image, but why the hell does it not just work? Like it can't handle the size of the system image somehow. Will try your commands, thanks. Maybe even newer Xiaomi tool. Damn
Thanks for help.
What is really bloody funny is I have puny Redmi Go running Lineage 16 and all set up without any trouble. Just hilarious.
Click to expand...
Click to collapse
Try the latest rom http://bigota.d.miui.com/V10.0.12.0...0.PDLMIXM_20190717.0000.00_9.0_59368ef014.tgz and try it using edl, edl is a lower level than fastboot and probably might work better.

edl flash fail - identical to fastboot
SubwayChamp said:
Try the latest rom http://bigota.d.miui.com/V10.0.12.0...0.PDLMIXM_20190717.0000.00_9.0_59368ef014.tgz and try it using edl, edl is a lower level than fastboot and probably might work better.
Click to expand...
Click to collapse
This thing is impossible. EDL flash fails the same way, at about the same time in the flash process. Just says error and maybe the device got disconnected. It did not.
Since I got the phone recently, I never run any OTA updates on it and it's on the lastest Oreo 9.6.11 before 10.0.2.0 Pie. System partition is actually 2.4 GB and Vendor is also slightly smaller than a1291762's partition size. Could it be they increased partitio sizes during 10.0.2.0 Pie update and not applying/skipping that update causes the trouble? Honestly I have no idea, anybody who can make something out of this? Should I run 10.0.2.0 to see if it changes partitions? Or does skipping that update cause trouble for some other unfathomable reason? I will just try OTA sooner or later, I guess.
Here's the output:
daisy_sprout:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/block/mmcblk0p56 2.4G 1.6G 751M 70% /system_root
tmpfs 1.7G 1.4M 1.7G 1% /sbin
tmpfs 1.7G 712K 1.7G 1% /dev
/dev/block/mmcblk0p58 744M 555M 174M 77% /vendor
tmpfs 1.7G 0 1.7G 0% /mnt
/dev/block/mmcblk0p49 27M 2.7M 24M 11% /persist
/dev/block/mmcblk0p54 128M 81M 47M 63% /firmware
/dev/block/mmcblk0p44 12M 6.9M 4.5M 61% /dsp
/sbin/.magisk/block/data 50G 808M 49G 2% /sbin/.magisk/modules
/data/media 50G 808M 49G 2% /storage/emulated
/mnt/media_rw/0403-0201 29G 28G 712M 98% /storage/0403-0201
daisy_sprout:/ $ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p56 2539312 1754068 768860 70% /system_root
tmpfs 1821960 1500 1820460 1% /sbin
tmpfs 1821960 712 1821248 1% /dev
/dev/block/mmcblk0p58 761776 567948 178100 77% /vendor
tmpfs 1821960 0 1821960 0% /mnt
/dev/block/mmcblk0p49 28144 2772 24720 11% /persist
/dev/block/mmcblk0p54 131008 82464 48544 63% /firmware
/dev/block/mmcblk0p44 12016 7072 4620 61% /dsp
/sbin/.magisk/block/data 52562448 827192 51718872 2% /sbin/.magisk/modules

MarkR7 said:
This thing is impossible. EDL flash fails the same way, at about the same time in the flash process. Just says error and maybe the device got disconnected. It did not.
Since I got the phone recently, I never run any OTA updates on it and it's on the lastest Oreo 9.6.11 before 10.0.2.0 Pie. System partition is actually 2.4 GB and Vendor is also slightly smaller than a1291762's partition size. Could it be they increased partitio sizes during 10.0.2.0 Pie update and not applying/skipping that update causes the trouble? Honestly I have no idea, anybody who can make something out of this? Should I run 10.0.2.0 to see if it changes partitions? Or does skipping that update cause trouble for some other unfathomable reason? I will just try OTA sooner or later, I guess.
Here's the output:
daisy_sprout:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/block/mmcblk0p56 2.4G 1.6G 751M 70% /system_root
tmpfs 1.7G 1.4M 1.7G 1% /sbin
tmpfs 1.7G 712K 1.7G 1% /dev
/dev/block/mmcblk0p58 744M 555M 174M 77% /vendor
tmpfs 1.7G 0 1.7G 0% /mnt
/dev/block/mmcblk0p49 27M 2.7M 24M 11% /persist
/dev/block/mmcblk0p54 128M 81M 47M 63% /firmware
/dev/block/mmcblk0p44 12M 6.9M 4.5M 61% /dsp
/sbin/.magisk/block/data 50G 808M 49G 2% /sbin/.magisk/modules
/data/media 50G 808M 49G 2% /storage/emulated
/mnt/media_rw/0403-0201 29G 28G 712M 98% /storage/0403-0201
daisy_sprout:/ $ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p56 2539312 1754068 768860 70% /system_root
tmpfs 1821960 1500 1820460 1% /sbin
tmpfs 1821960 712 1821248 1% /dev
/dev/block/mmcblk0p58 761776 567948 178100 77% /vendor
tmpfs 1821960 0 1821960 0% /mnt
/dev/block/mmcblk0p49 28144 2772 24720 11% /persist
/dev/block/mmcblk0p54 131008 82464 48544 63% /firmware
/dev/block/mmcblk0p44 12016 7072 4620 61% /dsp
/sbin/.magisk/block/data 52562448 827192 51718872 2% /sbin/.magisk/modules
Click to expand...
Click to collapse
Eventually a failed update can do some weird things like this but is unusual or rarely heard.
Don´t wait that OTA comes to your device, choose one from the official site to be flashed through stock recovery if you have some hope that this help.
Also then to try this in TWRP there is an option to restore system partition (I´m not sure if this really works)
And as a last resource maybe you might to re-adjust the size partition http://en.miui.com/thread-183258-1-1.html

OTA ROM update
Thanks for all advice, really appreciated. I got a zillion backups thru TWRP and those not working fastboot ROMs. I am on a crappy limited mobile connection right now and need to get wifi to get all the ROMs, so preferred to store them locally on a laptop, but should have just run an OTA straight away. Anyway, am back on original stock Oreo, fully stock boot system everything. Have last August 10.13 OTA rom zip and wonder how the hell to try that one. Nothing under system update that would let me use locally stored OTA ROM. Renaming it to update.zip and putting in root of internal storage doesn't seem to work for stock recovery.
Never mind. found a way. Still craps out. Says error in package zip Status 1 whatever the hell that is. Thanks anyway.

MarkR7 said:
Thanks for all advice, really appreciated. I got a zillion backups thru TWRP and those not working fastboot ROMs. I am on a crappy limited mobile connection right now and need to get wifi to get all the ROMs, so preferred to store them locally on a laptop, but should have just run an OTA straight away. Anyway, am back on original stock Oreo, fully stock boot system everything. Have last August 10.13 OTA rom zip and wonder how the hell to try that one. Nothing under system update that would let me use locally stored OTA ROM. Renaming it to update.zip and putting in root of internal storage doesn't seem to work for stock recovery.
Never mind. found a way. Still craps out. Says error in package zip Status 1 whatever the hell that is. Thanks anyway.
Click to expand...
Click to collapse
Update from internal storage and from adb sideload are available on stock recovery. Unfortunately TWRP can´t flash stock updates like on other Xiaomi devices using Miui.
Probably you might try the Miui rom ported available in this forum https://forum.xda-developers.com/mi-a2-lite/development/9-miui-rom-t3960704, system image has almost 2,40GB (version 1.1)

Stocl Recovery
SubwayChamp said:
Update from internal storage and from adb sideload are available on stock recovery. Unfortunately TWRP can´t flash stock updates like on other Xiaomi devices using Miui.
Probably you might try the Miui rom ported available in this forum https://forum.xda-developers.com/mi-a2-lite/development/9-miui-rom-t3960704, system image has almost 2,40GB (version 1.1)
Click to expand...
Click to collapse
You don't unserstand. I DO have stock recovery om both slots, everything as stock as possible. Had Full backups and restored them, boot images also. It is stock recovery that gives the error. Supposedly Status 1 has sth to do with setting permissions, but thanks anyway.

EDL finally worked, many thanks for help
:laugh:
SubwayChamp said:
Update from internal storage and from adb sideload are available on stock recovery. Unfortunately TWRP can´t flash stock updates like on other Xiaomi devices using Miui.
Probably you might try the Miui rom ported available in this forum https://forum.xda-developers.com/mi-a2-lite/development/9-miui-rom-t3960704, system image has almost 2,40GB (version 1.1)
Click to expand...
Click to collapse
:fingers-crossed:
After some fails, EDL flash finally worked and the phone is now on Pie. Many thanks for the suggestion. For some seconds after flash I thought it was a total brick, but I think it must have been exiting EDL. Normal fastboot flash of system.img failed each time.
Again, many thanks for help and time you took.

Related

[Q] d855 unbricking help :)

OK, I am no noob at rooting, but have drawn a blank with this one. Would very much appreciate some advice.
I have 2 x LG G3 D855s, both running Cloudy G3 ROM. Both have been successfully downgraded to Android 4.4.2 (10L), rooted with purple drake, and Cloudy Lollipop installed. Perfect.
BUT whilst doing a Titanium restore on an app, one of them rebooted this evening, and is now bricked.
- Normal boot - never does anything other than initial LG boot logo;
- TWRP takes about 5 minutes on the splash screen before reaching the main TWRP screen (but has errors, see later);
- LG download mode only shows the initial logo on the phone but the PC does not 'see' it upon cable connection, and the phone never kicks into full download mode. Connecting my other d855 fires up download mode correctly, so PC drivers are OK.
Because download mode never fully starts, I am unable to restore to stock using the kdz / LG flash.
When TWRP DOES start, it is unable to mount /data, /cache, and the log has the following errors:
E: Could not mount /data and unable to find crypto folder
E: Unable to mount /data
E: Unable to recreate /data/media folder
E: Unable to mount /cache
E: Unable to mount storage
... etc.
Within TWRP Internal Storage is shown as (0MB), and /data and /cache are not mounted. My external_sd is mounted OK.
With TWRP running, a device is seen by my PC (Google Nexus ADB Interface) but 'adb devices' shows nothing. This is the same behaviour as the phone that works, so I assume that at least is normal.
I am unable to mount /data manually, or repair within TWRP.
With /data not mounted, I am unable to proceed any further...
So my question - how do I rebuild the screwed up partitions? Or am I barking up the wrong tree?
Some more troubleshooting.
Trying to mount manually in terminal in TWRP gives me a mount unknown error 150.
Running a non-invasive e2fsck gives me:
Code:
e2fsck 1.41.14 (22-Dec-2010)
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Inode 7, i_size is 3082895360, should be 3087097856. Fix? no
Inode 245415, i_blocks is 704, should be 712. Fix? no
Deleted inode 261925 has zero dtime. Fix? no
Pass 2: Checking directory structure
Entry 'net.dinglisch.android.taskerm' in /data (244801) references inode 342934 found in group 42's unused inodes area.
Fix? no
Entry 'net.dinglisch.android.taskerm' in /data (244801) has deleted/unused inode 342934. Clear? no
Entry 'base.apk' in /app/net.dinglisch.android.taskerm-1 (342899) references inode 342932 found in group 42's unused inodes area.
Fix? no
Entry 'base.apk' in /app/net.dinglisch.android.taskerm-1 (342899) has deleted/unused inode 342932. Clear? no
Entry 'lib' in /app/net.dinglisch.android.taskerm-1 (342899) references inode 342933 found in group 42's unused inodes area.
Fix? no
Entry 'lib' in /app/net.dinglisch.android.taskerm-1 (342899) has deleted/unused inode 342933. Clear? no
Entry 'net.dinglisch.android.taskerm' in /dalvik-cache/profiles (1020002) references inode 1020523 found in group 125's unused inodes area.
Fix? no
Entry 'net.dinglisch.android.taskerm' in /dalvik-cache/profiles (1020002) has deleted/unused inode 1020523. Clear? no
Entry '[email protected]@[email protected]@classes.dex' in /dalvik-cache/arm (1020003) references inode 1020522 found in group 125's unused inodes area.
Fix? no
Entry '[email protected]@[email protected]@classes.dex' in /dalvik-cache/arm (1020003) has deleted/unused inode 1020522. Clear? no
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Inode 244801 ref count is 227, should be 226. Fix? no
Inode 342899 ref count is 3, should be 2. Fix? no
Pass 5: Checking group summary information
Block bitmap differences: -(1389467--1390267) -3348514
Fix? no
Free blocks count wrong for group #25 (293, counted=292).
Fix? no
Free blocks count wrong for group #37 (4806, counted=4853).
Fix? no
Free blocks count wrong for group #42 (20629, counted=19028).
Fix? no
Free blocks count wrong (5806109, counted=5471235).
Fix? no
Inode bitmap differences: -261925 -(342932--342935) -(1020522--1020523)
Fix? no
Free inodes count wrong for group #32 (7338, counted=7337).
Fix? no
Free inodes count wrong for group #42 (7950, counted=7945).
Fix? no
Directories count wrong for group #42 (57, counted=58).
Fix? no
Free inodes count wrong for group #125 (7639, counted=7637).
Fix? no
Free inodes count wrong (1692439, counted=1689847).
Fix? no
/dev/block/mmcblk0p43: ********** WARNING: Filesystem still has errors **********
/dev/block/mmcblk0p43: 4841/1697280 files (8.7% non-contiguous), 988001/6794110 blocks
Parted gives me this:
Code:
Model: MMC SDW32G (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 16.8MB 83.9MB 67.1MB fat16 modem
2 83.9MB 84.9MB 1049kB sbl1
3 84.9MB 85.5MB 524kB dbi
4 85.5MB 86.0MB 524kB DDR
5 86.0MB 88.1MB 2097kB aboot
6 88.1MB 89.1MB 1049kB rpm
7 89.1MB 90.2MB 1049kB tz
8 90.2MB 90.2MB 4096B pad
9 90.2MB 91.2MB 1049kB sbl1b
10 91.2MB 91.8MB 524kB dbibak
11 91.8MB 92.8MB 1049kB rpmbak
12 92.8MB 93.9MB 1049kB tzbak
13 93.9MB 94.9MB 1049kB rpmf
14 94.9MB 95.9MB 1049kB tzf
15 95.9MB 96.5MB 524kB sdif
16 96.5MB 98.6MB 2097kB abootf
17 98.6MB 101MB 2093kB spare1
18 101MB 117MB 16.8MB boot
19 117MB 151MB 33.6MB ext4 persist
20 151MB 168MB 16.8MB recovery
21 168MB 171MB 3146kB modemst1
22 171MB 174MB 3146kB modemst2
23 174MB 174MB 4096B pad1
24 174MB 177MB 3146kB fsg
25 177MB 178MB 524kB fsc
26 178MB 178MB 524kB ssd
27 178MB 178MB 4096B pad2
28 178MB 179MB 524kB encrypt
29 179MB 179MB 524kB eksst
30 179MB 179MB 8192B rct
31 179MB 185MB 5226kB spare2
32 185MB 201MB 16.8MB misc
33 201MB 235MB 33.6MB laf
34 235MB 268MB 33.6MB fota
35 268MB 285MB 16.8MB spare3
36 285MB 294MB 8389kB ext4 drm
37 294MB 302MB 8389kB ext4 sns
38 302MB 336MB 33.6MB ext4 mpt
39 336MB 369MB 33.6MB factory
40 369MB 2533MB 2164MB ext4 system
41 2533MB 3171MB 638MB ext4 cache
42 3171MB 3439MB 268MB ext4 cust
43 3439MB 31.3GB 27.8GB ext4 userdata
44 31.3GB 31.3GB 513kB grow
Whenever I try and write, repair, or delete the partitions parted tells me:
Code:
Error: Input/output error during write on /dev/block/mmcblk0
I can read partitions. I have backed up EFS and /boot. For what it's worth
I can't delete partitions:
Code:
/ # dd if=/dev/zero of=/dev/block/mmcblk0 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512B) copied, 0.247840 seconds, 2.0KB/s
/ # parted /dev/block/mmcblk0 print
Model: MMC SDW32G (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 16.8MB 83.9MB 67.1MB fat16 modem
2 83.9MB 84.9MB 1049kB sbl1
3 84.9MB 85.5MB 524kB dbi
4 85.5MB 86.0MB 524kB DDR
5 86.0MB 88.1MB 2097kB aboot
6 88.1MB 89.1MB 1049kB rpm
7 89.1MB 90.2MB 1049kB tz
8 90.2MB 90.2MB 4096B pad
...
etc...
So it looks like the whole filesystem has gone read only??? Any way to force reset it? I'd have thought dd would have worked.

[6039y] **GUIDE** Repartitioning of the internal memory

Here it is as I promised.
This phone (the model with one sim card) is sold as a device with 8GB internal memory. In fact the memory chip inside is 16GB, so we can increase the available internal space.
PLEASE READ CAREFULLY AND IF SOMETHING IS NOT CLEAR DO NOT HESITATE TO ASK.
*** The data on your device will be untouched after this operation. But again please read carefully! ***
*** A good practice is always to make a backup of everything which will be changed. I do it and I've made a backup of the entire internal memory of the device before the start of the operation which is described below. ***
*** At the end of the post there is a link to a ZIP file which can be flashed through TWRP in order to perform the procedure automatically. Also includes a check for the size of the EMMC (as there are devices on which the resizing cannot be performed...their chip is smaller).***
1. You can go to this thread and to say Thanks! @meghd00t as his static build of gdisk is used in the recovery below.
2. What is needed:
- A different TWRP Recovery with gdisk inside. It can be downloaded from here twrp-2.8.7.0-idol3-6039y-with-gdisk.img - md5sum: 66b3f82a3e2e1afe14627b3b900a9319
- (Optional) An SD card for backup of the original GPT partition layout.
- Patience and careful reading.
- The Windows users probably need the drivers from this post, for access to the device in recovery mode.
3. How to do it (the output used below is from the terminal window from which I've done this operation on my device):
- reboot to bootloader:
Code:
adb reboot-bootloader
- start the recovery
Code:
fastboot -i 0x1bbb boot twrp-2.8.7.0-idol3-6039y-with-gdisk.img
- go to the device
Code:
adb shell
- unmount all partitions of the internal memory
Code:
~ # umount /cache
~ # umount /sdcard
~ # umount /and-sec
- ensure that there are no mounted partitions from mmcblk0. The output from the mount command should looks like this:
Code:
~ # mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=713016k,nr_inodes=157853,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,seclabel,relatime,size=713016k,nr_inodes=157853)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
/dev/block/mmcblk1p1 on /external_sd type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
- start gdisk
Code:
~ # gdisk /dev/block/mmcblk0
all partitions can be listed by pressing 'p' but we are interested by the last two:
Code:
37 5000400 15269853 4.9 GiB FFFF userdata
38 15269854 30535646 7.3 GiB 0700 userdatabak
and their information which will be shown by pressing 'i' and entering the partition number:
Code:
Command (? for help): i
Partition number (1-38): 37
Partition GUID code: 1B81E7E6-F50D-419B-A739-2AEEF8DA3335 (Unknown)
Partition unique GUID: BDD7FA27-93D4-40BC-B266-313E074E0E87
First sector: 5000400 (at 2.4 GiB)
Last sector: 15269853 (at 7.3 GiB)
Partition size: 10269454 sectors (4.9 GiB)
Attribute flags: 0000000000000000
Partition name: 'userdata'
Command (? for help): i
Partition number (1-38): 38
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
Partition unique GUID: BD12CF41-10E7-BBF7-D096-5553B89882E7
First sector: 15269854 (at 7.3 GiB)
Last sector: 30535646 (at 14.6 GiB)
Partition size: 15265793 sectors (7.3 GiB)
Attribute flags: 0000000000000000
Partition name: 'userdatabak'
The information which is needed from the above output is Partition GUID code, First sector, Last sector and Partition name. You can write these somewhere (if your values are different from the above) from where can be pasted easily later (alternatively you can use the scrollback function of the terminal ).
- if you have an SD card make a backup of the partitions layout (in case that something goes wrong):
Code:
Command (? for help): b
Enter backup filename to save: /external_sd/gpt_partitions_table.backup
The operation has completed successfully.
- delete partitions 37 and 38:
Code:
Command (? for help): d
Partition number (1-38): 38
Command (? for help): d
Partition number (1-37): 37
- create a new partition 37, bigger in size with the same (as before) Partition GUID code, and the same (as before) start sector:
Code:
Command (? for help): n
Partition number (37-40, default 37): 37
First sector (34-30535646, default = 5000400) or {+-}size{KMGTP}: 5000400
Last sector (5000400-30535646, default = 30535646) or {+-}size{KMGTP}: 30535546
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 1B81E7E6-F50D-419B-A739-2AEEF8DA3335
Changed type of partition to 'Unknown'
The difference here is in the last sector of the partition 30535546.
- create a new partition 38 with same Partition GUID code, but with different First sector:
Code:
Command (? for help): n
Partition number (38-40, default 38): 38
First sector (34-30535646, default = 34) or {+-}size{KMGTP}: 30535547
Information: Moved requested sector from 30535547 to 30535548 in
order to align on 2-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (30535548-30535646, default = 30535646) or {+-}size{KMGTP}: 30535646
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
Changed type of partition to 'Microsoft basic data'
Please note that here in the output after 'n' the default first sector is 34, so you explicitly must enter the value!!! As can be seen I've entered the next available sector (after partition 37) 305355547 but it has been corrected automatically to 30535548. So you can use directly 30535548 as a start sector. The last sector is at the end of the memory 30535646.
- write the names of the new partitions:
Code:
Command (? for help): c
Partition number (1-38): 37
Enter name: userdata
Command (? for help): c
Partition number (1-38): 38
Enter name: userdatabak
- if you list the partitions again (with 'p') the end of the table should looks like this:
Code:
37 5000400 30535546 12.2 GiB FFFF userdata
38 30535548 30535646 49.5 KiB 0700 userdatabak
- now it is safe to write the changes by pressing 'w':
Code:
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/block/mmcblk0.
The operation has completed successfully.
- resize the file system:
Code:
~ # resize2fs -p /dev/block/mmcblk0p37
resize2fs 1.42.9 (28-Dec-2013)
Please run 'e2fsck -f /dev/block/mmcblk0p37' first.
... hmm ... let's run it:
Code:
~ # e2fsck -f /dev/block/mmcblk0p37
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p37: 12519/321280 files (5.8% non-contiguous), 678615/1283425 blocks
~ # resize2fs -p /dev/block/mmcblk0p37
resize2fs 1.42.9 (28-Dec-2013)
Please run 'e2fsck -f /dev/block/mmcblk0p37' first.
... well the resize2fs have some checks and refuses to resize the file system therefore we must force the execution:
Code:
~ # resize2fs -fp /dev/block/mmcblk0p37
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/block/mmcblk0p37 to 3191893 (4k) blocks.
The filesystem on /dev/block/mmcblk0p37 is now 3191893 blocks long.
The device now can be rebooted and its internal memory will be almost 12GB which compared to its previous size is a very nice upgrade. Screenshots before and after the repartitioning can be seen here.
Update (19.09.2015): This is a link to a flashabable zip which can be used from the TWRP to automate the process. Can be used with any TWRP recovery for 6039.
md5sum: c3f685310283bdc00cee5412fa33259c
Just tried it, and it worked like a charm. Thank you very much!
Wow ! Kudos to meghd00t and petrov.0. I just ordered this phone as a backup, waiting for my beloved Xperia Z1 Compact to be saved from watering (medium rain during less than 10min, so long Sony waterproof phones...). Can't wait to receive it and play with this extra storage !! Thank you :victory:
Here i'am, crazy thinking that if the 6039y(Single chip, SDcard and 8Gb) come with 8Gb worth of wasted money, that the 6039j dual chip and 16Gb non-SDCard version may very well come with a SDCard reader hardware worth of wasted money.
It would be like just changing the Chip Support slot thing or whatever...
Can someone support my craziness and post a picture of thi "where the chip stays" of the SDCard reader version of this phone??
Thanks a lot!!
evilinheaven said:
Here i'am, crazy thinking that if the 6039y(Single chip, SDcard and 8Gb) come with 8Gb worth of wasted money, that the 6039j dual chip and 16Gb non-SDCard version may very well come with a SDCard reader hardware worth of wasted money.
It would be like just changing the Chip Support slot thing or whatever...
Can someone support my craziness and post a picture of thi "where the chip stays" of the SDCard reader version of this phone??
Thanks a lot!!
Click to expand...
Click to collapse
Well ... I like crazy things. But is impossible just to add a chip.
The thread itself is for other things. I don't want more reminders from the moderators. So please use the general section next time.
Thank you in advance.
Here is the complete partition list for 8Gb single sim variant:
Code:
Disk /dev/block/mmcblk0: 30535680 sectors, 14.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20
Partition table holds up to 40 entries
First usable sector is 34, last usable sector is 30535646
Partitions will be aligned on 2-sector boundaries
Total free space is 256464 sectors (125.2 MiB)
Number Start (sector) End (sector) Size Code Name
1 131072 262143 64.0 MiB 0700 modem
2 262144 265215 1.5 MiB FFFF tunning
3 265216 267263 1024.0 KiB FFFF traceability
4 267264 267265 1024 bytes FFFF fsc
5 267266 267281 8.0 KiB FFFF ssd
6 267282 268305 512.0 KiB FFFF sbl1
7 268306 269329 512.0 KiB 0700 sbl1bak
8 269330 270353 512.0 KiB FFFF rpm
9 270354 271377 512.0 KiB 0700 rpmbak
10 271378 272401 512.0 KiB FFFF tz
11 272402 273425 512.0 KiB 0700 tzbak
12 273426 274449 512.0 KiB FFFF hyp
13 274450 275473 512.0 KiB 0700 hypbak
14 275474 278545 1.5 MiB FFFF modemst1
15 278546 281617 1.5 MiB FFFF modemst2
16 281618 283665 1024.0 KiB FFFF simlock
17 283666 286737 1.5 MiB FFFF efsdata
18 393216 393279 32.0 KiB FFFF DDR
19 393280 396351 1.5 MiB FFFF fsg
20 396352 396383 16.0 KiB FFFF sec
21 396384 398431 1024.0 KiB FFFF aboot
22 398432 400479 1024.0 KiB 0700 abootbak
23 400480 466015 32.0 MiB FFFF boot
24 466016 531551 32.0 MiB FFFF recovery
25 531552 4306427 1.8 GiB FFFF system
26 4325376 4390911 32.0 MiB FFFF persist
27 4390912 4407295 8.0 MiB FFFF splash
28 4407296 4448255 20.0 MiB 0700 tctpersist
29 4448256 4468735 10.0 MiB 0700 hdcp
30 4468736 4468751 8.0 KiB FFFF fota
31 4468752 4993039 256.0 MiB FFFF cache
32 4993040 4995087 1024.0 KiB FFFF misc
33 4995088 4996111 512.0 KiB FFFF keystore
34 4996112 4996175 32.0 KiB FFFF config
35 4996176 4996303 64.0 KiB FFFF oem
36 4996304 5000399 2.0 MiB FFFF FactoryRP
37 5000400 15269853 4.9 GiB FFFF userdata
38 15269854 30535646 7.3 GiB 0700 userdatabak
Maybe someone can post the list for 16Gb dual sim variant?
Ok, I bit the bullet and resized the "userdata" partition. Only that I did not create the smaller #38 partition, I did not see any reason to do it (if any update tries to store something inside it, will fail anyway; this partition does not look special, all *bak partitions have the same GUID). Plus there isn't any "userdatabak" partition on 16Gb models. Instead I made partition #37 up to the latest available sector (30535646). The phone is working just fine.
rioachim said:
Ok, I bit the bullet and resized the "userdata" partition. Only that I did not create the smaller #38 partition, I did not see any reason to do it (if any update tries to store something inside it, will fail anyway; this partition does not look special, all *bak partitionshave the same GUID). Plus there isn't any "userdatabak" partition on 16Gb models. Instead I made partition #37 up to the latest available sector (30535646). The phone is working just fine.
Click to expand...
Click to collapse
OK. But don't be fulled by the GUID. Most of the bak partitions contain data which is equivalent to the data in the primary ones (aboot, rpm, sbl1 etc.). The data is patched in both partitions with the same patch during an upgrade.
Script to repartition "internal memory"
Hello petrov.0, all
Is it possible to create a shell for all thoses commands ?
In this case if partitions are lost (upgrade, patchs....) we could apply it easily.
And nice discovered.
Regards
Google99
google99 said:
Hello petrov.0, all
Is it possible to create a shell for all thoses commands ?
In this case if partitions are lost (upgrade, patchs....) we could apply it easily.
And nice discovered.
Regards
Google99
Click to expand...
Click to collapse
No it is not:
Code:
GPT fdisk (aka gdisk) is a text-mode menu-driven program for creation and manipulation of partition tables.
Hi petrov.0 great news and thanks.
Just a doubt, a friend of mine will receive Idol 3 4,7" 8 GB tomorrow, he can made OTA update (that I think are available for security reasons as "stagefright" and another I know Alcatel get users a way to set SD as main memory) and then use your guide to expand memory t 16 Gb or for this operation is better been in a fresh unchained device not updated?
Because in this second option device become 16 Gb Rom but will be afected by stagefright and for the rest of his life
Thanks!
Romagnolo1973 said:
Hi petrov.0 great news and thanks.
Just a doubt, a friend of mine will receive Idol 3 4,7" 8 GB tomorrow, he can made OTA update (that I think are available for security reasons as "stagefright" and another I know Alcatel get users a way to set SD as main memory) and then use your guide to expand memory t 16 Gb or for this operation is better been in a fresh unchained device not updated?
Because in this second option device become 16 Gb Rom but will be afected by stagefright and for the rest of his life
Thanks!
Click to expand...
Click to collapse
It shouldn't be updated. The official updates for 6039 removes the fastboot commands therefore you will not be able to do the repartitioning nor to root the device. Give me the update file and will modify it in a way which will preserve the commands (there is a risk for a broken device after it though ... I wish to try such modification first on my phone, but unfortunately I still do not have official update for it with which to test).
petrov.0 said:
It shouldn't be updated. The official updates for 6039 removes the fastboot commands therefore you will not be able to do the repartitioning nor to root the device. Give me the update file and will modify it in a way which will preserve the commands (there is a risk for a broken device after it though ... I wish to try such modification first on my phone, but unfortunately I still do not have official update for it with which to test).
Click to expand...
Click to collapse
By the way is there any hope (other than getting Alcatel to push an update to put fastboot commands back in, cause is anyone that optimistic?) for people who have indeed updated to recover those?
Sent from my 6039Y using Tapatalk
Rorshan said:
By the way is there any hope (other than getting Alcatel to push an update to put fastboot commands back in, cause is anyone that optimistic?) for people who have indeed updated to recover those?
Sent from my 6039Y using Tapatalk
Click to expand...
Click to collapse
If you find a way to root the device after the update then may be there is a hope.
petrov.0 said:
It shouldn't be updated. The official updates for 6039 removes the fastboot commands therefore you will not be able to do the repartitioning nor to root the device. Give me the update file and will modify it in a way which will preserve the commands (there is a risk for a broken device after it though ... I wish to try such modification first on my phone, but unfortunately I still do not have official update for it with which to test).
Click to expand...
Click to collapse
Understood the problem is new update that remove some action from fastboot needed for repartioning. Idol 3 was received and he resize rom from 8 to 16 with no issue with your guide, after that he made OTA update and they are working perfectly, no issue with the new partitioning size and device is working well.
Romagnolo1973 said:
Understood the problem is new update that remove some action from fastboot needed for repartioning. Idol 3 was received and he resize rom from 8 to 16 with no issue with your guide, after that he made OTA update and they are working perfectly, no issue with the new partitioning size and device is working well.
Click to expand...
Click to collapse
Not some but all fastboot commands are removed. Glad to see that you have made it though. The OTA update however is a mistake. Now you can't get root access nor the fastboot commands are available.
petrov.0 said:
Not some but all fastboot commands are removed. Glad to see that you have made it though. The OTA update however is a mistake. Now you can't get root access nor the fastboot commands are available.
Click to expand...
Click to collapse
Yes, it was risky but probably he is not interested in root, I only inform you that new partitioning with OTA is still there, I think is a goodnews and a base to start, now the perfect situation is if Alcatel made a future OTA as soon as possible with fastboot perfectly working.
Romagnolo1973 said:
Yes, it was risky but probably he is not interested in root, I only inform you that new partitioning with OTA is still there, I think is a goodnews and a base to start, now the perfect situation is if Alcatel made a future OTA as soon as possible with fastboot perfectly working.
Click to expand...
Click to collapse
There is nothing wrong with the fastboot commands prior the update. I have doubts that they will be returned. Thanks for the info though (despite that I already know this by looking in the update files). I can't live without root access however therefore there is no option to loose it.
I'm kinda confused here. Are all the steps done from a terminal on the computer or is some of that to be typed inside the TWRP terminal? Because as soon as I boot TWRP with gdisk I get a device not found from typing adb shell. I'm pretty sure I have all the drivers mentioned in the linked post (and even more too). Any kind soul to explain how stupid I am being (because I know that's the solution in the end, I'm a fool)
Rorshan said:
I'm kinda confused here. Are all the steps done from a terminal on the computer or is some of that to be typed inside the TWRP terminal? Because as soon as I boot TWRP with gdisk I get a device not found from typing adb shell. I'm pretty sure I have all the drivers mentioned in the linked post (and even more too). Any kind soul to explain how stupid I am being (because I know that's the solution in the end, I'm a fool)
Click to expand...
Click to collapse
Everything after adb shell must be done directly on the device. The VID & PID of the device are different in the recovery and you don't have the necessary drivers. Try to install the drivers mentioned in the first post (- The Windows users probably need the drivers from this post, for access to the device in recovery mode).

GUIDE: How to repartition for vendor and how to use GSIs

Guide to repartition your LG V30 to have a vendor partition
This guide is for people who are willing to repartition their V30 (Tested so far on my H930).
It will make your system partition smaller by 512MB, and create a vendor partition instead.
You will still have enough space for (full) stock ROMs too (they just ignore the new partition then)
Code:
#include "std_disclaimer.h"
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/
What you need:
The scripts attached in the zip file
TWRP
A PC with working ADB (I doubt you wanna write everything in the TWRP command line)
Oreo firmware recommended (for LOS and GSIs)
Bravery
(should be quite safe though, as I did it myself, and know other people who did it)
Steps
Read this carefully before you execute it, twice! Make sure you understand every step. Learn it to the point of when i wake you up in the middle of the night, and ask you questions about it, you can answer instantly.
Boot into TWRP!!!
Make a backup of EVERYTHING on your phone (system, boot, recovery, data and so on)
Code:
The script will format system again, its important to backup!
Copy the contents of the .zip file to your phone
Open a command line/terminal on your PC (wherever you have access to ADB)
Connect your Phone to your PC
Everything now in command line/terminal
adb shell
cd /path/to/the/script/folder
Code:
e.g.
cd /external_sd/repartition/
./backup_gpt.sh
Code:
This will create a backup of your current gpt table on /external_sd/GPT_orig.bin
Code:
Todo this manually execute:
sgdisk /dev/block/sda --b=/path/to/GPT_orig.bin
./make_vendor.sh
Code:
Follow instructions on screen if you really wanna do this!
To apply the changes, remove the --pretend from the sgdisk commands! Otherwise it will just pretend to apply the changes (so you can check if it would fail or not)
(not an automatic script incase something goes wrong)
Reboot into recovery again
Restore your previous backup
How to revert the changes?
Do everything till step 7
./restore_gpt.sh
Code:
This will take the backup of your gpt table on /external_sd/GPT_orig.bin
Code:
Todo this manually execute:
sgdisk --load-backup=/path/to/GPT_orig.bin /dev/block/sda
Wipe system again
Flash a .kdz (Instructions case be found on XDA)
How to use a GSI (Generic System Image)
Make a backup of EVERYTHING on your phone (system, boot, recovery, data and so on)
Flash treble enabled lineage build: link
Wipe data (if it isnt)
Reboot into bootloader
in commandline/terminal:
fastboot flash system <name_of_gsi>.img
OPTIONAL:
fastboot boot <twrp>.img
Code:
fastboot doesnt provide a way to reboot to recovery directly, you can also optionally do the button dance
flash magisk/gapps
fastboot reboot
Thanks for the original script from here
what happens if it is partitioned and we flash a kdz using lg up (without reverting the partitions)?
iRS_ said:
what happens if it is partitioned and we flash a kdz using lg up (without reverting the partitions)?
Click to expand...
Click to collapse
I believe that it just changes the gpt to its original state, so if everything goes right, nothing will happen except you losing the vendor partition
Will this allow my US998 to be supported by the treble project?
AutinDroid said:
I believe that it just changes the gpt to its original state, so if everything goes right, nothing will happen except you losing the vendor partition
Click to expand...
Click to collapse
Yep, it should do that. The kdz rewrites your GPT, atleast it should. Doesnt contain that for nothing i suppose?
liushangrong said:
Will this allow my US998 to be supported by the treble project?
Click to expand...
Click to collapse
It should work also on your US998 to create a new partition. The treblelized ROM isnt yet built for the US998 though. Dont have any testers that could have tried it out on the US998.
SGCMarkus said:
Yep, it should do that. The kdz rewrites your GPT, atleast it should. Doesnt contain that for nothing i suppose?.
Click to expand...
Click to collapse
so if i make the changes i can safely flash a kdz and revert everything back to stock?
iRS_ said:
so if i make the changes i can safely flash a kdz and revert everything back to stock?
Click to expand...
Click to collapse
Should do the trick
Or, less hassle, you restore the GPT that you should backup before anyway (see guide) ^^
That also works.
i'm trying to repartition my v30+ (h930g).
i've succesfull backup my gpt, but i've problem when trying to format vendor. i have the following error:
/external_sd/repartition # make_ext4fs /dev/block/sda23
filesystem size too small
Click to expand...
Click to collapse
here is complete output:
/external_sd # cd repartition/
/external_sd/repartition #
/external_sd/repartition #
/external_sd/repartition # ./make_vendor.sh
/vendor missing
*********Resize /system to 1505792 = 1585541 - 79750 + 1 (inclusize) = 1505792
To really repartition, copy the following commands, and execute them
e2fsck -f /dev/block/bootdevice/by-name/system
resize2fs /dev/block/bootdevice/by-name/system 1505792
Setting name!
partNum is 17
REALLY setting name!
Setting name!
partNum is 22
REALLY setting name!
Disk /dev/block/sda: 31137792 sectors, 118.8 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 31137786
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)
Number Start (sector) End (sector) Size Code Name
1 6 12293 48.0 MiB FFFF laf
2 12294 24581 48.0 MiB FFFF lafbak
3 24582 32773 32.0 MiB FFFF mpt
4 32774 35333 10.0 MiB FFFF drm
5 35334 36869 6.0 MiB FFFF sns
6 36870 37125 1024.0 KiB FFFF misc
7 37126 45317 32.0 MiB FFFF ftm
8 45318 62213 66.0 MiB FFFF factory
9 62214 62341 512.0 KiB FFFF encrypt
10 62342 62469 512.0 KiB FFFF eksst
11 62470 62597 512.0 KiB FFFF rct
12 62598 62725 512.0 KiB FFFF ssd
13 62726 62853 512.0 KiB FFFF keystore
14 62854 71045 32.0 MiB FFFF persist
15 71046 73093 8.0 MiB FFFF srtc
16 73094 79237 24.0 MiB FFFF qni
17 79238 79749 2.0 MiB FFFF pstore
18 79750 1585541 5.7 GiB 8300 system
19 1716614 1847685 512.0 MiB FFFF cache
20 1847686 1935749 344.0 MiB 0700 OP
21 1935750 31137785 111.4 GiB FFFF userdata
22 31137786 31137786 4.0 KiB FFFF grow
23 1585542 1716613 512.0 MiB 8300 vendor
sgdisk --pretend --delete=18 --new=18:79750:1585541 --change-name=18:system --new=23:1585542:1716613 --change-name=23:vendor --print /dev/block/sda
This will format system and vendor again, so it can be used
make_ext4fs /dev/block/sda18
make_ext4fs /dev/block/sda23
/external_sd/repartition # e2fsck -f /dev/block/bootdevice/by-name/system
e2fsck 1.43.3 (04-Sep-2016)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
system: 9726/403200 files (0.0% non-contiguous), 1229698/1611326 blocks
/external_sd/repartition # resize2fs /dev/block/bootdevice/by-name/system 1505792
resize2fs 1.43.3 (04-Sep-2016)
Resizing the filesystem on /dev/block/bootdevice/by-name/system to 1505792 (4k) blocks.
The filesystem on /dev/block/bootdevice/by-name/system is now 1505792 (4k) blocks long.
/external_sd/repartition # sgdisk --pretend --delete=18 --new=18:79750:1585541 --change-name=18:system --new=23:1585542:1716613 --change-name=23:vendor --print /dev/block/sda
Setting name!
partNum is 17
REALLY setting name!
Setting name!
partNum is 22
REALLY setting name!
Disk /dev/block/sda: 31137792 sectors, 118.8 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): 98101B32-BBE2-4BF2-A06E-2BB33D000C20
Partition table holds up to 32 entries
First usable sector is 6, last usable sector is 31137786
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)
Number Start (sector) End (sector) Size Code Name
1 6 12293 48.0 MiB FFFF laf
2 12294 24581 48.0 MiB FFFF lafbak
3 24582 32773 32.0 MiB FFFF mpt
4 32774 35333 10.0 MiB FFFF drm
5 35334 36869 6.0 MiB FFFF sns
6 36870 37125 1024.0 KiB FFFF misc
7 37126 45317 32.0 MiB FFFF ftm
8 45318 62213 66.0 MiB FFFF factory
9 62214 62341 512.0 KiB FFFF encrypt
10 62342 62469 512.0 KiB FFFF eksst
11 62470 62597 512.0 KiB FFFF rct
12 62598 62725 512.0 KiB FFFF ssd
13 62726 62853 512.0 KiB FFFF keystore
14 62854 71045 32.0 MiB FFFF persist
15 71046 73093 8.0 MiB FFFF srtc
16 73094 79237 24.0 MiB FFFF qni
17 79238 79749 2.0 MiB FFFF pstore
18 79750 1585541 5.7 GiB 8300 system
19 1716614 1847685 512.0 MiB FFFF cache
20 1847686 1935749 344.0 MiB 0700 OP
21 1935750 31137785 111.4 GiB FFFF userdata
22 31137786 31137786 4.0 KiB FFFF grow
23 1585542 1716613 512.0 MiB 8300 vendor
/external_sd/repartition # make_ext4fs /dev/block/sda18
Creating filesystem with parameters:
Size: 6704594944
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 25576
Label:
Blocks: 1636864
Block groups: 50
Reserved block group size: 399
Created filesystem with 11/409600 inodes and 54888/1636864 blocks
/external_sd/repartition #
/external_sd/repartition #
/external_sd/repartition # make_ext4fs /dev/block/sda23
filesystem size too small
Click to expand...
Click to collapse
what i'm wrong?
Having the same issue here
HD1999 said:
Having the same issue here
Click to expand...
Click to collapse
do you own a h930(64gb) or h930g(128gb)?
I own a H930
ah ok, so this happen on 64gb version too
Hmm...
Ok, forgot to add a message to the script ?
you have to remove the --pretend from the commands, otherwise it will just do like it does it, without actually doing it (to see if everything will work the way it should before actually applying the changes)
sorry about that
SGCMarkus said:
Hmm...
Ok, forgot to add a message to the script
you have to remove the --pretend from the commands, otherwise it will just do like it does it, without actually doing it (to see if everything will work the way it should before actually applying the changes)
sorry about that
Click to expand...
Click to collapse
EDIT: i reboted into recovery again and i was able to format /vendor. is normal that i can see vendor partition in backup section of twrp?
now i'm going to flash yoru los
hi markus, i figure it reading the script, but same error here!
this is the comannd ì execute after run ./make_vendor.sh:
e2fsck -f /dev/block/bootdevice/by-name/system
resize2fs /dev/block/bootdevice/by-name/system 1505792
sgdisk --delete=18 --new=18:79750:1585541 --change-name=18:system --new=23:1585542:1716613 --change-name=23:vendor --print /dev/block/sda
make_ext4fs /dev/block/sda18
make_ext4fs /dev/block/sda23
i ran the script and the command above ehn the phone are in twrp(assuming is right to do this!)
okaiuz said:
EDIT: i reboted into recovery again and i was able to format /vendor. is normal that i can see vendor partition in backup section of twrp?
now i'm going to flash yoru los
Click to expand...
Click to collapse
Will also add this, to reboot into recovery again then
Glad it worked. And ehhm, i dont think its normal that TWRP sees it for backups? But if it does, no need for a new TWRP (tbh, during all my testings, i didnt check this, or didnt look if vendor is there or not)
i restore the original gpt and i start from ascratch.
iin restore_gpt.sh you have to change "external_SD" to "external_sd"
don't think need to rebbot, after restoring original gpt, and execute above command, formatting /vendor work on first run!
another problem...i'm trying to flash your los(non treblelized) but i receive:
Updater process ended with ERROR: 7
I:Install took 0 second(s).
Error installing zip file '/sdcard/Download/lineage-15.1-20180516-UNOFFICIAL-h930.zip'
Updating partition details...
Failed to mount '/system' (Invalid argument)
full log attached
okaiuz said:
i restore the original gpt and i start from ascratch.
iin restore_gpt.sh you have to change "external_SD" to "external_sd"
don't think need to rebbot, after restoring original gpt, and execute above command, formatting /vendor work on first run!
another problem...i'm trying to flash your los(non treblelized) but i receive:
Updater process ended with ERROR: 7
I:Install took 0 second(s).
Error installing zip file '/sdcard/Download/lineage-15.1-20180516-UNOFFICIAL-h930.zip'
Updating partition details...
Failed to mount '/system' (Invalid argument)
full log attached
Click to expand...
Click to collapse
EDIT: maybe related to content of META-INF/com/google/android/updater-script file?
i see this :
assert(getprop("ro.product.device") == "v30" || getprop("ro.build.product") == "v30" ||
getprop("ro.product.device") == "joan" || getprop("ro.build.product") == "joan" ||
getprop("ro.product.device") == "h930" || getprop("ro.build.product") == "h930" || abort("E3004: This package is for device: v30,joan,h930; this device is " +
Click to expand...
Click to collapse
my device is h930g, same as h930 but with 128gb of rom (also called v30+). i check with adb and my device show this values:
[ro.build.product]: [joan]
[ro.product.device]: [joan]
okaiuz said:
i restore the original gpt and i start from ascratch.
iin restore_gpt.sh you have to change "external_SD" to "external_sd"
don't think need to rebbot, after restoring original gpt, and execute above command, formatting /vendor work on first run!
another problem...i'm trying to flash your los(non treblelized) but i receive:
Updater process ended with ERROR: 7
I:Install took 0 second(s).
Error installing zip file '/sdcard/Download/lineage-15.1-20180516-UNOFFICIAL-h930.zip'
Updating partition details...
Failed to mount '/system' (Invalid argument)
full log attached
Click to expand...
Click to collapse
Seems like you need to reboot inbetween, or try to format /system before flashing?
I dont encounter that problem :/
SGCMarkus said:
Seems like you need to reboot inbetween, or try to format /system before flashing?
I dont encounter that problem :/
Click to expand...
Click to collapse
i've made several test on it...wiping system data cache & art, reflash your recovery,format system in recovery & via adb..
The only thoing i haven't tested is to flash full kdz and then repartition.
i don't know if this can be useful for debugging,but when i've switched to oreo i don't flash full kdz, but the twrp flashable rom found on v30 section of xda
okaiuz said:
i've made several test on it...wiping system data cache & art, reflash your recovery,format system in recovery & via adb..
The only thoing i haven't tested is to flash full kdz and then repartition.
i don't know if this can be useful for debugging,but when i've switched to oreo i don't flash full kdz, but the twrp flashable rom found on v30 section of xda
Click to expand...
Click to collapse
Hm... that shouldnt matter actually. Its a weird behaviour though you have there. Can you "tick" system in the mount options of TWRP? if no, send me a log of that too. This seems really weird to me.

[GUIDE] [DANGEROUS] Resize system partition

WARNING​
Code:
This process is extremely dangerous. You may brick your device.
Do it only if you know what you are doing!
I am not responsible of bricked devices or dead sdcards.
Hello guys,
I've decided to write this guide since this seems to be the only way to resize system partition to install larger GSIs.
Before starting remember to always make a backup since you will loose all your data.
Also DO NOT DO a simple copy-paste compare with yours first and if you have any doubts write in the comments before enter the doubtful command. Prevention is better than cure!!
This process has been tested on my own device but it has not been tested restoring stock firmware.
(You can also join the telegram group to ask for help https://t.me/MotorolaOneAction)
Requirements​
Latest TWRP downloaded (to be booted through fastboot later)
Parted arm64 static binary (attached below)
Latest fastboot and ADB commands installed
Patience
Process​
Boot to TWRP from fastboot
Run the following commands:
Code:
adb push /path/to/parted /sbin/parted
adb shell
chmod 777 /sbin/parted
parted /dev/block/sda
p free
Now parted will list your partition table which should be like this:
{
"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"
}
Save the output of the command above (this is very important to restore original partition table if you will run into issues in the next parts)
Now with extreme attention type
Code:
rm partition_number
replacing partition_number with the number of the partition following the reverse order until you reach system_b partition removing it too . In my case I'll type:
Code:
rm 42
rm 41
rm 40
rm 39
Once you removed these partition it's time to recreate them following the original order but increasing the target partition size, in our case system_b. Type
Code:
mkpart name fs_type start end
replacing name with the original partition name (refer to the command output you saved at point 5), fs_type with original file system type, start with the end value in MB of the previous partition, and end with start + size, where size will be the size of the target partition (size is the original size of the partition except for system_b which I've decided to change to 4221MB, 1000MB larger than original one). If it says that the partition isn't aligned, type Ignore. In my case I'll type:
Code:
mkpart system_b ext4 5630MB 9851MB
mkpart oem_a ext2 9851MB 9918.1MB
mkpart oem_b ext2 9918.1MB 9985.3MB
mkpart userdata ext4 9985.3MB 128GB
Now restore the partition flags typing
Code:
set partition_number msftdata on
replacing partition_number with the number of the partition. In my case I'll type:
Code:
set 39 msftdata on
set 40 msftdata on
set 41 msftdata on
set 42 msftdata on
Now type again
Code:
p free
and compare the output with the original table saved before, they should be quite identical.
Type:
Code:
quit
exit
Reboot to bootloader and boot again into TWRP
If in the logs you see lot of red lines saying it could not mount oem partition and userdata partition don't panic, it is normal since they have not been formatted yet (they are registered into fstab with a different file system type). Type:
Code:
adb shell
mkfs.fs_type /dev/block/sdapartition_number
replacing fs_type with original file system type, partition_number with the number of the partition. In my case I'll type:
Code:
adb shell
mkfs.ext4 /dev/block/sda39
mkfs.ext2 /dev/block/sda40
mkfs.ext2 /dev/block/sda41
mkfs.f2fs /dev/block/sda42
Now reboot to bootloader and again into TWRP. Logs now should be free of red lines and you should be able to mount all partitions again.
You have done it!! Now you are able to flash larger GSI (I suggest you doing it from TWRP since fastboot may have some problem recognizing the resized partition size, also remember to change the active slot to the resized one, in my case the slot b)
Reserved
Why this?
GSI running like Havoc, Dotos...
Is this for running Android 12?
Vanilla GSIs will work without this. But larger GSIs that include Gapps will not because they are larger than system partition (like Pixel Experience, dotOS with Gapps, etc.). You can still flash vanilla build and Gapps zip of course to avoid doing this.
Regarding Android 12 I have not tried it yet.
please someone port postmarketos to this device, kane has a lot of potential
edit: i'm talking about pmos, because this resizing process has sense only for postmarket, if any other roms are bigger than system part, than they are just bloated worthless ****s.
sorry to bother you.
i found your post after long time of searching. I'm noob for installing GSI,to do so i need to resize system partition.but i have zero idea about resizing and also seems like its very critical,and if i made any mistake to resizing it i may have to lost my phone forever.
I'm here to make a request to you that if you help me out to resize partition by a easiest way .i hope you won't reject me. I'm really fed up about resizing.here is my device details
phone: mi 8 pro
codename: equuleus
Rom : 128 GB
Default system partition size : 2.74GB
Hope you will help me
shahrair said:
sorry to bother you.
i found your post after long time of searching. I'm noob for installing GSI,to do so i need to resize system partition.but i have zero idea about resizing and also seems like its very critical,and if i made any mistake to resizing it i may have to lost my phone forever.
I'm here to make a request to you that if you help me out to resize partition by a easiest way .i hope you won't reject me. I'm really fed up about resizing.here is my device details
phone: mi 8 pro
codename: equuleus
Rom : 128 GB
Default system partition size : 2.74GB
Hope you will help me
Click to expand...
Click to collapse
what did you do wrong?
my device does not have /sda, any solution?
Sammm77 said:
my device does not have /sda, any solution?
Click to expand...
Click to collapse
it might be mmcblk0
lol.mam said:
it might be mmcblk0
Click to expand...
Click to collapse
Yep, but partitions like /system /vendor /system_ext and product do not appear, is it because of super partition?
Some phones also need system_a resized. I couldn't install a bigger GSI on One Action/troika and resizing system_a fixed it.
as partições ( parted /dev/block/mmcblk0 )e (parted /dev/block/sda) não contém partições, mas as
(parted /dev/block/sdb) (parted /dev/block/sde) (parted /dev/block/sdf) contém as partiçoes. posso trabalhar nelas??
SDF (parted) parted /dev/block/sdf
Number Start End Size File system Name Flags
1 131kB 655kB 524kB aop_b
2 655kB 4850kB 4194kB tz_b
3 4850kB 5374kB 524kB hyp_b
4 5374kB 5505kB 131kB storsec_b
5 5505kB 5636kB 131kB devcfg_b
6 5636kB 6160kB 524kB keymaster_b
7 6160kB 6685kB 524kB cmnlib_b
8 6685kB 7209kB 524kB cmnlib64_b
9 7209kB 7471kB 262kB prov_b
10 7471kB 8520kB 1049kB abl_b
11 8520kB 8602kB 81.9kB qupfw_b
12 8651kB 10.7MB 2097kB uefisecapp_b
13 10.7MB 10.8MB 32.8kB multiimgoem_b
14 10.8MB 10.8MB 32.8kB multiimgqti_b
15 10.8MB 10.9MB 65.5kB vbmeta_b
16 10.9MB 36.0MB 25.2MB ext2 fsg_b
17 36.0MB 183MB 147MB ext2 modem_b
18 183MB 216MB 33.6MB ext4 dsp_b
19 216MB 217MB 1049kB ext2 bluetooth_b
20 217MB 251MB 33.6MB logo_b
21 251MB 318MB 67.1MB boot_b
22 318MB 343MB 25.2MB dtbo_b
23 343MB 1149MB 805MB ext2 vendor_b
24 1149MB 4638MB 3490MB ext2 system_b
25 4638MB 4949MB 310MB ext2 oem_b
SDB parted /dev/block/sdb
Number Start End Size File system Name Flags
1 131kB 139kB 8192B ssd
2 262kB 33.8MB 33.6MB ext4 persist
3 33.8MB 42.2MB 8389kB ext4 prodpersist
4 42.2MB 43.3MB 1049kB misc
5 43.3MB 43.8MB 524kB keystore
6 43.8MB 44.3MB 524kB frp
7 44.3MB 44.8MB 524kB utags
8 44.8MB 45.4MB 524kB utagsBackup
9 45.4MB 45.5MB 131kB cid
10 45.5MB 62.3MB 16.8MB metadata
11 62.3MB 70.6MB 8389kB kpan
12 70.6MB 79.0MB 8389kB sp
13 79.0MB 95.8MB 16.8MB carrier
14 95.8MB 97.9MB 2097kB modemst1
15 97.9MB 100MB 2097kB modemst2
16 100MB 100MB 131kB fsc
17 100MB 100MB 32.8kB dhob
18 100MB 100MB 4096B devinfo
19 100MB 109MB 8389kB logfs
20 109MB 109MB 262kB apdp
21 109MB 117MB 8389kB spunvm
22 117MB 118MB 524kB uefivarstore
23 118MB 118GB 118GB userdata
SDE (parted) parted /dev/block/sde
Number Start End Size File system Name Flags
1 131kB 655kB 524kB aop_a
2 655kB 4850kB 4194kB tz_a
3 4850kB 5374kB 524kB hyp_a
4 5374kB 5505kB 131kB storsec_a
5 5505kB 5636kB 131kB devcfg_a
6 5636kB 6160kB 524kB keymaster_a
7 6160kB 6685kB 524kB cmnlib_a
8 6685kB 7209kB 524kB cmnlib64_a
9 7209kB 7471kB 262kB prov_a
10 7471kB 8520kB 1049kB abl_a
11 8520kB 8602kB 81.9kB qupfw_a
12 8651kB 10.7MB 2097kB uefisecapp_a
13 10.7MB 10.8MB 32.8kB multiimgoem_a
14 10.8MB 10.8MB 32.8kB multiimgqti_a
15 10.8MB 10.9MB 65.5kB vbmeta_a
16 10.9MB 36.0MB 25.2MB ext2 fsg_a
17 36.0MB 183MB 147MB ext2 modem_a msftdata
18 183MB 216MB 33.6MB ext4 dsp_a
19 216MB 217MB 1049kB ext2 bluetooth_a
20 217MB 251MB 33.6MB logo_a
21 251MB 318MB 67.1MB boot_a
22 318MB 343MB 25.2MB dtbo_a
23 343MB 1149MB 805MB ext2 vendor_a
24 1149MB 4638MB 3490MB ext2 system_a
25 4638MB 4949MB 310MB ext2 oem_a
My device: SM-A528B
Hello, I need to increase the partition for GSI. Could you please help me? Which section should I enlarge and what commands should I enter? (I tried to do everything according to the instructions, but I had questions and nothing happened)
1. I put the file (parted) in the root of the disk (C) and wrote (adb push C:/parted /sbin/ parted) is that correct?
2. What should I enter in (fs_type), (msftdata) if I have spaces here?
3. After the second input (p free), I lost the names of the modified sections.
4. The red lines in TWRP did not disappear anywhere and I could not boot into the system.
Sammm77 said:
Yep, but partitions like /system /vendor /system_ext and product do not appear, is it because of super partition?
Click to expand...
Click to collapse
Were you able to figure out how to expand the system partition with a super partition?
For fastboot to take the partition names use the following parted command:
Code:
name <partition-number> <partition-name>
On some devices this helps a lot, consider adding it to the main thread ^^
Some devices also use /dev/block/mmcblk0 instead of /dev/block/sda
Hi, how can i add partition like product and vbmeta, tried to add using "mkpart PRODUCT ext4 start end" then "mkpart VBMETA space start end" it added but cant flash using twrp, tried on fastboot "Fastboot flash product product.img" then same with vbmeta. but nothing works, zip files cant mount those. Please help

How To Guide Resize internal storage on Xiaomi Pad 5 (nabu) and install PostmarketOS Preview

!!!!!DISCLAIMER!!!!!! --- below info is provided as is without any warranty, do it on your own risk
!!!BACKUP!!! !!!BACKUP!!! !!!BACKUP!!!
This procedure alter your userdata partition and you will lose anything if you do not do a backup.
_______________________________
Donate a coffee to support development:
Donate via PayPal to serdeliuk
Please carefully read all steps twice and be sure you understand them, the last part explains why you may want to have some free/unused space in the end.
0. Your device should be unlocked with Xiaomi
1. Developer options should be enabled
2. Check your MIUI version and download a stock image to have at hand all the original images in case you may need them.
For example is easy to forget to switch the slot a/b and write the wrong slot and break your device boot to android.
3. Reboot to OrangeFOX
- Download OrangeFOX image, please read this thread [UNOFFICIAL] Xiaomi Pad 5 nabu OrangeFox/TWRP recovery
- adb reboot bootloader
- fastboot boot xiaomi-nabu-orangefox.img
- adb shell
- review your partitions: ls -la /dev/block/bootdevice/by-name/
- we are interested in userdata partition location, in the below output we can see that is on /dev/block/sda device and it is the 31th partition on that device.
Code:
sh-5.0# ls -l /dev/block/bootdevice/by-name/ | grep userdata
lrwxrwxrwx 1 root root 16 1970-04-30 14:11 userdata -> /dev/block/sda31
4. Use parted against the /dev/block/sda device and print some info about partitions
Code:
sh-5.0# parted /dev/block/sda
GNU Parted 3.3
Using /dev/block/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
At the parted prompt, type print to see partitions on /dev/block/sda
Code:
(parted) print
print
Model: SAMSUNG KLUDG4UHDC-B0E1 (scsi)
Disk /dev/block/sda: 126GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 24.6kB 32.8kB 8192B switch
2 32.8kB 65.5kB 32.8kB ssd
3 65.5kB 98.3kB 32.8kB dbg
4 98.3kB 131kB 32.8kB bk01
5 131kB 262kB 131kB bk02
6 262kB 524kB 262kB bk03
7 524kB 1049kB 524kB bk04
8 1049kB 1573kB 524kB keystore
9 1573kB 2097kB 524kB frp
10 2097kB 4194kB 2097kB countrycode
11 4194kB 8389kB 4194kB misc
12 8389kB 12.6MB 4194kB vm-data
13 12.6MB 16.8MB 4194kB bk06
14 16.8MB 25.2MB 8389kB logfs
15 25.2MB 33.6MB 8389kB ffu
16 33.6MB 50.3MB 16.8MB oops
17 50.3MB 67.1MB 16.8MB devinfo
18 67.1MB 83.9MB 16.8MB oem_misc1
19 83.9MB 101MB 16.8MB ext4 metadata
20 101MB 134MB 32.9MB bk08
21 134MB 168MB 34.2MB splash
22 168MB 201MB 33.6MB bk09
23 201MB 9328MB 9127MB super
24 9328MB 9328MB 131kB vbmeta_system_a
25 9328MB 9328MB 131kB vbmeta_system_b
26 9328MB 9396MB 67.1MB logdump
27 9396MB 9530MB 134MB minidump
28 9530MB 9664MB 134MB rawdump
29 9664MB 10.7GB 1074MB ext4 cust
30 10.7GB 10.9GB 134MB ext4 rescue
31 10.9GB 126GB 115GB userdata
5. Remove userdata partition, double check the partition's number THIS COMMAND DO NOT ASK FOR CONFIRMATION, BE SURE YOU DID A BACKUP OF YOUR DATA
Code:
(parted) rm 31
rm 31
And check the result
Code:
(parted) print
print
Model: SAMSUNG KLUDG4UHDC-B0E1 (scsi)
Disk /dev/block/sda: 126GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 24.6kB 32.8kB 8192B switch
2 32.8kB 65.5kB 32.8kB ssd
3 65.5kB 98.3kB 32.8kB dbg
4 98.3kB 131kB 32.8kB bk01
5 131kB 262kB 131kB bk02
6 262kB 524kB 262kB bk03
7 524kB 1049kB 524kB bk04
8 1049kB 1573kB 524kB keystore
9 1573kB 2097kB 524kB frp
10 2097kB 4194kB 2097kB countrycode
11 4194kB 8389kB 4194kB misc
12 8389kB 12.6MB 4194kB vm-data
13 12.6MB 16.8MB 4194kB bk06
14 16.8MB 25.2MB 8389kB logfs
15 25.2MB 33.6MB 8389kB ffu
16 33.6MB 50.3MB 16.8MB oops
17 50.3MB 67.1MB 16.8MB devinfo
18 67.1MB 83.9MB 16.8MB oem_misc1
19 83.9MB 101MB 16.8MB ext4 metadata
20 101MB 134MB 32.9MB bk08
21 134MB 168MB 34.2MB splash
22 168MB 201MB 33.6MB bk09
23 201MB 9328MB 9127MB super
24 9328MB 9328MB 131kB vbmeta_system_a
25 9328MB 9328MB 131kB vbmeta_system_b
26 9328MB 9396MB 67.1MB logdump
27 9396MB 9530MB 134MB minidump
28 9530MB 9664MB 134MB rawdump
29 9664MB 10.7GB 1074MB ext4 cust
30 10.7GB 10.9GB 134MB ext4 rescue
6. Note the end of the last partition in the above list, 10.9GB, this number will be used as the start of the new userdata partition, followed by the end of the partition.
Let say that we want to make an approx 40GB userdata partititon using the following command:
NOTE, between userdata and 10.9GB are 3 spaces, one of them replace the partition type flag, it is important to use 3 spaces at this step.
Code:
(parted) mkpart userdata 10.9GB 50GB
7. Use print described at step 5 and see the result
Code:
(parted) print
Then exit/quit parted
Code:
(parted) quit
8. Reboot to Android and let the OS do the job fixing and formatting the userdata on the new size, will take a while to boot first time after resize, so grab a coffee, a beer, or else, note, it is important to keep the original partition name "userdata"
Code:
sh-5.0# reboot
9. Reboot to OrangeFOX again as described at step 3 and now create the PostmarketOS partition, I will name the partition as pmos:
print the actual partitions
Code:
(parted) print
Number Start End Size File system Name Flags
.....
31 10.9GB 50.0GB 39.1GB userdata
Use the last end as the start of the new partition and for end the desired extra size for your partition, let pretend we want a 20GB pmos partition as ext4 (minimum partition size is 4GB)
Code:
(parted) mkpart pmos ext4 50.0GB 70GB
The remaining free space, if any, can be used for future OSes, let say you want to have Windows and/or Ubuntu along your Android and PostmarketOS in the near future, think twice and partition wise your device and keep some free space if you think you will need it.
After each command you can check the free/available space with following command
Code:
(parted) print free
10. At this point your Android should be running well with the new userdata partition and you are ready to install the PostmarketOS nabu preview.
- Download preview images, please read this thread [INFO] PostmarketOS Linux boot on Xiaomi Pad 5 (nabu)
(NOTE THE IMAGES ARE NOT YET AVAILABLE I WILL UPDATE THE ABOVE POST IN THE NEXT FEW DAYS WHEN I AM DONE WITH THEM)
- Reboot to fastboot and check from which slot is your android booted
Code:
:~$ fastboot getvar current-slot
current-slot: a
finished. total time: 0.005s
Keep in mind that your current version of Android use slot A in above case, slot B is temporarily unused and we can take advantage to install our boot loader. Please note, if you update your Android version the new version will use the unused slot to install updates and our images will be lost, i am talking about 3 partitions involved to properly boot PostmarketOS, boot, vbmeta and dtbo partitions.
In order to flash and boot PostmarketOS you should change the active slot, because above the Android slot was A i am changing the slot to B
Code:
:~$ fastboot set_active b
Setting current slot to 'b'...
OKAY [ 0.046s]
finished. total time: 0.046s
11. Write PostmarketOS preview images.
Flash the new vbmeta with disabled verified boot, more info in PostmarketOS Wiki at Android_Verified_Boot_(AVB)
Code:
:~$ fastboot flash vbmeta_b vbmeta_disabled.img
Erase Android DTBO partition, we do not need it, but if present will be loaded and will prevent our boot
Code:
:~$ fastboot erase dtbo_b
Flash PostmarketOS boot.img
Code:
:~$ fastboot flash boot_b boot.img
Flash PostmarketOS image, please use the partition name you created for PostmarketOS at step 9, this process will takew a while, grab another beer
Code:
:~$ fastboot flash pmos xiaomi-nabu.img
Now you are ready to boot your PostmarketOS preview
Code:
:~$ fastboot reboot
You can switch from PostmarketOS to Android via changing active slots with fastboot, out there are some android/linux apps that can change the active slot while rebooting, you may need to search for them and test if they work.
The last step is to use the free space somehow, by creating one or more new partitions, in order to be able to do that you need to alter the GPT size limit, by default the limit is 32 and if you try to add a new partition you will get a similar error as the following one
Code:
(parted) mkpart WIN ntfs 50.5GB 126GB
mkpart WIN ntfs 50.5GB 126GB
Error: Too many primary partitions.
If you are on slot B to use PostmarketOS you need to switch to slot A to boot my OrangeFOX again:
Code:
:~$ fastboot set_active a
:~$ fastboot boot xiaomi-nabu-orangefox.img
To overcome the limit you will need to use the sgdisk tool, the following command should do the job:
Code:
sh-5.0# sgdisk -S 54 /dev/block/sda
Adjusting GPT size from 54 to 64 to fill the sector
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
sh-5.0#
Now you can use parted to create new partitions, up to 64.
Enjoy
Thanks @Vagelis1608 for reminding me to add the last part about increasing the GPT limit.
P.S.
This thread is about how to repartition your device and install PostmarketOS preview images, if you want to discuss about my PostmarketOS please use this thread [INFO] PostmarketOS Linux boot on Xiaomi Pad 5 (nabu)
I would recommend to mount the "extra space" that's left until you need it for something else.
Either for something non vital ( cache/dalvik-cache ? ) or, better yet, simple storage.
I will look into mounting it as a "virtual SD card".
But yeah, this is exciting and I can't wait for you to release the images.
Vagelis1608 said:
I would recommend to mount the "extra space" that's left until you need it for something else.
Either for something non vital ( cache/dalvik-cache ? ) or, better yet, simple storage.
I will look into mounting it as a "virtual SD card".
But yeah, this is exciting and I can't wait for you to release the images.
Click to expand...
Click to collapse
Indeed, this is a way to use it, but there cannot be added a new partition without some extra work to alter the GPT itself and increase the limit of 32 partitions.... an operation that require a few extra steps.
serdeliuk said:
Indeed, this is a way to use it, but there cannot be added a new partition without some extra work to alter the GPT itself and increase the limit of 32 partitions.... an operation that require a few extra steps.
Click to expand...
Click to collapse
Oh, yeah, I forgot about that.
But still, that will have to be done for a 3rd OS, as you mentioned
Though the user won't have to wipe their data again, which is good
Vagelis1608 said:
Oh, yeah, I forgot about that.
But still, that will have to be done for a 3rd OS, as you mentioned
Though the user won't have to wipe their data again, which is good
Click to expand...
Click to collapse
If the space is left unused/free as suggested there is actually an easy step to alter the GPT later and add one or more partitions without losing anything. I just omitted the step as i thought is not related to the scope of this HowTo.
My OrangeFOX image contains a proper version of sgdisk that is able to alter the GPT size.
Actually i think i can add the extra steps at the end of the post #1 indeed, thanks for suggestion.
serdeliuk said:
If the space is left unused/free as suggested there is actually an easy step to alter the GPT later and add one or more partitions without losing anything. I just omitted the step as i thought is not related to the scope of this HowTo.
My OrangeFOX image contains a proper version of sgdisk that is able to alter the GPT size.
Actually i think i can add the extra steps at the end of the post #1 indeed, thanks for suggestion.
Click to expand...
Click to collapse
I find that it's better to do all the work at once.
Helps to not forget something important.
Good thing your sgdisk is ready and it doesn't need any extra tools.
Optional steps, for sure, but still good to have.
Just don't go over 8192 partitions. Things seem to be bugged after that, from what I read.
Vagelis1608 said:
I find that it's better to do all the work at once.
Helps to not forget something important.
Good thing your sgdisk is ready and it doesn't need any extra tools.
Optional steps, for sure, but still good to have.
Just don't go over 8192 partitions. Things seem to be bugged after that, from what I read.
Click to expand...
Click to collapse
I have added the last missing steps, thanks.
When i started to write the HowTo i didn't realized that will be that huge, is too long to read )))
serdeliuk said:
When i started to write the HowTo i didn't realized that will be that huge, is too long to read )))
Click to expand...
Click to collapse
It's fine, don't worry about it.
It's not like ordinary users will follow it. It's for advanced users
Did anyone do it? Do you have Some screenshots or video review?
denis3509 said:
Did anyone do it? Do you have Some screenshots or video review?
Click to expand...
Click to collapse
I did it on my nabu, i do not have any screenshots or videos, but i have doubts that will help more than what is in the first post, if you have any doubts do not do it, read more, study more, ask questions before do anything, this way you will avoid a soft brick.
I've tried to follow your steps for partitioning, and the pmos guide of porting a new device. I used the map220v kernel, and using pmbootstrap i build and solved some configs error. After i've extracted boot.img and xiaomi-nabu.img, flashed vbmeta_disabled, and then the other images. But when i try boot the slot b, it will redirect to fastboot. How can i solve it?
DTBO? You need to erase dtbo on the slot you are using pmos with.
sparky98 said:
I've tried to follow your steps for partitioning, and the pmos guide of porting a new device. I used the map220v kernel, and using pmbootstrap i build and solved some configs error. After i've extracted boot.img and xiaomi-nabu.img, flashed vbmeta_disabled, and then the other images. But when i try boot the slot b, it will redirect to fastboot. How can i solve it?
Click to expand...
Click to collapse
Also you need to disable AVB in vbmeta too and be sure you have the Postmarketos on the right slot.
Yes i did what you all said before flashing on boot_b and pmos, but maybe i'm doing that wrong.
I erased dtbo_b like this guide, and i've generated the disabled vbmeta with
Bash:
avbtool make_vbmeta_image --flags 2 --padding_size 4096 --output vbmeta_disabled.img
and flashed this image on vbmeta_b
sparky98 said:
Yes i did what you all said before flashing on boot_b and pmos, but maybe i'm doing that wrong.
I erased dtbo_b like this guide, and i've generated the disabled vbmeta with
Bash:
avbtool make_vbmeta_image --flags 2 --padding_size 4096 --output vbmeta_disabled.img
and flashed this image on vbmeta_b
Click to expand...
Click to collapse
Then this HowTo guide reached his scope, you had successfully resized your internal storage, why your OS does not boot is out of scope of this thread, you may need to seek assistance from the developer of your packages. At first glance i can say that your kernel is not properly configured and your DTB is not complete, but please ask the developer of your sources to debug his work and maybe to help you with your issues. Or watch my other threads about PostmarketOS on nabu as soon I will make my sources available as well as some prebuild images.
The preview images of my PostmarketOS port for nabe are available now, check post this thread [INFO] PostmarketOS Linux boot on Xiaomi Pad 5 (nabu)

Categories

Resources