• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Partition resize script - add 1.2 gigs to /data

Brad N

Member
Dec 12, 2015
80
16
Hi all, I've altered a partition resizer flashable zip from another phone to work on our Volt.

The usual warnings apply, in particular... all data in /system, /data, and /cache will be erased if you flash this zip. You will need to restore from backup or flash a new ROM.

Note that backing up data does not back up "internal SD" - Make your own backup of this manually if you need to keep it!!!

New partition sizes, according to df:

system - 1.51GB
data - 5.22GB
cache - 31MB

Also, grow is increased to between 96 and 128MB size (grow is a partition that fills whatever extra space is at the end of the emmc). This is for use as swap with my memory tweaks from the pokemans thread. On my phone it comes out to 128MB, and this might actually be slightly large as it doesn't quite fill that swap with useless data and seems to lag things a little bit from time to time (I notice it when switching between youtube videos, though on second thought maybe this is from one tap video downloader).

This fits my stripped down ZV5 stock ROM, but probably won't fit the original stock ROM. I suspect most custom ROMs would fit. I don't know what happens if a stock rom tries to OTA update with a cache partition that's too small to fit the download; I've altered my build.prop so it thinks it's ZV6 and won't update.

I left a 4MB gap after data to allow for encryption to work if you use that. Someone needs a kick in the ass for coming up with that particular scheme. Note: I checked, and this gap isn't making it in there, probably due to alignment settings in parted. If you use encryption, hold off for now. Problem fixed - I made the gap 4MB instead

I don't know if /cache is used for flashing radios... my suggestion, if you want to change radios, do it before you do this.

You can alter the sizes by changing the partition boundary locations in the update-binary script; but I don't recommend making grow more than 96MB smaller than I had it; it may not fit on all phones if you do.

I'll post a partition restore script later, I figure if you want to play with this early, you can sweat it out for a little bit if something goes wrong ;)

If anyone tries it, let me know how it worked. I've only tried it on one phone so far, but it worked great for me.

Download removed temporarily; testing to make sure change to add 1MB gap to /data works...

Download re-added. Known issue: Sometimes /data won't format; I think it happens if it can't be unmounted for some reason. If this happens (symptom: restoring data partition doesn't work, can't mount it in mounts screen), just reboot and flash the zip again. It should work after that. Problem fixed - it turns out the script I started with never would have formatted partitions properly either on the phone it was for; it was probably not noticed because the recovery would reformat before restoring a backup. With our internalsd, it never wants to format /data so the problem became apparent. I added a partition rescan after partitioning and everything seems happy now.

Download removed again until what happened to billfry is figured out. If you want to try this script, please PM me; I want to go over some things with you first to try and prevent this from happening again.

Note: Only tested with TWRP 2.8.6.0; use a different recovery at your own risk!
 
Last edited:
Hmm, okay. I wonder if you downloaded the non-fixed version before I replaced it with a better one a couple hours ago.

If you go to wipe -> Format Data -> type yes, then it should reformat /data. I bet after this, things will be working. I'm a little confused as to what's going on if you've got the current version of the script. The current version has a zip file size of 4543 bytes.

I'm going to take a better look at this when I try doing my next phone, and see if I run into any issues.

Can you give me a play by play on what steps you did?
 
Upvote 0
Actually nevermind on that, I think you were flashing the right zip file, I was just too lazy to compare sizes that closely but it comes out about right. I'm a little perplexed for what's going on here... I'm starting to wonder if different phones have a little bit different partition layout.

I'd like to take a look at your partition layout, I've attached another flashable zip that will write it to a text file on the root of the SD card, then you could post it here. If that stuff looks good, I'll grab a copy of 2.8.7.0 and see if it's working differently than my 2.8.6.0. Otherwise I'll figure out how to alter this to work on your partition layout.
 

Attachments

  • partition-layout-extractor.zip
    3.9 KB · Views: 155
Upvote 0
Aaargh. That's a re'volt'ing development.

Did you replace the megalock.dll and make sure to set Board DL mode?

If you can still get in download mode, I think there is still hope, even if the LG software can't restore it. It's not pretty though; it basically involves making a whole copy of the internal storage (from a working phone) onto an SD card and then using the send_command.exe trick to get the phone to write it over everything. Then, assuming it doesn't send back output like it doesn't on my windows box, you have to wait a while and hope it worked.
 
Last edited:
Upvote 0
Ok the good news is I found a solution, assuming it booted all the way to download mode and send_command can work (if you see the ROOTED thing at the bottom and the circular arrows it's probably good).

The bad news is it's rather complicated. The shell you get with send_command is about three notches away from being useless... but the good news is download mode mounts the external SD and it can execute a busybox from there. So I can use the dd command in busybox to move data.

The ugly news is that I need to know the size of your emmc to get you a correct image to write to it, and you'll need to have an SD card that's at least 16GB (maybe some 8's would work but why chance it). Since we can work at the file level, we don't need to erase or overwrite it, but we'll need about 8GB of space in it eventually.

For the first step, you'll need to put this busybox - http://178.32.216.142/busybox - on an sd card, put that in the phone, boot up download mode, get a send_command shell open (see this thread: http://forum.xda-developers.com/android/development/guide-root-method-lg-devices-t3049772 - you only need to do steps 1, 3, 6, 8, and 9)

After you've got the shell open, you'll want to run this command:

/storage/external_SD/busybox blockdev --getsz /dev/block/mmcblk0

Hopefully the f* thing spits out a number. I got shell responses to work on my xp box somehow. This whole send_command thing is very glitchy.

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

There's another possibility here that I can work with. I encountered one phone that looked like it was starting to download mode but it was actually running fastboot (you could tell because the first screen mentioned holding volume but then some more text appeared below it). From fastboot you can boot a recovery directly and work inside there.
 
Last edited:
Upvote 0
I think the LG flash tool is pretty much something that does its own thing, and if it doesn't work (and you're following the directions), you're pretty out of luck. But it's good that the process still starts because that means download mode is still working.

I think the only way we're gonna get results is with send_command. There's also a python version of that send_command thing that can run in linux... I don't know how much you know about running linux off a livecd or something, but I tried the python utility in linux last night (all it needs installed is pyserial) and all it takes to get the phone connected is unloading and reloading some usb modules, and I was getting command responses right away. I used it to dump out a raw image of the emmc from a boost mobile volt phone that's been rooted but otherwise nothing else changed from factory. The way I did it was by unmounting the internal partitions and dd'ing the image out in 4 ~2GB chunks (fat32 can only hold files less than 4GB) to the SD card. The same process should easily work in reverse (but you probably only get one shot to get it right... these phones are unrecoverable to us if it can't read the first boot stuff from the emmc).

http://jacobstoner.com/qcdlcomm.py <- this is the python send_command equivalent. Maybe it would work in windows too but I have a suspicion that the missing command responses is a serial driver thing, because I've had it sometimes working and sometimes not on the same machine. With the python one I've noticed I sometimes had to run a command more than once to get a response to show up, or sometimes part of the response was missing. But we just need the response to work once so I can tell what size the emmc is.

A quick way to check if command responses are there is just running the ls command; it should print a bunch of filenames. No error type responses will normally show up though; like if you type an invalid command (and most of them are, because they don't give you many commands) it won't say anything. It's one of the most frustrating shell setups I've ever used. Also, the shell won't do redirection or expand wildcards or things like that... if redirection worked, we could just write the size to a text file on sd card and not even need it to reply over send_command.
 
Last edited:
Upvote 0
I've done a little more investigating on what originally happened. It appears the newest script partitions properly on a fresh phone, but won't format any partitions. I was able to format all the partitions in the recovery and restore from a backup (note: for data, you have to go to wipe -> then the large button on the right side. The wipe area with checkboxes won't work for /data)
 
Upvote 0
the problem with resizing partitions on emmc devices, is you have no way to reflash partitions as they dont fit.

in my opinion, you are SOL at this point.
OP should have warned that it may possibly brick devices and that users can NOT return to stock after usign this script.

your best bet to achieve extra space was using link2sd with internal data links on the external sd card.

this was discussed at: http://forum.xda-developers.com/showthread.php?t=1047747&page=3

hopefully OP finds a way to revert this partition scheme you guys have.
 
Upvote 0
the problem with resizing partitions on emmc devices, is you have no way to reflash partitions as they dont fit.

in my opinion, you are SOL at this point.
OP should have warned that it may possibly brick devices and that users can NOT return to stock after usign this script.

your best bet to achieve extra space was using link2sd with internal data links on the external sd card.

this was discussed at: http://forum.xda-developers.com/showthread.php?t=1047747&page=3

hopefully OP finds a way to revert this partition scheme you guys have.

I provided exactly this warning.

This fits my stripped down ZV5 stock ROM, but probably won't fit the original stock ROM. I suspect most custom ROMs would fit.

Billfry can revert his partition scheme (and everything else) via download mode + send_command and a correct raw emmc image. I have such an image. I'm happy to assist in the process. I do concede that this is not an easy process for various reasons, mostly that the send_command mechanism seems to have reliability problems. Seems to work better than LG's flash tool though...

Hell, I'll even offer to buy the phone or have him ship me the phone and I'll ship it back. I do feel bad about what happened here, but he went and did extra steps without asking first and as a result screwed things up much worse than they were.

I've resized 3 phones now, and the only glitch is you have to manually reformat the partitions (or run the script a second time!), and of course you can't flash back a system backup that's too large, or it won't fit. I still don't understand what's preventing the formatting from working the first try, but there was more evidence the original author had problems too, as they tried to lazy unmount all the partitions too and normally that shouldn't be necessary.
 
Last edited:
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones