9

A very bad situation I want to install the Lineage 16 OS on Nexus 5 Without apps it install Ok With google apps(I select pico package arm, wich is under 100 MB) not and give error system partition space not sufficient. This is the actual situation

Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                   949772        28    949744   0% /dev
tmpfs                   949772        44    949728   0% /tmp
/dev/block/mmcblk0p28
                      28061148    643132  27418016   2% /data
/dev/block/mmcblk0p28
                      28061148    643132  27418016   2% /sdcard
/dev/block/mmcblk0p27
                        706392     13084    693308   2% /cache
/dev/block/mmcblk0p25
                       1045804    899652    146152  86% /system

I have tried a parted binary for resize but said ext4 is not supported! And with fdisk allow me to delete only the gpt partition(!) number 1 How to resize the partition n25 /dev/block/mmcblk0p25? My idea is to decrease sdcard of 2GB and increase system with 2GB is possible?

2
  • Have you tried to use parted instead of fdisk? It should support GPT parted disks.
    – Robert
    Commented Aug 23, 2019 at 14:52
  • 1
    parted and gdisk both work great with Android's GPT. I have used them in past to alter partition size. But never touch mmcblk0p1 or any other partition related to SoC or bootloaders. Your device will be bricked for sure. Another idea is to bind mount some loop file or external SD card partition e.g. on /system/app at very early stage of boot proccess. Commented Aug 23, 2019 at 18:42

2 Answers 2

6

I have followed this method: shrink data and recreate system partition; which is not too "kind" but works.

Warning: this method is ok for a fresh installation from scratch. You will lose all data, so follow it only if you're sure of what you're doing. I'm not responsible for data lost, bricked devices, etc. You have been warned.

You must have TWRP installed, a USB connected smartphone and ADB, fastboot on PC:

  1. Get parted and gdisk from here

  2. Reboot in recovery mode

    adb reboot recovery
    
  3. Push gdisk and parted

    adb push parted /
    adb push gdisk /
    
  4. With parted, resize the data partition. In my case, it is 28 and we resize from 30G to 27G

    adb shell
    umount /data 
    parted /dev/block/mmc0blk0
    resizepart 28 27G
    
  5. Now exit from parted and open gdisk

    umount /system
    gdisk  /dev/block/mmc0blk0
    d #delete, select the system partition, in my case is 25
    n #new,I select the new size of 3G for my system partition and 0700 as fsid
    w #write
    
  6. Now, reopen with parted and rename the partition 25 as system

  7. Reboot in recovery mode from TWRP or ADB

    adb reboot recovery
    
  8. The command

    fdisk -l /dev/block/mmc0blk0
    

    must report correct sizes

  9. Now, create the ext4fs

    make_ext4fs /dev/block/mmc0blk0p25
    
  10. Resize the fs

    umount /system||echo ok
    e2fsck -f /dev/block/mmcblk0p25
    resize2fs /dev/block/mmcblk0p25
    
  11. Eventually, correct the /etc/fstab. The command mount /system must complete successfully. With TWRP, try to wipe the partitions data, system, etc. The command must complete successfully.

  12. Install Android ROM or recover from a backup.


I see my Lineage OS image resize automatically the partition to 1G (sic!) so I'm trying this workaround:

  1. Install Lineage OS
  2. Reboot and wait for Android OS
  3. Reboot in TWRP
  4. Resize the partition
  5. Install the other zips
1
  • I am doing this on Motorola G2 (2014). Unfortunately, it freezes at point where we write the resizepart modifications (in step e). Also, is step n totally different and separate than above mentioned or is it following the above steps?
    – Abhijeet
    Commented Jun 22, 2021 at 8:18
3

Another workaround to LOS resizing of the System partition during the install process:

  1. resize the System partition (as described above, I shrinked the cache partition instead)
  2. install LOS via ADB sideload
  3. run resize2fs /dev/block/mmcblk0p25 to resize the EXT4 partition again
  4. install the GApps via sideload

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .