[REPARTITION] Nexus 5 Repartition [HAMMERHEAD] [16GB/32GB] [UA TWRP]

Search This thread
I have a 32 GB Nexus 5 and I am getting this error when formatting userdata "bogus size sparse and chunk header". I did try flashing the latest 6.0.1 factory image, but it did not help. What can I do?

Later edit: I somehow managed to fix it. It looks like the latest Platform Tools are not quite suited for our Nexus 5. I downloaded NRT_v2.1.9 that has an older version of the Platform Tools, I flashed the latest available factory image, I flashed the regular TWRP and then the repartition script a few times (it was successful every time) and now I have a functional 32 GB Nexus 5 again. It helped that NRT could not get connectivity so it could not update any of its tools. I don't know which Platform tools version that is.


c:\Downloads\NRT\data>adb --version
Android Debug Bridge version 1.0.36
Revision e02fe72a18c3-android
 
Last edited:

geokilla

Senior Member
Jun 5, 2010
3,466
377
Toronto
Is the repartition zip in OP outdated? I tried flashing the hammerhead one but still don't have a /vendor filesystem. I'm back to Google stock right now so I should be on original partitions.

Edit: Got it working.
 
Last edited:

Ngbhat

New member
Aug 3, 2016
4
0
Am unable to flash even stock rom also
While formatting data it shows error partition table doesn't exist. Unable to mount System/data/cache (invalid argument) anyone plz help me to get original partition table
 

Ngbhat

New member
Aug 3, 2016
4
0
Am unable to install zip file. Internal memory 0mb and /data invalid argument. Formatting is also failed. Unable to mount storage also showing partition table doesn't exist plz help me
 

Attachments

  • IMG_20220813_130757.jpg
    IMG_20220813_130757.jpg
    935 KB · Views: 26
  • IMG_20220813_125733.jpg
    IMG_20220813_125733.jpg
    950 KB · Views: 26

TheSwede86

Member
Oct 3, 2014
17
1
Installation
HTML:
# Before processing further we highly recommend you backup persist using terminal and dd comand and EFS
# Or you might lose your IMEI/WIFI + BT mac addresses

# This mod is backwards compatible with any ROM so we highly recommend NOT to reverse it if repartition went well.
# You should use ONLY recovery from this thread since other don't support all benefits of this mod.
# When installing ROM just after you flashed zip and before installing GAPPs you MUST make a resize in TWRP since all roms are build for ~1G system.
# To restore stock layout use same zip and steps as for repartition.

1. Boot into recovery (You need to allow system partition modification to be able resize /system in recovery).
2. Backup your data & Move your files from flash to your PC.
3. Flash repartition pack zip.
4. Do the actions asked by repartition pack (go to Terminal in ordinary recovery and input word that pack will tell you. Everything else will be done automatically).
5. Phone will reboot into recovery.
6. Install TWRP from below (it is build with support of new partitions layout and sizes. It can be differed from official TWRP by next format 3.x.x-1 UA).
7. Format everything. (mount errors will not affect formatting!)
    - In TWRP: Wipe > Format data
    - Type yes
    - Once this completes go to: Wipe > Advanced Wipe
    - Tick all the boxes and wipe. There should be no further mount errors.
8. Install ROM which you like.
9. Enjoy better flash partition layout.

Thank you for your work, really appreciate it.
I would suggest you add an optional step between step 8 and 9 which mentions resizing the "System" partition (and how you do it step-by-step as you mention on step 7) that you need to resize the "System" partition before installing GAPPs.

It's easy to miss since it isn't mentioned in the numbered list.

///

Update:

I have issues;

Nexus 5

Downloaded:
hh_clamor_repartition.zip
hammerhead-recovery.img
from
and
lineage-18.1-20220911-UNOFFICIAL-hammerhead-signed.zip
from
and
open_gapps-arm-11.0-nano-20220215.zip
( "ARM" > "11" > "NANO")
from

Lineage is stuck on the boot animation and after quite a while restarts into the custom TWRP recovery:
3.3.1-1 UA

If I re-do a part of the process;
1) Move hh_clamor_repartition.zip to phone from my PC by running (while in TWRP on the phone);
Code:
adb push "C:\hh_clamor_repartition.zip" /sdcard/
2) TWRP > Install > hh_clamor_repartition.zip (no checkboxes checked)
Returns:
"Returning stock partitions..." # OK so the partition was successfully modified before
3) TWRP > Advanced > Terminal > "stock"
<phone restarts into TWRP>
4) TWRP >Swipe to Allow Modification
5) Move hh_clamor_repartition.zip from my PC by running (while in TWRP on the phone);
Code:
adb push "C:\hh_clamor_repartition.zip" /sdcard/
6) TWRP > Install > hh_clamor_repartition.zip (no checkboxes checked)
Returns:
Code:
Failed to mount '/cache'.  (Invalid argument)
Failed to mount '/system'.  (Invalid argument)
Failed to mount '/vendor'.  (Invalid argument)
Failed to mount '/cache'.  (Invalid argument)
7) TWRP > Advanced > Terminal > "modify"
Returns:
Code:
umount: Can't umount system
umount: Can't umount cache
<phone restarts into TWRP>
8) TWRP >Swipe to Allow Modification
9) TWRP > Wipe > Format Data > "yes"
Returns:
Code:
Failed to Unmount '/data' (Device or resource busy)
10) TWRP > Wipe > Advanced Wipe > Checking the following boxes;
Code:
Dalvik / ART Cache
System
Vendor
data
Internal Storage
Cache
11) Move lineage-18.1-20220911-UNOFFICIAL-hammerhead-signed.zip and open_gapps-arm-11.0-nano-20220215.zip from my PC by running (while in TWRP on the phone);
Code:
adb push "C:\lineage-18.1-20220911-UNOFFICIAL-hammerhead-signed.zip" /sdcard/
adb push "C:\open_gapps-arm-11.0-nano-20220215.zip" /sdcard/
12) TWRP > Install > lineage-18.1-20220911-UNOFFICIAL-hammerhead-signed.zip (no checkboxes checked)
13) TWRP > Wipe > Advanced Wipe > [check "system"] > Repair or Change File System > Resize File System
(Currently it shows as having 492MB free before resizing)
13) TWRP > Wipe > Advanced Wipe > [check "system"] > Repair or Change File System
(Still shows 492MB free after resizing)
14) TWRP > Install > open_gapps-arm-11.0-nano-20220215.zip (no checkboxes checked)
(No errors)
15) Reboot System (in TWRP after the process above is finished)
16) "Prompt to install TWRP app if not installed" = Checked
"Install as a System App" = Checked
<phone restarts, shows Lineage boot animation for quite some time, boots into TWRP>

Any ideas?
 
Last edited:
  • Like
Reactions: ipdev

Top Liked Posts

  • There are no posts matching your filters.
  • 54
    Nexus 5 Repartition​

    No one is responsible for your actions except yourself. Everything written further may potentially brick your device, although risk is reduced to minimum.

    This repartition package offers 1.5G /system; a /vendor partition and it is fully backward compatible with any ROM (including stock system.img).

    Known-issues
    HTML:
    - If repartition pack says that device isn't correct,
    than, if partition table wasn't modified before,
    congrats! your device has different memory chip
    that those I worked with. No worry, PM me and
    I'll add support for it.

    DO THE BACKUPs. Repartition will erase all your data
    USB connection to PC is MANDATORY else you will not have opportunity to push ROM to your device


    Installation

    HTML:
    # Before processing further we highly recommend you backup persist using terminal and dd comand and EFS
    # Or you might lose your IMEI/WIFI + BT mac addresses
    
    # This mod is backwards compatible with any ROM so we highly recommend NOT to reverse it if repartition went well.
    # You should use ONLY recovery from this thread since other don't support all benefits of this mod.
    # When installing ROM just after you flashed zip and before installing GAPPs you MUST make a resize in TWRP since all roms are build for ~1G system.
    # To restore stock layout use same zip and steps as for repartition.
    
    1. Boot into recovery (You need to allow system partition modification to be able resize /system in recovery).
    2. Backup your data & Move your files from flash to your PC.
    3. Flash repartition pack zip.
    4. Do the actions asked by repartition pack (go to Terminal in ordinary recovery and input word that pack will tell you. Everything else will be done automatically).
    5. Phone will reboot into recovery.
    6. Install TWRP from below (it is build with support of new partitions layout and sizes. It can be differed from official TWRP by next format 3.x.x-1 UA).
    7. Format everything. (mount errors will not affect formatting!)
        - In TWRP: Wipe > Format data
        - Type yes
        - Once this completes go to: Wipe > Advanced Wipe
        - Tick all the boxes and wipe. There should be no further mount errors.
    8. Install ROM which you like.
    9. Enjoy better flash partition layout.

    If something gone wrong - we recommend you NOT to do anything by yourself. Write here for help, else you may do only worse.

    Downloads:
    Repartitioning package
    : GitHub

    Credits:
    Special thanks to
    - Unlegacy-Android team;
    - Sudokamikaze;
    - surfrock66 for his gide for Nexus 5;

    As usual, feedback is appreciated :)

    XDA:DevDB Information
    Nexus 5 Repartition, Tool/Utility for the Google Nexus 5

    Contributors
    Clamor
    Source Code: https://github.com/clamor95/android_device_unlegacy_recovery


    Version Information
    Status:
    Stable

    Created 2018-09-19
    Last Updated 2019-01-18
    13
    Common issues and F. A. Q.

    Repartition pack should be safe for most devices. Common mistakes, issues and their solution will be published here.

    1. You shouldn't flash any internal parts of repartition pack (*.sh files) only flash whole zip using TWRP. You may use my scripts for personal use or projects but authorship should to be kept.

    2. If something isn't mounting after repartition try to format partitions that don't mount using Wipe -> Advanced Wipe in TWPR. Ideally you should format in that way all partitions in Advanced Wipe menu (see 5-th step of installation guide).

    3. To be sure that repartition went well I enclose loging zip. Flash it after repartition (when device reboots into TWRP). It won't modify anything only generates a partition.log in root of internal storage and outputs your current partition layout to screen. You shoud check if your layout is same as those fragments I provide under spoiler (file systems doesn't matter). If there are any differences you have to discribe what you did and enclose partition.log to your post.

    HAMMERHEAD STOCK
    Code:
    25      192937984B    1266679807B   1073741824B                system
    26      1266679808B   1298137087B   31457280B                  crypto
    27      1298137088B   2032140287B   734003200B                 cache

    HAMMERHEAD MODIFIED
    Code:
    25      192937984B    1803551231B   1610613248B                system
    26      1803551232B   2065695231B   262144000B                 vendor
    27      2065695232B   2097152511B   31457280B                  crypto
    28      2097152512B   2306867711B   209715200B                 cache
    4. Flashable resize zip for ROMs that support addon.d (automatic resize when dirty flashing updates).

    5. To backup persist partition you need PC with installed adb. Boot your hammerhead in TWRP and plug to PC. Than use next commands.
    Code:
    adb root
    adb shell
    dd if=/dev/block/mmcblk0p16 of=/sdcard/persist.img
    Than copy .img file from root of internal storage to your PC. Although, script doesn't affect that area, backup of this partition may help in case of any problems with mac address etc.
    12
    3.3.1-1 UA TWRP is already available in download section.
    10
    thanks this really work

    thanks Clamor you are a life saver
    This solves my TWRP Error 70: Insufficient storage space available in the system partition when installing custom ROM

    i think direction is not so clear for people who hasn't done many custom rom flash
    WARNING: I did a clean install and WIPE ALL DATA.

    a bit details here
    1. download hh_clamor_repartition.zip & twrp-3.2.3-1_UA-hh.img. In addition, download the Open GAPP ARM PICO .zip from Open GAPP (depend on which android os version). Nexus 5 is an ARM.
    2. go to Recovery via either custom rom restart that can select Recovery, or after shutdown the phone, hold both volume up & down, then power button to force to Recovery.
    3. backup data from your phone to PC. copy the hh_clamor_repartition.zip to phone
    4. In Recovery, select Install, pick hh_clamor_repartition.zip UNCHECK "reboot after installation is complete". if you don't do this, then you wouldn't see the msg tell you to go to Advanced > Terminal and type "modify"
    5. once the repartition is done. it will reboot to Recovery, here go to Reboot to Bootloader
    6. on your PC, open command prompt in the adb folder. type Fastboot flash recovery twrp-3.2.3-1_UA-hh.img. once it is successful. on your phone, the bootloader screen, use volume up or down to find Recovery, and use power button to select it.
    7. in Recovery, select Wipe > Format Data > type YES. no need to reboot
    8. go back to Wipe > Advanced Wipe > CHECK all boxes, then Swipe to Wipe
    9. connect phone to PC (you should already have ADB). make sure you are in TWRP and Mount your phone.
    10. copy Custom ROM & Open GAPP ARM PICO .zip to phone
    11. in Recovery, select Install. Pick the Custom ROM that you want to flash. UNCHECK "reboot after installation is complete" before installation. do not reboot
    12. use back arrow, select your OPENGAPP .zip file and install. after this, you can reboot

    the initial boot will take a while, but it works.
    i flashed RR-P-v7.0.2-20190505-hammerhead-Official.zip & open_gapps-arm-9.0-pico-20190522.zip on my Nexus 5 16GB

    Once again, i need to thank Clamor for providing this wonderful tool.
    4
    I do hope someone can still help me. I have installed android 10 to my nexus 5 but I can't install the latest gapps (even the pico version) due to lack of space in the partition.

    Assuming you followed the steps and actually completed the (re)partition part.

    You now have an 1.5G system partition and this will never change unless you manually partition the device again.

    This is different than resizing an image.

    If the rom installer does not include automatic resizing, you will be left with only the size the rom was built for. If it was built for a 1G system then, you will only have 1G available to use, .

    Do a complete clean flash. (This will erase everything on the device.)
    TWRP-> Advanced-> Wipe-> Format (Type Yes) enter.
    TWRP-> Advanced-> Wipe-> Check all and Swipe to wipe
    Reboot Recovery


    Then install the rom
    Mount system (either using TWRP or the command below.)
    Check the size (use th df command below.)
    - If you have 1.5G system then you are maxed out on space do to the rom.
    - If you show 1G system size, then you need to expand the image to fill the partition.

    To expand the system image, you can try using TWRP
    Wipe-> Advanced Wipe-> (select System) Repair or Change File System-> Resize File System

    This never worked well for me on hammerhead so, I also included the command below
    System needs to be unmounted to run resize2fs

    Good luck.

    Can someone please help this member writing about lack of space in a repartition thread?
    Edit: Apparently not...
    So, the first and most obvious glaring question - have you repartitioned your Nexus 5?
    Edit: After four days, nothing. Yet again. Yet another occasion where I try to help a junior member, to receive only silence. I am disinclined to bother any more.

    Sorry, some of us do not follow older/onetime use threads that well. :(
    Just a suggestion, you could have mentioned 2020suite in your edit just incase he/she gave up on a repose from this thread and wasn't watching it.

    No criticism.
    As a community (we could do better) should still try to help others.

    We were all juniors once. Thankfully it was a little different when I was and when I used the search function, I did not get overwhelmed by the same question being asked and repeated responses of use search. Either it was ignored, answered or pointed to a post the guided to the answer. (Now I hate searching on xda, the results in some threads are highly polluted.)

    Please do not give up on helping, even if it's a little bit when you can.
    Keep up the good fight :D

    Can you please help me? i repartitioned but it broke my partition table i suppose because everything showed 0MB in TWRP and when wiping it said "failed to mount '/everything' (Invalid argument)" when i tried to partition it to stock it spilled out some errors and when i tried again it said "This is not Nexus 5"

    Did you format the partitions ?

    TWRP-> Wipe-> Format Data (type yes) and tap enter
    TWRP-> Wipe-> Advanced Wipe (Select all) Swipe to Wipe
    TWRP-> Reboot-> Recovery


    This is for someone who flash factory image and get stuck.

    I did flashing factory image, and I got stuck on the boot.
    I could still get into bootloader, so flashed twrp and install other roms but still stuck.

    after that, I found this thread and... I found way to recover it.

    Have to go through repartition again. this time, it asks revert back to stock.
    and then, do it again to modify partition.
    after flash twrp, it shows vendor partition error. dont worry. after wipe(format) it, it will be gone.

    then, you can install any rom you like, and.. my ancient N5 is back!

    If you use fastboot to flash the images manually (boot, system, recovery) you can along as you wipe everything first and then wipe cache and data/factory reset in recovery and reboot.

    It will not change anything as far as partitions but, you can run the last factory image this way if you want.

    Hello, hope there are still some active members who can help someone like me.

    I followed the instruction strictly but when I execute the zip I get the output:
    Can not extract updater-script. Do you have it in package?
    Updating partition details...
    Failed to mount '/vendor' (Invalid argument)
    ...done


    I never reach the "Type something into your terminal part" .

    Now I get the mount error every time I try to do something in recovery but that doesn't seem to have any effect I was able to get my system back running by loading a backup. I tried to fix the mount error by "formatting data" and wiping everything. Didn't work.

    I am just copying the files from my PC to my phone and execute them with TWRP. So I don't get why a file should be missing. My Google/XDA search wasn't really successful so maybe someone of you encountered similar problems and can help with the mount error or the missing updater-script. Thanks.

    I assume you are using twrp-3.3.1-1_UA-hh
    The vendor mount error is because without running the script to actually partition the device, you do not have a separate vendor partition.

    If you use the regular TWRP and Format then wipe everything, do you still get an error?

    I've done it three times now.
    Factory to modified | Modified back to stock | Stock back to modified

    I do not remember how I did it originally.
    Might have pushed the zip to /tmp or /sideload and then used TWRP to install from there.

    The last two times I just used adb sideload to run the zip and then TWRP-> Advanced-> Terminal (type the key word) to continue the dark magic.

    I did it with the regular TWRP.
    Don't need the vendor partition yet so, I'm not that worried about formatting and mounting it.


    --------

    A few commands.
    Noted using adb shell.
    If used in TWRP Terminal, ignore the adb shell part.


    Mount system
    adb shell sbin/mount system

    Display file size (a=all mounted h=human readable)
    adb shell df -ah

    Unmount system
    adb shell umount system

    Resize system image on Nexus 5 Hammerhead
    adb shell resize2fs -f /dev/block/mmcblk0p25

    A few links that may help/explain.

    The regular official TWRP.
    Nexus 5 (Hammerhead) twrp.me - Link

    adb/fastboot [Part of platform-tool]
    SDK Platform Tools developer.android - Link

    Post I made in a different thread that includes a quick explanation of partitioning and resizing images.
    xdaThread [ROM][flo|deb][UNOFFICIAL][AospExtended-v7.0] - Link

    Cheers all. :cowboy: