[GUIDE] Overlapping Partition Tables? Let's fix that

Search This thread
WARNING! Main partition table overlaps the first partition by 6 blocks!
You will need to delete this partition or resize it in an other utility.


This guide is to help those, facing this message, who have been in a mixup when repartitioning their Google Pixel 2 XL devices with the introduction of Android 12 and later ROMs/GSI Images.

More specifically this situation occurs when one follows Dollscythe's 3.8GiB system guide, followed by my (PixelExperience) repartition script.

No worries, let's solve this.

DISCLAIMER:
I AM NOT RESPONSIBLE IF THESE FOLLOWING INSTRUCTIONS ARE NOT EXECUTED PROPERLY.
KINDLY TRIPLE CHECK THE COPIED COMMANDS BEFORE EXECUTING THEM.
ANY ALTERATION TO THE PARTITIONS NOT MENTIONED BELOW COULD CAUSE SERIOUS ISSUES.

Firstly, let's understand why this occurs. 🧐


When it comes to repartitioning using sgdisk, with the case of the PixelExperience repartition method, blocks strictly defined from a starting to an ending logical sector.
(FYI: 1 logical sector = 4096 bytes)

When a user follows Dollscythe's 3.8GiB system guide, using parted, in contrast to sgdisk, the logical system sectors are modified to allow 3.8GiB of size.
Whilst this method is ideal for those planning to either flash GSI images which require specifically a larger system image, rather than making use of both product and system_ext partitions on PixelExperience and other ROMs, it is not ideal to mix them both up with each other.
(Both product and system_ext partitions offload large data from the system image, with such system apps like GApps)

So to break this down:
  • System is modified to adapt to 3.8GiB.
  • Logical starting and ending sectors system_a, system_b, pstore, aes_a, aes_b, align_parti and userdata partitions are modified.
  • PixelExperience script attempts to delete stock partition's userdata, but instead conflicts with 3.8GiB table.
  • Partition table becomes overlapped. (numerical partition numbers are not in order)
That is why it is important to keep track of which partition table your device is currently running, before making any further alterations to your system's table.
To check your current partition table, reboot into a custom recovery that supports the ADB interface via platform tools and:
  • Code:
    adb shell
  • Code:
    sgdisk --print /dev/block/sda
The output of this command should indicate what table you are currently running, depending on the sizes of both system_a and system_b partitions (2.5GiB on stock), or any added ones such as product and system_ext.

So double check that you are running the stock partition table before undergoing any of the guides mentioned above.

It is also worth noting that Pixel 2 XL (taimen) devices, do not revert to the stock partition table upon flashing the stock image.
This behaviour is not the same for Pixel 2 (walleye) devices, as when the stock image is flashed, the partition table is reverted to default
.
(This is due to LG and HTC's bootloader behaving in different ways.)

Now, let's untie this knot!
Got the error now? Let's get started.


In short, we're going to undo the changes made, that includes both system_a and system_b partitions to the device, and redo it carefully.
Since sgdisk (installed on the device, by default) is unable to make any changes if it is found in an overlapping state, we will be using parted instead.

  1. Download parted
  2. Ensure you are in an ADB supported custom recovery.
  3. Using platform-tools on an external device, push parted to the device:
    Code:
    adb push path/to/parted /sbin
  4. Enter adb shell:
    Code:
    adb shell
  5. Change permissions of parted:
    Code:
    chmod 777 /sbin/parted
  6. Execute parted:
    Code:
    parted /dev/block/sda
  7. Print current partition table:
    Code:
    p free
  8. Remove overlapped partitions (when prompted, return ignore)
    Code:
    rm 17
    rm 16
    rm 15
    rm 12
    rm 11
    rm 10
    rm 9
    rm 8
  9. Recreate stock partitions
    Code:
    mkpart system_a ext4 169MB 2853MBmkpart system_b ext4 28533MB 5538MB
    mkpart pstore 5538MB 5546MB
    mkpart aes_a 5546MB 5547MB
    mkpart aes_b 5547MB 5548MB
    mkpart align_parti 5548MB 5549MB
    mkpart userdata ext4 5549MB 62400MB (for 64GB)
    mkpart userdata ext4 5549MB 126300MB (for 128GB)
  10. Wipe -> Format Data -> Yes
  11. Wipe -> Factory Reset
  12. Reboot -> Bootloader
That is what it takes to resort back to the stock partition table.
If done successfully (check via sgdisk --print /dev/block/sda), you can proceed to executing any repartition guide.
 

Cydras

Senior Member
Apr 20, 2011
219
176
Saarwellingen
Hello,
can someone please help me?

I tried to follow the guide to reset the partitions to default, but unfortunately it didn't work. Currently my partitions look like this:
partition.png


What must i do now to reset the partitions correctly?

I think only ext2 on system_a is incrorrect. It must be ext4?

@PixelBoot you have a small typing error on 9. Recreate Stock Partions:
mkpart system_a ext4 169MB 2853MBmkpart system_b ext4 28533MB 5538MB
On system_b you have 28533MB insteat of 2853MB


Edit: I think i have corrected it now:
new.png


I have make these additional steps in fastboot:
fastboot format:ext4 system_a
fastboot format:ext4 system_b
fastboot format:ext4 userdata


Device is booting now with Factrory Image :)
 
Last edited:
  • Like
Reactions: jam456

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    WARNING! Main partition table overlaps the first partition by 6 blocks!
    You will need to delete this partition or resize it in an other utility.


    This guide is to help those, facing this message, who have been in a mixup when repartitioning their Google Pixel 2 XL devices with the introduction of Android 12 and later ROMs/GSI Images.

    More specifically this situation occurs when one follows Dollscythe's 3.8GiB system guide, followed by my (PixelExperience) repartition script.

    No worries, let's solve this.

    DISCLAIMER:
    I AM NOT RESPONSIBLE IF THESE FOLLOWING INSTRUCTIONS ARE NOT EXECUTED PROPERLY.
    KINDLY TRIPLE CHECK THE COPIED COMMANDS BEFORE EXECUTING THEM.
    ANY ALTERATION TO THE PARTITIONS NOT MENTIONED BELOW COULD CAUSE SERIOUS ISSUES.

    Firstly, let's understand why this occurs. 🧐


    When it comes to repartitioning using sgdisk, with the case of the PixelExperience repartition method, blocks strictly defined from a starting to an ending logical sector.
    (FYI: 1 logical sector = 4096 bytes)

    When a user follows Dollscythe's 3.8GiB system guide, using parted, in contrast to sgdisk, the logical system sectors are modified to allow 3.8GiB of size.
    Whilst this method is ideal for those planning to either flash GSI images which require specifically a larger system image, rather than making use of both product and system_ext partitions on PixelExperience and other ROMs, it is not ideal to mix them both up with each other.
    (Both product and system_ext partitions offload large data from the system image, with such system apps like GApps)

    So to break this down:
    • System is modified to adapt to 3.8GiB.
    • Logical starting and ending sectors system_a, system_b, pstore, aes_a, aes_b, align_parti and userdata partitions are modified.
    • PixelExperience script attempts to delete stock partition's userdata, but instead conflicts with 3.8GiB table.
    • Partition table becomes overlapped. (numerical partition numbers are not in order)
    That is why it is important to keep track of which partition table your device is currently running, before making any further alterations to your system's table.
    To check your current partition table, reboot into a custom recovery that supports the ADB interface via platform tools and:
    • Code:
      adb shell
    • Code:
      sgdisk --print /dev/block/sda
    The output of this command should indicate what table you are currently running, depending on the sizes of both system_a and system_b partitions (2.5GiB on stock), or any added ones such as product and system_ext.

    So double check that you are running the stock partition table before undergoing any of the guides mentioned above.

    It is also worth noting that Pixel 2 XL (taimen) devices, do not revert to the stock partition table upon flashing the stock image.
    This behaviour is not the same for Pixel 2 (walleye) devices, as when the stock image is flashed, the partition table is reverted to default
    .
    (This is due to LG and HTC's bootloader behaving in different ways.)

    Now, let's untie this knot!
    Got the error now? Let's get started.


    In short, we're going to undo the changes made, that includes both system_a and system_b partitions to the device, and redo it carefully.
    Since sgdisk (installed on the device, by default) is unable to make any changes if it is found in an overlapping state, we will be using parted instead.

    1. Download parted
    2. Ensure you are in an ADB supported custom recovery.
    3. Using platform-tools on an external device, push parted to the device:
      Code:
      adb push path/to/parted /sbin
    4. Enter adb shell:
      Code:
      adb shell
    5. Change permissions of parted:
      Code:
      chmod 777 /sbin/parted
    6. Execute parted:
      Code:
      parted /dev/block/sda
    7. Print current partition table:
      Code:
      p free
    8. Remove overlapped partitions (when prompted, return ignore)
      Code:
      rm 17
      rm 16
      rm 15
      rm 12
      rm 11
      rm 10
      rm 9
      rm 8
    9. Recreate stock partitions
      Code:
      mkpart system_a ext4 169MB 2853MBmkpart system_b ext4 28533MB 5538MB
      mkpart pstore 5538MB 5546MB
      mkpart aes_a 5546MB 5547MB
      mkpart aes_b 5547MB 5548MB
      mkpart align_parti 5548MB 5549MB
      mkpart userdata ext4 5549MB 62400MB (for 64GB)
      mkpart userdata ext4 5549MB 126300MB (for 128GB)
    10. Wipe -> Format Data -> Yes
    11. Wipe -> Factory Reset
    12. Reboot -> Bootloader
    That is what it takes to resort back to the stock partition table.
    If done successfully (check via sgdisk --print /dev/block/sda), you can proceed to executing any repartition guide.
    1
    Hello,
    can someone please help me?

    I tried to follow the guide to reset the partitions to default, but unfortunately it didn't work. Currently my partitions look like this:
    partition.png


    What must i do now to reset the partitions correctly?

    I think only ext2 on system_a is incrorrect. It must be ext4?

    @PixelBoot you have a small typing error on 9. Recreate Stock Partions:
    mkpart system_a ext4 169MB 2853MBmkpart system_b ext4 28533MB 5538MB
    On system_b you have 28533MB insteat of 2853MB


    Edit: I think i have corrected it now:
    new.png


    I have make these additional steps in fastboot:
    fastboot format:ext4 system_a
    fastboot format:ext4 system_b
    fastboot format:ext4 userdata


    Device is booting now with Factrory Image :)