[Q] How to resize/increase /data partition size - Android Q&A, Help & Troubleshooting

My phone has 4GB internal ROM with below partitions:
1. mmcblk0p1 1024 ebr1
2. mmcblk0p2 10.00 MB protect_f ->EXT4
3. mmcblk0p3 10.00 MB protect_s ->EXT4
4. mmcblk0p4 750.00 MB android ->EXT4
5. mmcblk0p5 376.00 MB cache ->EXT4
6. mmcblk0p6 1.20 GB usrdata ->EXT4
7. mmcblk0p7 1.27 GB fat ->VFAT
Now, mmcblk0p7 (1.27 GB of vFAT) partition is used as sdcard1 but I also have a 8GB of mnt/sdcard partition. So, the mmcblk0p7 partition is totally useless in my phone. My questions are:
1. Can I add/merge mmcblk0p7 partition with mmcblk0p6 (/data) partition?
2. Or, Can I re-size/increase my mmcblk0p6 (/data) partition from mmcblk0p7
3. Or, Can I make the mmcblk0p7 as a swap partition like linux OS?
My Phone info:
Chip: MTK 6572
Android Version: 4.2.2
Basebad version: MOLY.WR8.W1315.MD.WG.MP.V1.P1, 2013/07/13 13:02
Kernel version: 3.4.5

It would probably be a huge undertaking to try to merge or repartition with a good chance of bricking it. Maybe not irreparably, but a pain, I'm sure. Especially since the partitions would have to be reformatted to the right mode. What might be easier is to set that up as a partition for extra game or app data storage and use something like this: https://play.google.com/store/apps/details?id=com.devasque.fmount or to mess around with your vold.fstab file to swap mount points: http://forum.xda-developers.com/showthread.php?t=1914184 or you'd have to really get into it and format that vfat partition, edit the init.rc and/or kernel, and probably a bunch of other stuff to get it booting right. Definitely not something you should try without at least knowing how to reload the stock OS back to it.

If you want to resize your data (usrdata) partition by merging or resizing the fat (emmc) partition, you would have to edit EBR1 file and EBR2 file if you have the it (EBR2). Consequently, you might have to edit MBR and the scatter-file as well. This is an arduous task and could brick your device.

Thanks
Thank you es0tericcha0s and iZLeeP for your reply

Help
skjh.jewel said:
My phone has 4GB internal ROM with below partitions:
1. mmcblk0p1 1024 ebr1
2. mmcblk0p2 10.00 MB protect_f ->EXT4
3. mmcblk0p3 10.00 MB protect_s ->EXT4
4. mmcblk0p4 750.00 MB android ->EXT4
5. mmcblk0p5 376.00 MB cache ->EXT4
6. mmcblk0p6 1.20 GB usrdata ->EXT4
7. mmcblk0p7 1.27 GB fat ->VFAT
Now, mmcblk0p7 (1.27 GB of vFAT) partition is used as sdcard1 but I also have a 8GB of mnt/sdcard partition. So, the mmcblk0p7 partition is totally useless in my phone. My questions are:
1. Can I add/merge mmcblk0p7 partition with mmcblk0p6 (/data) partition?
2. Or, Can I re-size/increase my mmcblk0p6 (/data) partition from mmcblk0p7
3. Or, Can I make the mmcblk0p7 as a swap partition like linux OS?
My Phone info:
Chip: MTK 6572
Android Version: 4.2.2
Basebad version: MOLY.WR8.W1315.MD.WG.MP.V1.P1, 2013/07/13 13:02
Kernel version: 3.4.5
Click to expand...
Click to collapse
Hello I have also same exact phone
Chip: MTK 6572
Android Version: 4.2.2
Basebad version: MOLY.WR8.W1315.MD.WG.MP.V1.P1, 2013/07/13 13:02
Kernel version: 3.4.5
I was experimenting like you and ended up being internal partition being corrupted and bricked it.My backup also doesn't help me in restoring my phone.Phone doesn't boot and stuck at boot animation.
My phone is Chinese no brand name
Can you provide me with your scatter files and Mbr and Ebr1 files also?

mtk6572 partitions
Hello I have also same exact phone
Chip: MTK 6572
Android Version: 4.2.2
Basebad version: MOLY.WR8.W1315.MD.WG.MP.V1.P1, 2013/07/13 13:02
Kernel version: 3.4.5
I was experimenting like you and ended up being internal partition being corrupted and bricked it.My backup also doesn't help me in restoring my phone.Phone doesn't boot and stuck at boot animation.
My phone is Chinese no brand name
Can you provide me with your scatter files and Mbr and Ebr1 files also?
Click to expand...
Click to collapse
I figured out how to edit the EBR1, it's actually very easy, you don't even have to do anything to the MBR. Here is my screenshot.
You can find the directions on my blog, if you have issues with doing it yourself, provide me with your EBR1, would be more then happy to mod yours
Here is the directions: Increase MTK6572 Internal App storage

Is possible . For example for samsungs models is 100% works.. there is pit editor sw. by editing it youcan make your phone partitions resized etc. so it must work in any android. must be a way to make it over adb shell. but be sure - you will lost your system and possible your data.

How can I increase the size of partition of /system ?? in mt6582

download the official update for Wiko Rainbow Up, it has a resized /system partition 2000 MB.
edit: if custom revovery, you can do it manually by changing /dev/ebr1 see above (bethnesbitt). example attached for Archos 50b Oxygen 4GB. don't do this on stock recovery (you have to format /system + /cache + /data)!
Code:
dd if=/dev/ebr1 of=/sdcard/ebr1.old bs=512 count=1
dd if=/sdcard/ebr1.new of=/dev/ebr1 bs=512 count=1
NOT A FLASHABLE ZIP!

Related

[Q] My device (16GB) seems to be completely broken and ID in adb is 0000000000000000

Unfortunately, I don't have a backup of mmcblk0p5, but even if I try (out of desperation) to flash someone else's mmcblk0p5, ID doesn't change from zeros. I managed to run CM7 from external sdcard, but installing CM onto mmc doesn't seem to work.
Ubuntu Total Reflash from this forum flashed al successfully, but failed on recovering stage and since then it just bootloops to that point (boot -> factory reset fails -> reboot).
Now trying to flash stock ROM 1.4.0, but don't think it'll work. Any advice?
P.S. Now found something strange: mmcblkp7 (seventh partition is gone, and that seem to repeat after every recovery option I try).
Code:
Number Start (sector) End (sector) Size Code Name
1 256 511 128.0 KiB 8300 xloader
2 512 1023 256.0 KiB 8300 bootloader
3 1024 31743 15.0 MiB 8300 recovery
4 32768 65535 16.0 MiB 8300 boot
5 65536 163839 48.0 MiB 8300 rom
6 163840 262143 48.0 MiB 8300 bootdata
8 1019904 2273279 612.0 MiB 8300 system
9 2273280 3145727 426.0 MiB 8300 cache
10 3145728 5242879 1024.0 MiB 8300 media
11 5242880 30535639 12.1 GiB 8300 userdata
UPD.: Paste from parted's print after I create partition 7 (factory):
Code:
(parted) print
print
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 16.3MB 15.7MB recovery
4 16.8MB 33.6MB 16.8MB boot
5 33.6MB 83.9MB 50.3MB rom
6 83.9MB 134MB 50.3MB fat32 bootdata
7 134MB 522MB 388MB ext4 factory
8 522MB 1164MB 642MB ext4 system
9 1164MB 1611MB 447MB ext4 cache
10 1611MB 2684MB 1074MB fat32 media
11 2684MB 15.6GB 12.9GB ext4 userdata
Your NT's factory installed device info (ProductID, manufactured data, etc.) and individual device data (serial no., MAC address, security encryption keys, etc.) are stored in p5 and p7, if you reformatted these two partitions all that info was wiped out and the individual device data can't be replaced with data from another NT. See http://forum.xda-developers.com/showpost.php?p=37515697&postcount=31 for more details.
digixmax said:
Your NT's factory installed device info (ProductID, manufactured data, etc.) and individual device data (serial no., MAC address, security encryption keys, etc.) are stored in p5 and p7, if you reformatted these two partitions all that info was wiped out and the individual device data can't be replaced with data from another NT. See http://forum.xda-developers.com/showpost.php?p=37515697&postcount=31 for more details.
Click to expand...
Click to collapse
Oh, that's unfortunate. I didn't wipe it by myself, it just suddenly got stuck after i got ~4% of battery charge the other day. Can I do something for it?
P.S. Or, if nothing can be done, what's the most simplistic/minimalistic yet full-[stock]-feature ROM for sdcard available? Disregarding Android verion.
digixmax said:
Your NT's factory installed device info (ProductID, manufactured data, etc.) and individual device data (serial no., MAC address, security encryption keys, etc.) are stored in p5 and p7, if you reformatted these two partitions all that info was wiped out and the individual device data can't be replaced with data from another NT. See http://forum.xda-developers.com/showpost.php?p=37515697&postcount=31 for more details.
Click to expand...
Click to collapse
Huh, seems like I did it. I even can't recall all the steps I performed, but it included just little more messing up with gdisk/parted, trying to wipe all data and caches through CWM and install CM10.1, but that failed as usually, so I just uploaded Veronica's mmcblk0p5 again, then I thought "wtf, let's give it another try" and applied Ubuntu Total Reflash procedure and it worked! All of a sudden, I have my factory-state Nook (saying nothing about case cracks and fractures ^_^).
So, now I'm going to share link to this post with all the people I think are relevant to this question and ask them: is that normal? Can I try to flash CM 10.1 now without *too much* risk of getting my dear brick again? Thanks in advance.
UPD: Checked ID, MAC and so on - seems to be different from 00...0, but I'm not sure whether it's still unique (i reckon that they are like Veronica's now).
UPD2: Installed CM 10.1 rather successfully. I guess, someone can add to FAQ that even with broken mmcblk0p5 one still could help himself.

[Q] Resize the NAND (system partition)

Please can someone help me to resize the system partition of an Android JB 4.2.2 on cubieboard?
Image: sun7i_android_sugar-cubieboard2-8192cu.img
I need more room (it's only 512MB) to install apps.
Well, the APP disk space (nand partition) is very small and the internal "sdcard" too big.
When I install a few applications the space runs out and the system becomes unstable.
I need to increase the nand and decrease internal sdcard to gain more room to my apps...
Well, I started the process by using the tools:
1) To unpack/repack: imgRePacker_204
2) The image ROM: sun7i_android_sugar-cubieboard2-8192cu.img (Android 4.2.2)
3) To burn to flash: PhoenixSuit1.0.6
unpacking the ROM creates a folder named sun7i_android_sugar-cubieboard2-8192cu.img.dump
So, somewhere in internet I see to change the sys_partition.fex file, and search the system nand partition:
Code:
;------------------------------>mmcblk0p8/nande
[partition]
name = data
size = 1048576
user_type = 0x2
so, I change 1048576 to 2097152 (2097152 * 1024 = 2GB)
but :
1) In installed android, the system has only 512MB and not 1GB as show.
2) By increasing this value, nothing happens when I repack back to IMG and flash to the nand.
(all unpak, change, pack, flash process is fine ! )
Here is my devices list and size:
Code:
NAME SIZE MOUNTPOINT LABEL
nand 3.8G
|-nand1 16M Volumn
|-nand2 16M
|-nand3 16M
|-nand4 512M
|-nand5 512M
|-nand6 16M
|-nand7 32M
|-nand8 320M
|-nand9 16M PRIVATE
|-nand10 256M
`-nand11 2.1G
mmcblk0 14.4G
|-mmcblk0p1 900M /
`-mmcblk0p2 13.5G EXTRA
icemagno said:
Please can someone help me to resize the system partition of an Android JB 4.2.2 on cubieboard?
Image: sun7i_android_sugar-cubieboard2-8192cu.img
I need more room (it's only 512MB) to install apps.
Well, the APP disk space (nand partition) is very small and the internal "sdcard" too big.
When I install a few applications the space runs out and the system becomes unstable.
I need to increase the nand and decrease internal sdcard to gain more room to my apps...
Well, I started the process by using the tools:
1) To unpack/repack: imgRePacker_204
2) The image ROM: sun7i_android_sugar-cubieboard2-8192cu.img (Android 4.2.2)
3) To burn to flash: PhoenixSuit1.0.6
unpacking the ROM creates a folder named sun7i_android_sugar-cubieboard2-8192cu.img.dump
So, somewhere in internet I see to change the sys_partition.fex file, and search the system nand partition:
Code:
;------------------------------>mmcblk0p8/nande
[partition]
name = data
size = 1048576
user_type = 0x2
so, I change 1048576 to 2097152 (2097152 * 1024 = 2GB)
but :
1) In installed android, the system has only 512MB and not 1GB as show.
2) By increasing this value, nothing happens when I repack back to IMG and flash to the nand.
(all unpak, change, pack, flash process is fine ! )
Here is my devices list and size:
Code:
NAME SIZE MOUNTPOINT LABEL
nand 3.8G
|-nand1 16M Volumn
|-nand2 16M
|-nand3 16M
|-nand4 512M
|-nand5 512M
|-nand6 16M
|-nand7 32M
|-nand8 320M
|-nand9 16M PRIVATE
|-nand10 256M
`-nand11 2.1G
mmcblk0 14.4G
|-mmcblk0p1 900M /
`-mmcblk0p2 13.5G EXTRA
Click to expand...
Click to collapse
Use this software, search it on google and install it on your PC, then partition you SD
MiniTool Partition Wizard Pro v7.1
azithro said:
Use this software, search it on google and install it on your PC, then partition you SD
MiniTool Partition Wizard Pro v7.1
Click to expand...
Click to collapse
"3) To burn to flash: PhoenixSuit1.0.6"
This implies using NAND .... SD is not in the context.
Thanks anyway!

cant modify ANY parttions - I want to totally ZAP the flash

I have a NOOK tablet 16GB that is somehow locked from modifying partitions
I have tried
the repart image , which has worked many times for me in the past
the AdamOutler Ubuntu Disk
formatting / wiping options in various versions of CWM and TWRP
fastboot erases
fastboot formats
dd'ing /zero to various partitions
parted
sgdisk
a zillion scripts
something at a low level is preventing modifications to the partitions
Im wasting far too much time on this , but I hate being beat (-:
I have a backup of rom and factory , and dd images of stock parttions so I am 100% comfortable with something that
will COMPLETELY ZAP the device
if I boot a known good CM10 image from SD card, it fails to boot , I was assuming if I could get a running android from the card, I'd have access to lots of tools... , but it just fails to tun CM10
any help appreciated.
Thanks
To completely zap the device, erase the partition table. That will leave you one, giant, unallocated space.
From there, you need to recreate all partitions from scratch.
You will not be able to boot without a bootable CWM SD, so have that handy.
sagirfahmid3 said:
To completely zap the device, erase the partition table. That will leave you one, giant, unallocated space.
From there, you need to recreate all partitions from scratch.
You will not be able to boot without a bootable CWM SD, so have that handy.
Click to expand...
Click to collapse
Thanks for responding, Yes, I have tried multiple ways to to zap the table and it doesnt stick.
sgdisk -Z, sgdisk -z parted,
no matter what I do the partitions remain untouched.
I reboot and it still boots into an old stock OS that has a FC shortly after startup, and the internal recovery (factory) , which I can not overwrite, gives the please restart and try again message.
hmm,
I WAS able to get a CM7 SD card image to boot and run
appears to work "normally" , but Internal storage shows as "not available" in settings
mikeataol said:
hmm,
I WAS able to get a CM7 SD card image to boot and run
appears to work "normally" , but Internal storage shows as "not available" in settings
Click to expand...
Click to collapse
You're supposed to do:
# gdisk
# o
# w
# q
That will for sure give you an empty partition table. You probably forgot to write the changes before exiting.
sagirfahmid3 said:
You're supposed to do:
# gdisk
# o
# w
# q
That will for sure give you an empty partition table. You probably forgot to write the changes before exiting.
Click to expand...
Click to collapse
Hi, no, I didnt forget to "write" after the "o"
/tmp # ./gdisk /dev/block/mmcblk0
./gdisk /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): o
o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
y
Command (? for help): w
w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
y
OK; writing new GUID partition table (GPT) to /dev/block/mmcblk0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
/tmp # q
/tmp #
after reboot
Command (? for help): p
p
Disk /dev/block/mmcblk0: 31105024 sectors, 14.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): CE21388C-B927-4A5C-91CE-DBD1DE4AB3BC
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 30535678
Partitions will be aligned on 256-sector boundaries
Total free space is 1285 sectors (642.5 KiB)
Number Start (sector) End (sector) Size Code Name
1 256 511 128.0 KiB 8300 xloader
2 512 1023 256.0 KiB 8300 bootloader
3 1024 31743 15.0 MiB 8300 recovery
4 32768 65535 16.0 MiB 8300 boot
5 65536 163839 48.0 MiB 8300 rom
6 163840 262143 48.0 MiB 8300 bootdata
7 262144 1019903 370.0 MiB 8300 factory
8 1019904 2273279 612.0 MiB 8300 system
9 2273280 3145727 426.0 MiB 8300 cache
10 3145728 5242879 1024.0 MiB 8300 media
11 5242880 30535639 12.1 GiB 8300 userdata
Humm...wow, that's pretty crazy. Try writing zeroes to your emmc and then retrying.
# dd if=/dev/zero of=/dev/block/mmcblk0

[Q] How to repartition internal memory

Is there any way to re-partition ROM eMMC ? since /cache has 500 MB ,it can be re - partitioned to merge into /data partition . so any body here know how to re-partition ROM ? is it possible ?
Parted dump:
Code:
31 106824kB 117268kB 10445kB boot
32 117268kB 127795kB 10527kB recovery
33 127795kB 603980kB 476185kB ext4 cache
34 603980kB 1543504kB 939524kB ext4 system
35 1543504kB 1551892kB 8389kB kpan
36 1551892kB 3958768kB 2406875kB ext4 userdata
Since the "important" partitions are towards the end, something can well be done (as long as you have full OS installation media in zip or nandroid format, plus some tools which may not even be needed on this phone)... If you can wait a week I'll try to write a guide
After some testing, it appears to be impossible, like there is some S-ON on the partition table area...
full partition table needed please..
Ryccardo said:
Parted dump:
Code:
31 106824kB 117268kB 10445kB boot
32 117268kB 127795kB 10527kB recovery
33 127795kB 603980kB 476185kB ext4 cache
34 603980kB 1543504kB 939524kB ext4 system
35 1543504kB 1551892kB 8389kB kpan
36 1551892kB 3958768kB 2406875kB ext4 userdata
Since the "important" partitions are towards the end, something can well be done (as long as you have full OS installation media in zip or nandroid format, plus some tools which may not even be needed on this phone)... If you can wait a week I'll try to write a guide
Click to expand...
Click to collapse
Hey bro, could you please provide me a full partition table in that same format?

Bootloop after applying system.img

I am attempting to apply a new system.img file to an Android tablet and it always results in a soft brick/bootloop.
The tablet being used is a TerraPad 1004, running android 5.1.1 (MTK8735). I have been given special access to the image files by the manufacturer, who have provided everything I need to update the tablet using SP Flash Tool (5.164 on Windows 10). If I flash the files as they were provided it all works fine and the tablet boots up perfectly. If I unpack/mount/repack the system.img and then try flashing it I get stuck either on the boot screen or get the dead android image (only get this I make the system.img file too big when repacking it). Please note, despite unpacking/mounting/repacking I made no changes to the system image, so in theory it should be the same as the originally provided system.img file.
I am doing the unpack/mount/repack on Ubuntu 16.04 (64 bit - have tried 32 bit and 12.04) VM (using Virtual Box).
The commands I am using are:
Unpack: simg2img system.img system.raw
Mount: sudo mount -t ext4 -o loop system.raw system/
Repack: make_ext4fs -s -l 1617722231 -S file_contexts -a system newsystem.img /home/ubuntu/mhh/Terra1004/system
The file size specified for make_ext4fs has been arrived at via trial and error as all the means I have seen of calculating (e.g blocks x block size) result in a file that is significantly bigger then the original system.img file (resulting in dead android when flashed to tablet). The current size specified results in an image file that has the same number of blocks as the original file but is 24 bytes bigger than the original (this img results in getting stuck on the very first boot splash screen).
I have tried flashing the image via fastboot (fastboot flash system system.img) and get "FAILED (remote: failed to get download permission for partition 'system')".
I am working with the manufacturer to resolve this issue but I am getting very little back from them.
I am getting quite desperate to resolve this as my business relies on my ability to amend the system.img (and other files) to bespoke the tablet to my own product.
I am really at the limit of my understanding on what I am talking about when it comes to modding tablets - I do it as a necessity rather than a hobby, so please excuse any incorrectly used terminology.
All help/suggestions welcome. Please let me know if you need any further information.
Thanks in advance.
KGMARSCH said:
I am attempting to apply a new system.img file to an Android tablet and it always results in a soft brick/bootloop.
The tablet being used is a TerraPad 1004, running android 5.1.1 (MTK8735). I have been given special access to the image files by the manufacturer, who have provided everything I need to update the tablet using SP Flash Tool (5.164 on Windows 10). If I flash the files as they were provided it all works fine and the tablet boots up perfectly. If I unpack/mount/repack the system.img and then try flashing it I get stuck either on the boot screen or get the dead android image (only get this I make the system.img file too big when repacking it). Please note, despite unpacking/mounting/repacking I made no changes to the system image, so in theory it should be the same as the originally provided system.img file.
I am doing the unpack/mount/repack on Ubuntu 16.04 (64 bit - have tried 32 bit and 12.04) VM (using Virtual Box).
The commands I am using are:
Unpack: simg2img system.img system.raw
Mount: sudo mount -t ext4 -o loop system.raw system/
Repack: make_ext4fs -s -l 1617722231 -S file_contexts -a system newsystem.img /home/ubuntu/mhh/Terra1004/system
The file size specified for make_ext4fs has been arrived at via trial and error as all the means I have seen of calculating (e.g blocks x block size) result in a file that is significantly bigger then the original system.img file (resulting in dead android when flashed to tablet). The current size specified results in an image file that has the same number of blocks as the original file but is 24 bytes bigger than the original (this img results in getting stuck on the very first boot splash screen).
I have tried flashing the image via fastboot (fastboot flash system system.img) and get "FAILED (remote: failed to get download permission for partition 'system')".
I am working with the manufacturer to resolve this issue but I am getting very little back from them.
I am getting quite desperate to resolve this as my business relies on my ability to amend the system.img (and other files) to bespoke the tablet to my own product.
I am really at the limit of my understanding on what I am talking about when it comes to modding tablets - I do it as a necessity rather than a hobby, so please excuse any incorrectly used terminology.
All help/suggestions welcome. Please let me know if you need any further information.
Thanks in advance.
Click to expand...
Click to collapse
Try flashing system.img without modifying it
Sent from my GT-S7580 using Tapatalk
DodoGTA said:
Try flashing system.img without modifying it
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
I've done that. The system.img file as provided by the manufacturer works fine. It fails as soon as I unpack/repack it, even without making any modifications to it.
KGMARSCH said:
I've done that. The system.img file as provided by the manufacturer works fine. It fails as soon as I unpack/repack it, even without making any modifications to it.
Click to expand...
Click to collapse
What's the size of unmodified system.img (in bytes)?
Sent from my GT-S7580 using Tapatalk
DodoGTA said:
What's the size of unmodified system.img (in bytes)?
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
Using Ubuntu stat command on system.img (the original untouched image), it reports:
Size: 929,933,912
Blocks: 1,816,288
IO Block: 4,096
Inode: 1,863,406
Doing the same on the repacked newsystem.img I get:
Size: 929,933,936
Blocks: 1,816,288
IO Block: 4,096
Inode: 1,983,804
This is the closest I can get the size of newsystem.img to be to system.img (24 bytes difference).
The permissions on both are the same (0770).
DodoGTA said:
Try flashing system.img without modifying it
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
Just realised that I may have misunderstood your comment. I have previously tried flashing the original system.img using the SP Flash Tool and that works fine. However, in case you meant flashing it via fastboot, I have just tried this and I get the same "failed to get download permission for partition 'system'" error, even with the original system.img.
KGMARSCH said:
Using Ubuntu stat command on system.img (the original untouched image), it reports:
Size: 929,933,912
Blocks: 1,816,288
IO Block: 4,096
Inode: 1,863,406
Doing the same on the repacked newsystem.img I get:
Size: 929,933,936
Blocks: 1,816,288
IO Block: 4,096
Inode: 1,983,804
This is the closest I can get the size of newsystem.img to be to system.img (24 bytes difference).
The permissions on both are the same (0770).
Click to expand...
Click to collapse
Can you run this command on a tablet you talked about in this thread (with a terminal emulator app):
{
"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"
}
and post the output of it?
Sent from my GT-S7580 using Tapatalk
DodoGTA said:
Can you run this command on a tablet you talked about in this thread (with a terminal emulator app):
and post the output of it?
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
Here is the output from cat partitions, cat partinfo and cat emmc:
[email protected]_PAD_1004:/proc $ cat partitions
cat partitions
major minor #blocks name
254 0 483328 zram0
7 0 1254 loop0
179 0 15267840 mmcblk0
179 1 3072 mmcblk0p1
179 2 5120 mmcblk0p2
179 3 10240 mmcblk0p3
179 4 10240 mmcblk0p4
179 5 512 mmcblk0p5
179 6 512 mmcblk0p6
179 7 16384 mmcblk0p7
179 8 16384 mmcblk0p8
179 9 8192 mmcblk0p9
179 10 10240 mmcblk0p10
179 11 512 mmcblk0p11
179 12 2048 mmcblk0p12
179 13 6144 mmcblk0p13
179 14 8192 mmcblk0p14
179 15 5120 mmcblk0p15
179 16 5120 mmcblk0p16
179 17 1024 mmcblk0p17
179 18 32768 mmcblk0p18
179 19 37888 mmcblk0p19
179 20 1572864 mmcblk0p20
179 21 409600 mmcblk0p21
179 22 13088256 mmcblk0p22
179 23 16384 mmcblk0p23
179 96 4096 mmcblk0rpmb
179 64 4096 mmcblk0boot1
179 32 4096 mmcblk0boot0
[email protected]_PAD_1004:/proc $ cat partinfo
cat partinfo
Name Start Size
pgpt 0x0000000000000000 0x0000000000080000
proinfo 0x0000000000080000 0x0000000000300000
nvram 0x0000000000380000 0x0000000000500000
protect1 0x0000000000880000 0x0000000000a00000
protect2 0x0000000001280000 0x0000000000a00000
lk 0x0000000001c80000 0x0000000000080000
para 0x0000000001d00000 0x0000000000080000
boot 0x0000000001d80000 0x0000000001000000
recovery 0x0000000002d80000 0x0000000001000000
logo 0x0000000003d80000 0x0000000000800000
expdb 0x0000000004580000 0x0000000000a00000
seccfg 0x0000000004f80000 0x0000000000080000
oemkeystore 0x0000000005000000 0x0000000000200000
secro 0x0000000005200000 0x0000000000600000
keystore 0x0000000005800000 0x0000000000800000
tee1 0x0000000006000000 0x0000000000500000
tee2 0x0000000006500000 0x0000000000500000
frp 0x0000000006a00000 0x0000000000100000
nvdata 0x0000000006b00000 0x0000000002000000
metadata 0x0000000008b00000 0x0000000002500000
system 0x000000000b000000 0x0000000060000000
cache 0x000000006b000000 0x0000000019000000
userdata 0x0000000084000000 0x000000031ed80000
flashinfo 0x00000003a2d80000 0x0000000001000000
sgpt 0x00000003a3d80000 0x0000000000080000
[email protected]_PAD_1004:/proc $ cat emmc
cat emmc
partno: start_sect nr_sects partition_name
emmc_p1: 00000400 00001800 "proinfo"
emmc_p2: 00001c00 00002800 "nvram"
emmc_p3: 00004400 00005000 "protect1"
emmc_p4: 00009400 00005000 "protect2"
emmc_p5: 0000e400 00000400 "lk"
emmc_p6: 0000e800 00000400 "para"
emmc_p7: 0000ec00 00008000 "boot"
emmc_p8: 00016c00 00008000 "recovery"
emmc_p9: 0001ec00 00004000 "logo"
emmc_p10: 00022c00 00005000 "expdb"
emmc_p11: 00027c00 00000400 "seccfg"
emmc_p12: 00028000 00001000 "oemkeystore"
emmc_p13: 00029000 00003000 "secro"
emmc_p14: 0002c000 00004000 "keystore"
emmc_p15: 00030000 00002800 "tee1"
emmc_p16: 00032800 00002800 "tee2"
emmc_p17: 00035000 00000800 "frp"
emmc_p18: 00035800 00010000 "nvdata"
emmc_p19: 00045800 00012800 "metadata"
emmc_p20: 00058000 00300000 "system"
emmc_p21: 00358000 000c8000 "cache"
emmc_p22: 00420000 018f6c00 "userdata"
emmc_p23: 01d16c00 00008000 "flashinfo"
[email protected]_PAD_1004:/proc $
DodoGTA said:
Can you run this command on a tablet you talked about in this thread (with a terminal emulator app):
and post the output of it?
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
I've got ahead of you I think. I have amended the file size in the make_ext4fs command to make it the same as the partition (1572864 x 1024 = 1610612736). I have flashed the resultant image and it now boots up.
I would swear that I tried this, but then again I have tried so many things over the last couple of weeks
You are my hero and have saved me sooooooo much stress - I honestly thought I'd have to shut down business until this was resolved.
KGMARSCH said:
I've got ahead of you I think. I have amended the file size in the make_ext4fs command to make it the same as the partition (1572864 x 1024 = 1610612736). I have flashed the resultant image and it now boots up.
I would swear that I tried this, but then again I have tried so many things over the last couple of weeks
You are my hero and have saved me sooooooo much stress - I honestly thought I'd have to shut down business until this was resolved.
Click to expand...
Click to collapse
I meant to say this solution
Sent from my GT-S7580 using Tapatalk
DodoGTA said:
I meant to say this solution
Sent from my GT-S7580 using Tapatalk
Click to expand...
Click to collapse
I don't really know what the forum etiquette is but thanks very much for your help. I was rapidly running out of stock of the previous tablet model from the manufacturer and was starting to worry that I wouldn't have a replacement ready in time - now I can get on with making the required amends.
Sometimes you just need someone from the outside to have a look!
Many thanks, Kevin
KGMARSCH said:
I am attempting to apply a new system.img file to an Android tablet and it always results in a soft brick/bootloop.
The tablet being used is a TerraPad 1004, running android 5.1.1 (MTK8735). I have been given special access to the image files by the manufacturer, who have provided everything I need to update the tablet using SP Flash Tool (5.164 on Windows 10). If I flash the files as they were provided it all works fine and the tablet boots up perfectly. If I unpack/mount/repack the system.img and then try flashing it I get stuck either on the boot screen or get the dead android image (only get this I make the system.img file too big when repacking it). Please note, despite unpacking/mounting/repacking I made no changes to the system image, so in theory it should be the same as the originally provided system.img file.
I am doing the unpack/mount/repack on Ubuntu 16.04 (64 bit - have tried 32 bit and 12.04) VM (using Virtual Box).
The commands I am using are:
Unpack: simg2img system.img system.raw
Mount: sudo mount -t ext4 -o loop system.raw system/
Repack: make_ext4fs -s -l 1617722231 -S file_contexts -a system newsystem.img /home/ubuntu/mhh/Terra1004/system
The file size specified for make_ext4fs has been arrived at via trial and error as all the means I have seen of calculating (e.g blocks x block size) result in a file that is significantly bigger then the original system.img file (resulting in dead android when flashed to tablet). The current size specified results in an image file that has the same number of blocks as the original file but is 24 bytes bigger than the original (this img results in getting stuck on the very first boot splash screen).
I have tried flashing the image via fastboot (fastboot flash system system.img) and get "FAILED (remote: failed to get download permission for partition 'system')".
I am working with the manufacturer to resolve this issue but I am getting very little back from them.
I am getting quite desperate to resolve this as my business relies on my ability to amend the system.img (and other files) to bespoke the tablet to my own product.
I am really at the limit of my understanding on what I am talking about when it comes to modding tablets - I do it as a necessity rather than a hobby, so please excuse any incorrectly used terminology.
All help/suggestions welcome. Please let me know if you need any further information.
Thanks in advance.
Click to expand...
Click to collapse
Why not try it like this
This is how I do it
use simg2img
simg2img system.img system_mod.img
mount it
mount -t ext4 -o loop system_mod.img /data/mountpoint
Make your modifications and unmount it
use img2simg
img2simg system_mod.img system.img
I don't think you can mount an img for what your trying to do you can use dd though its like flashing it
dd if=/system.img of=/mountpoint
Sent from my SM-J320P using Tapatalk
rick.wardenburg said:
Why not try it like this
This is how I do it
use simg2img
simg2img system.img system_mod.img
mount it
mount -t ext4 -o loop system_mod.img /data/mountpoint
Make your modifications and unmount it
use img2simg
img2simg system_mod.img system.img
I don't think you can mount an img for what your trying to do you can use dd though its like flashing it
dd if=/system.img of=/mountpoint
Sent from my SM-J320P using Tapatalk
Click to expand...
Click to collapse
Thanks for replying. I've now solved this (with help from DodoGTA). Turns out I had to be very specific (to the byte) with the file size in the make_ext4fs command. Previous tablets I've updated weren't as stringent with the files size (I think they were always defaulted to 500M) but this one is. I took the file size from the system partition size on the tablet (x 1024 to get it into bytes) and it worked (although I could have sworn I'd already tried this). I've now made amends to the system.img and they are taking affect. Thanks anyway.
Same issue as OP
Hey guys I could really use some help. I have MTK device with manufacturer permission to modify firmware. I unpack and repack system.img with no changes, and phone stuck on boot. I can cat partitions, but not partinfo or emmc. Any suggestions would be great as I'm super frustrated and running out of ideas.
scott.fallick said:
Hey guys I could really use some help. I have MTK device with manufacturer permission to modify firmware. I unpack and repack system.img with no changes, and phone stuck on boot. I can cat partitions, but not partinfo or emmc. Any suggestions would be great as I'm super frustrated and running out of ideas.
Click to expand...
Click to collapse
Hi Scott,
If your problem is the same as the one I had then it will be to do with the size you are specifying when repacking the system image.
I was able to work out the size that I required from "cat partitions" (take the size shown for the system partition and multiply it by 1024 to get the value you should use).
The problem you may have is being able to identify which is the system partition. Without being able to see either the partinfo or emmc you may not be able to do this easily, in which case I would recommend a process of elimination. Start with the largest number shown on in the "cat partitions" list and work your why down until you get a value that works. Not the quickest way to do it but the best I can offer you. If you can post the output from "cat partitions" I may be able to make an educated guess which is the system.
Sorry I can't be of more help.
KGMARSCH said:
Hi Scott,
If your problem is the same as the one I had then it will be to do with the size you are specifying when repacking the system image.
I was able to work out the size that I required from "cat partitions" (take the size shown for the system partition and multiply it by 1024 to get the value you should use).
The problem you may have is being able to identify which is the system partition. Without being able to see either the partinfo or emmc you may not be able to do this easily, in which case I would recommend a process of elimination. Start with the largest number shown on in the "cat partitions" list and work your why down until you get a value that works. Not the quickest way to do it but the best I can offer you. If you can post the output from "cat partitions" I may be able to make an educated guess which is the system.
Sorry I can't be of more help.
Click to expand...
Click to collapse
So I believe I'm using the correct size, I was able to determine the name for system using an apk. However, this may sound weird, but it seems my system.img is on a ZRAM partition.
scott.fallick said:
So I believe I'm using the correct size, I was able to determine the name for system using an apk. However, this may sound weird, but it seems my system.img is on a ZRAM partition.
Click to expand...
Click to collapse
I think I am at the limit of my knowledge here. I know enough to be able to make changes to one specific model of tablet. Anything outside of the process that I use for modifying that tablet and I'm not much help I'm afraid. Sorry.
I hope someone else is able to help you.
Kevin
KGMARSCH said:
Hi Scott,
If your problem is the same as the one I had then it will be to do with the size you are specifying when repacking the system image. I was able to work out the size that I required from "cat partitions" (take the size shown for the system partition and multiply it by 1024 to get the value you should use).
.
Click to expand...
Click to collapse
I have the same issue. Seem to have to almost hit super lucky with my make_ext4fs command on nougat based system.img files, where I seem to have gotten one mbuild working but then nothing!. I am in bootloop hell!! However your solution seems like the answer for me. Forgive me for being a little slow on the uptake here, can you explain how you CAT on the device to get the partition sizes and can you take us through the method a little more step by step? I just lost you on that small point.
Just the bit about getting the partition size you then multiply by 1024 to get the final value you use in the make_ext4fs command?
Cheers
OK, so I answered my own question here: https://forum.xda-developers.com/showthread.php?t=2450045
I'm a Windows dude so LINUX commands are not my forte!!
davek17 said:
OK, so I answered my own question here: https://forum.xda-developers.com/showthread.php?t=2450045
I'm a Windows dude so LINUX commands are not my forte!!
Click to expand...
Click to collapse
Well still not resolved actually. For some reason make_ext4fs is now building 44.9MB system.img files that are empty when upacked. Maybe my LINUX VM has gotten corrupted.
Also I think this could be to do with dm-verity too. Despite not seeing any errors when I build the system.img again it boots, runs normally but anything to do with Google apps fail. E.G. Google play stops running, chrome just doesn't want to load. Rest of device seems to work OK though!! Anyone shed any light on that

Categories

Resources