0

Over a month ago, LineageOS rolled out Oreo (I think) update for the Nexus 4 (mako), but there's a catch - the system now takes up so much space, that even the nano version of open-gapps package can no longer be installed without manually removing application in-between the installations. I thought, rather than shooting down apps from default LineageOS, I would rather bump the system partition's size by another 200 MiB.

I haven't attempted anything yet, as information how to achieve this on a snapdragon device seems to be very sparse - is it even possible? I've done repartitioning on a Mediatek device, where doing so involved hand-editing an MBR-like partition table and uploading it to the device using SP-flashtool. Is there a similar, or perhaps an easier-to-use tool for Snapdragon devices?

P.S. - I've read the answers/suggestions to question 65781, and none of them are helpful to my question.

  • Well, it turns out the flash-tool shenanigans are specific to Mediatek, and partitioning on other phones is done with plain GPT on the mmcblk0 device. So I should be able to resize partitions with generic tools like parted, or sgdisk (neither of which is available in TWRP, but shouldn't be hard to get).Will write up a full answer once I actually get it done. – myxal Sep 10 '18 at 7:41
0

As mentioned above, the Nexus 4 uses plain GPT on its storage to split it up into partitions. Any tool able to modify GPT should work. By far the biggest problem for me was getting an appropriate tool - the fdisk bundled with TWRP can only list partitions on a GPT disk, without making any changes. I prefer not to use parted (available from Termux), due to its inability to display/modify partition GUIDs (may have changed since the last time I checked).

Looking back, it may be possible to dump the entire storage to a computer, make changes there, and put the whole thing back, but I specifically wanted to avoid writing over critical partitions (loaders, kernel, etc.), so I set out to get gdisk for android.

I eventually found this thread, where the author prepared an archive with gdisk and a few other tools.

Requirements:

Overview

The relevant partitions (system and userdata) are 21st and 23rd on the storage. The 22nd partition is just cache, so there's no harm nuking it, and making a new one after data from the other 2 are in place.

The TL;DR version of the procedure is:

  • pull the data partition to computer

    [PC] adb pull /dev/block/mmcblk0p23 userdata.img
    
  • put gdisk on the phone, and use it to modify the partition table - grow system while retaining its starting sector, shrink userdata by the same amount, and re-create cache between them

    [PC] adb push gdisk /tmp/
    [adb-shell] /tmp/gdisk /dev/block/mmcblk0
    ...
    
  • use resize2fs on the phone with the system partition to grow it

  • use resize2fson the computer with the userdata partition's image to shrink it to appropriate size
  • push the modified data image to the phone

    [PC] adb push userdata.img /dev/block/mmcblk0p23
    
  • format the cache partition, reboot into system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.