[GUIDE] [DANGEROUS] Resize system partition

Search This thread

arch-dev

Member
Aug 14, 2020
31
33
Padua

WARNING

Code:
This process is extremely dangerous. You may brick your device.
Do it only if you know what you are doing!
I am not responsible of bricked devices or dead sdcards.

Hello guys,
I've decided to write this guide since this seems to be the only way to resize system partition to install larger GSIs.

Before starting remember to always make a backup since you will loose all your data.
Also DO NOT DO a simple copy-paste compare with yours first and if you have any doubts write in the comments before enter the doubtful command. Prevention is better than cure!!
This process has been tested on my own device but it has not been tested restoring stock firmware.

(You can also join the telegram group to ask for help https://t.me/MotorolaOneAction)

Requirements

  1. Latest TWRP downloaded (to be booted through fastboot later)
  2. Parted arm64 static binary (attached below)
  3. Latest fastboot and ADB commands installed
  4. Patience

Process

  1. Boot to TWRP from fastboot
  2. Run the following commands:
    Code:
    adb push /path/to/parted /sbin/parted
    adb shell
    chmod 777 /sbin/parted
    parted /dev/block/sda
    p free
  3. Now parted will list your partition table which should be like this:
    partition_table_kane.PNG
  4. Save the output of the command above (this is very important to restore original partition table if you will run into issues in the next parts)
  5. Now with extreme attention type
    Code:
    rm partition_number
    replacing partition_number with the number of the partition following the reverse order until you reach system_b partition removing it too . In my case I'll type:
    Code:
    rm 42
    rm 41
    rm 40
    rm 39
  6. Once you removed these partition it's time to recreate them following the original order but increasing the target partition size, in our case system_b. Type
    Code:
    mkpart name fs_type start end
    replacing name with the original partition name (refer to the command output you saved at point 5), fs_type with original file system type, start with the end value in MB of the previous partition, and end with start + size, where size will be the size of the target partition (size is the original size of the partition except for system_b which I've decided to change to 4221MB, 1000MB larger than original one). If it says that the partition isn't aligned, type Ignore. In my case I'll type:
    Code:
     mkpart system_b ext4 5630MB 9851MB
     mkpart oem_a ext2 9851MB 9918.1MB
     mkpart oem_b ext2 9918.1MB 9985.3MB
     mkpart userdata ext4 9985.3MB 128GB
  7. Now restore the partition flags typing
    Code:
    set partition_number msftdata on
    replacing
    partition_number with the number of the partition. In my case I'll type:
    Code:
    set 39 msftdata on
     set 40 msftdata on
     set 41 msftdata on
     set 42 msftdata on
  8. Now type again
    Code:
    p free
    and compare the output with the original table saved before, they should be quite identical.
  9. Type:
    Code:
    quit
     exit
  10. Reboot to bootloader and boot again into TWRP
  11. If in the logs you see lot of red lines saying it could not mount oem partition and userdata partition don't panic, it is normal since they have not been formatted yet (they are registered into fstab with a different file system type). Type:
    Code:
    adb shell
    mkfs.fs_type /dev/block/sdapartition_number
    replacing fs_type with original file system type, partition_number with the number of the partition. In my case I'll type:
    Code:
    adb shell
    mkfs.ext4 /dev/block/sda39
    mkfs.ext2 /dev/block/sda40
    mkfs.ext2 /dev/block/sda41
    mkfs.f2fs /dev/block/sda42
  12. Now reboot to bootloader and again into TWRP. Logs now should be free of red lines and you should be able to mount all partitions again.
  13. You have done it!! Now you are able to flash larger GSI (I suggest you doing it from TWRP since fastboot may have some problem recognizing the resized partition size, also remember to change the active slot to the resized one, in my case the slot b)
 

Attachments

  • parted.zip
    443.3 KB · Views: 1,758
Last edited:

arch-dev

Member
Aug 14, 2020
31
33
Padua
Vanilla GSIs will work without this. But larger GSIs that include Gapps will not because they are larger than system partition (like Pixel Experience, dotOS with Gapps, etc.). You can still flash vanilla build and Gapps zip of course to avoid doing this.
Regarding Android 12 I have not tried it yet.
 
  • Like
Reactions: GMB (Moto one zoom)

fuccschool

New member
Aug 11, 2021
2
4
please someone port postmarketos to this device, kane has a lot of potential

edit: i'm talking about pmos, because this resizing process has sense only for postmarket, if any other roms are bigger than system part, than they are just bloated worthless ****s.
 
  • Like
Reactions: GMB (Moto one zoom)

shahrair

Member
Jul 7, 2018
46
2
sorry to bother you.
i found your post after long time of searching. I'm noob for installing GSI,to do so i need to resize system partition.but i have zero idea about resizing and also seems like its very critical,and if i made any mistake to resizing it i may have to lost my phone forever.
I'm here to make a request to you that if you help me out to resize partition by a easiest way .i hope you won't reject me. I'm really fed up about resizing.here is my device details
phone: mi 8 pro
codename: equuleus
Rom : 128 GB
Default system partition size : 2.74GB

Hope you will help me
 
  • Like
Reactions: GMB (Moto one zoom)

lol.mam

New member
sorry to bother you.
i found your post after long time of searching. I'm noob for installing GSI,to do so i need to resize system partition.but i have zero idea about resizing and also seems like its very critical,and if i made any mistake to resizing it i may have to lost my phone forever.
I'm here to make a request to you that if you help me out to resize partition by a easiest way .i hope you won't reject me. I'm really fed up about resizing.here is my device details
phone: mi 8 pro
codename: equuleus
Rom : 128 GB
Default system partition size : 2.74GB

Hope you will help me
what did you do wrong?
 
  • Like
Reactions: GMB (Moto one zoom)

GMB (Moto one zoom)

New member
Aug 19, 2022
1
0
as partições ( parted /dev/block/mmcblk0 )e (parted /dev/block/sda) não contém partições, mas as
(parted /dev/block/sdb) (parted /dev/block/sde) (parted /dev/block/sdf) contém as partiçoes. posso trabalhar nelas??




SDF (parted) parted /dev/block/sdf
Number Start End Size File system Name Flags
1 131kB 655kB 524kB aop_b
2 655kB 4850kB 4194kB tz_b
3 4850kB 5374kB 524kB hyp_b
4 5374kB 5505kB 131kB storsec_b
5 5505kB 5636kB 131kB devcfg_b
6 5636kB 6160kB 524kB keymaster_b
7 6160kB 6685kB 524kB cmnlib_b
8 6685kB 7209kB 524kB cmnlib64_b
9 7209kB 7471kB 262kB prov_b
10 7471kB 8520kB 1049kB abl_b
11 8520kB 8602kB 81.9kB qupfw_b
12 8651kB 10.7MB 2097kB uefisecapp_b
13 10.7MB 10.8MB 32.8kB multiimgoem_b
14 10.8MB 10.8MB 32.8kB multiimgqti_b
15 10.8MB 10.9MB 65.5kB vbmeta_b
16 10.9MB 36.0MB 25.2MB ext2 fsg_b
17 36.0MB 183MB 147MB ext2 modem_b
18 183MB 216MB 33.6MB ext4 dsp_b
19 216MB 217MB 1049kB ext2 bluetooth_b
20 217MB 251MB 33.6MB logo_b
21 251MB 318MB 67.1MB boot_b
22 318MB 343MB 25.2MB dtbo_b
23 343MB 1149MB 805MB ext2 vendor_b
24 1149MB 4638MB 3490MB ext2 system_b
25 4638MB 4949MB 310MB ext2 oem_b


SDB parted /dev/block/sdb
Number Start End Size File system Name Flags
1 131kB 139kB 8192B ssd
2 262kB 33.8MB 33.6MB ext4 persist
3 33.8MB 42.2MB 8389kB ext4 prodpersist
4 42.2MB 43.3MB 1049kB misc
5 43.3MB 43.8MB 524kB keystore
6 43.8MB 44.3MB 524kB frp
7 44.3MB 44.8MB 524kB utags
8 44.8MB 45.4MB 524kB utagsBackup
9 45.4MB 45.5MB 131kB cid
10 45.5MB 62.3MB 16.8MB metadata
11 62.3MB 70.6MB 8389kB kpan
12 70.6MB 79.0MB 8389kB sp
13 79.0MB 95.8MB 16.8MB carrier
14 95.8MB 97.9MB 2097kB modemst1
15 97.9MB 100MB 2097kB modemst2
16 100MB 100MB 131kB fsc
17 100MB 100MB 32.8kB dhob
18 100MB 100MB 4096B devinfo
19 100MB 109MB 8389kB logfs
20 109MB 109MB 262kB apdp
21 109MB 117MB 8389kB spunvm
22 117MB 118MB 524kB uefivarstore
23 118MB 118GB 118GB userdata


SDE (parted) parted /dev/block/sde
Number Start End Size File system Name Flags
1 131kB 655kB 524kB aop_a
2 655kB 4850kB 4194kB tz_a
3 4850kB 5374kB 524kB hyp_a
4 5374kB 5505kB 131kB storsec_a
5 5505kB 5636kB 131kB devcfg_a
6 5636kB 6160kB 524kB keymaster_a
7 6160kB 6685kB 524kB cmnlib_a
8 6685kB 7209kB 524kB cmnlib64_a
9 7209kB 7471kB 262kB prov_a
10 7471kB 8520kB 1049kB abl_a
11 8520kB 8602kB 81.9kB qupfw_a
12 8651kB 10.7MB 2097kB uefisecapp_a
13 10.7MB 10.8MB 32.8kB multiimgoem_a
14 10.8MB 10.8MB 32.8kB multiimgqti_a
15 10.8MB 10.9MB 65.5kB vbmeta_a
16 10.9MB 36.0MB 25.2MB ext2 fsg_a
17 36.0MB 183MB 147MB ext2 modem_a msftdata
18 183MB 216MB 33.6MB ext4 dsp_a
19 216MB 217MB 1049kB ext2 bluetooth_a
20 217MB 251MB 33.6MB logo_a
21 251MB 318MB 67.1MB boot_a
22 318MB 343MB 25.2MB dtbo_a
23 343MB 1149MB 805MB ext2 vendor_a
24 1149MB 4638MB 3490MB ext2 system_a
25 4638MB 4949MB 310MB ext2 oem_a
 
Feb 16, 2023
29
2
My device: SM-A528B
Hello, I need to increase the partition for GSI. Could you please help me? Which section should I enlarge and what commands should I enter? (I tried to do everything according to the instructions, but I had questions and nothing happened)
1. I put the file (parted) in the root of the disk (C) and wrote (adb push C:/parted /sbin/ parted) is that correct?
2. What should I enter in (fs_type), (msftdata) if I have spaces here?
3. After the second input (p free), I lost the names of the modified sections.
4. The red lines in TWRP did not disappear anywhere and I could not boot into the system.
 

Attachments

  • screenshot.PNG
    screenshot.PNG
    50.8 KB · Views: 73

Tahir Jamil

Member
May 8, 2021
41
6
Hi, how can i add partition like product and vbmeta, tried to add using "mkpart PRODUCT ext4 start end" then "mkpart VBMETA space start end" it added but cant flash using twrp, tried on fastboot "Fastboot flash product product.img" then same with vbmeta. but nothing works, zip files cant mount those. Please help
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 6

    WARNING

    Code:
    This process is extremely dangerous. You may brick your device.
    Do it only if you know what you are doing!
    I am not responsible of bricked devices or dead sdcards.

    Hello guys,
    I've decided to write this guide since this seems to be the only way to resize system partition to install larger GSIs.

    Before starting remember to always make a backup since you will loose all your data.
    Also DO NOT DO a simple copy-paste compare with yours first and if you have any doubts write in the comments before enter the doubtful command. Prevention is better than cure!!
    This process has been tested on my own device but it has not been tested restoring stock firmware.

    (You can also join the telegram group to ask for help https://t.me/MotorolaOneAction)

    Requirements

    1. Latest TWRP downloaded (to be booted through fastboot later)
    2. Parted arm64 static binary (attached below)
    3. Latest fastboot and ADB commands installed
    4. Patience

    Process

    1. Boot to TWRP from fastboot
    2. Run the following commands:
      Code:
      adb push /path/to/parted /sbin/parted
      adb shell
      chmod 777 /sbin/parted
      parted /dev/block/sda
      p free
    3. Now parted will list your partition table which should be like this:
      partition_table_kane.PNG
    4. Save the output of the command above (this is very important to restore original partition table if you will run into issues in the next parts)
    5. Now with extreme attention type
      Code:
      rm partition_number
      replacing partition_number with the number of the partition following the reverse order until you reach system_b partition removing it too . In my case I'll type:
      Code:
      rm 42
      rm 41
      rm 40
      rm 39
    6. Once you removed these partition it's time to recreate them following the original order but increasing the target partition size, in our case system_b. Type
      Code:
      mkpart name fs_type start end
      replacing name with the original partition name (refer to the command output you saved at point 5), fs_type with original file system type, start with the end value in MB of the previous partition, and end with start + size, where size will be the size of the target partition (size is the original size of the partition except for system_b which I've decided to change to 4221MB, 1000MB larger than original one). If it says that the partition isn't aligned, type Ignore. In my case I'll type:
      Code:
       mkpart system_b ext4 5630MB 9851MB
       mkpart oem_a ext2 9851MB 9918.1MB
       mkpart oem_b ext2 9918.1MB 9985.3MB
       mkpart userdata ext4 9985.3MB 128GB
    7. Now restore the partition flags typing
      Code:
      set partition_number msftdata on
      replacing
      partition_number with the number of the partition. In my case I'll type:
      Code:
      set 39 msftdata on
       set 40 msftdata on
       set 41 msftdata on
       set 42 msftdata on
    8. Now type again
      Code:
      p free
      and compare the output with the original table saved before, they should be quite identical.
    9. Type:
      Code:
      quit
       exit
    10. Reboot to bootloader and boot again into TWRP
    11. If in the logs you see lot of red lines saying it could not mount oem partition and userdata partition don't panic, it is normal since they have not been formatted yet (they are registered into fstab with a different file system type). Type:
      Code:
      adb shell
      mkfs.fs_type /dev/block/sdapartition_number
      replacing fs_type with original file system type, partition_number with the number of the partition. In my case I'll type:
      Code:
      adb shell
      mkfs.ext4 /dev/block/sda39
      mkfs.ext2 /dev/block/sda40
      mkfs.ext2 /dev/block/sda41
      mkfs.f2fs /dev/block/sda42
    12. Now reboot to bootloader and again into TWRP. Logs now should be free of red lines and you should be able to mount all partitions again.
    13. You have done it!! Now you are able to flash larger GSI (I suggest you doing it from TWRP since fastboot may have some problem recognizing the resized partition size, also remember to change the active slot to the resized one, in my case the slot b)
    2
    Yep, but partitions like /system /vendor /system_ext and product do not appear, is it because of super partition?
    1
    Vanilla GSIs will work without this. But larger GSIs that include Gapps will not because they are larger than system partition (like Pixel Experience, dotOS with Gapps, etc.). You can still flash vanilla build and Gapps zip of course to avoid doing this.
    Regarding Android 12 I have not tried it yet.
    1
    please someone port postmarketos to this device, kane has a lot of potential

    edit: i'm talking about pmos, because this resizing process has sense only for postmarket, if any other roms are bigger than system part, than they are just bloated worthless ****s.
    1
    Some devices also use /dev/block/mmcblk0 instead of /dev/block/sda