[Galaxy S III General] Sinyx:
I installed the Android 14 Alpha release from html6405 but was not able to install the BiTGApps Gapps. The error message was: "Insufficent partition size"

Well, luckily the S3 uses a standard partition table. I started with the guide from arch-dev and took a peek into this thread on Stack Exchange and the answer by elbarna.

I used TWRP in the version 3.7.0_9 but older versions may work too. You need also the adb tools on your computer. I used a sdcard inside the phone, to make backups. This is the most easist way, but you can connect an USB-Stick too. Just adapt the paths.

You need three binaries, that are not typically installed:

parted

This is a partition editor, that can enlarge existing partition. Sadly it can't move partitions anymore.

Here you can find a working binary for arm7.

gdisk

Like fdisk but for GPT partitions.

Grab her the gdisk32.zip on this post.

mkfs.ext4

To format your newly created partitions in the ext4 file system.

I found a working binary here.

Put those three binaries into a folder of your choice and point a cmd, powershell or unix shell of your choice to it.

Bring your phone into recovery mode so you have TWRP on the screen.

adb push mkfs.ext4 /sbin
adb push parted /sbin
adb push gdisk /sbin

Now log into your phone:

adb shell

And make your new binaries executable:

chmod 777 /sbin/mkfs.ext4
chmod 777 /sbin/parted
chmod 777 /sbin/gdisk

Now lets list the partitions of the phone:

gdisk /dev/block/mmcblk0

You should see this:

GPT fdisk (gdisk) version 1.0.10

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help):

List your partition table with the letter "p":

Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 12345678-9ABC-DEF0-1234-56789ABCDEF0
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 30777310
Partitions will be aligned on 2048-sector boundaries
Total free space is 16317 sectors (8.0 MiB)

Number Start (sector) End (sector) Size Code Name
1 8192 16383 4.0 MiB 0700 BOTA0
2 16384 24575 4.0 MiB 0700 BOTA1
3 24576 65535 20.0 MiB 0700 EFS
4 65536 81919 8.0 MiB 0700 PARAM
5 81920 98303 8.0 MiB 0700 BOOT
6 98304 114687 8.0 MiB 0700 RECOVERY
7 114688 180223 32.0 MiB 0700 RADIO
8 180224 2277375 1024.0 MiB 0700 CACHE
9 2277376 5423103 1.5 GiB 0700 SYSTEM
10 5423104 6569983 560.0 MiB 0700 HIDDEN
11 6569984 6586367 8.0 MiB 0700 OTA
12 6586368 30769151 11.5 GiB 0700 USERDATA

Command (? for help):

Quit the tool with the letter "q" for the moment.

Your partition table may look a little bit different, but it should be similar. We need to enlarge SYSTEM, but for that, we need more space around it.

As we can't move partitions, we have to delete them and recreate them later. So we have to backup those:

mkdir /external_sdcard/android_image_backups
dd if=/external_sdcard/android_image_backups/img_mmcblk0p10_HIDDEN_vendor.img of=/dev/block/mmcblk0p10
dd if=/external_sdcard/android_image_backups/img_mmcblk0p11_OTA.img of=/dev/block/mmcblk0p11

In my case the data partition was empty otherwise back it up too.

Now we can "securely" delete those partitions and make space to enlarge SYSTEM.

gdisk /dev/block/mmcblk0

You delete a partition with the letter "d". You have to delete the partitions 10 (HIDDEN aka vendor), 11 (OTA) and 12 (USERDATA). You write your changes with "w" back.

You have to reboot your phone as you have changed the partition table. I did it with TWRP and rebooted again into TWRP recovery mode.

Push again the binaries:

adb push mkfs.ext4 /sbin
adb push parted /sbin
adb push gdisk /sbin

Log in again:

adb shell

And make your binaries executable:

chmod 777 /sbin/mkfs.ext4
chmod 777 /sbin/parted
chmod 777 /sbin/gdisk

List your partitions with parted:

parted /dev/block/mmcblk0 print list all

You should see something like this:

Model: MMC VTU00M (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 4194kB 8389kB 4194kB BOTA0 msftdata
2 8389kB 12.6MB 4194kB BOTA1 msftdata
3 12.6MB 33.6MB 21.0MB ext4 EFS msftdata
4 33.6MB 41.9MB 8389kB PARAM msftdata
5 41.9MB 50.3MB 8389kB BOOT msftdata
6 50.3MB 58.7MB 8389kB RECOVERY msftdata
7 58.7MB 92.3MB 33.6MB RADIO msftdata
8 92.3MB 1166MB 1074MB ext4 CACHE msftdata
9 1166MB 2777MB 1611MB ext4 SYSTEM msftdata

Model: SD SL32G (sd/mmc)
Disk /dev/block/mmcblk1: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 31.9GB 31.9GB primary fat32 lba

The "resizepart" command of parted needs the partition number, but the new overall end.

In this case, you have to add to the old start value of the partition, the new value of it's size. I opted for 4GB, but you can of course chose another value. As this process of resizing isn't that fast I opted for a bigger size.

1166 + 4096 = 5262

So start parted in interactive mode:

parted /dev/block/mmcblk0

Resize the system partition:

resizepart 9 5262M

And quit the tool:

quit

Should you care about the content of your system partition, you can resize it with TWRP. In my case I simply formated it, because I would later install the Android 14 image. TWRP can resize the filesystem to the size of the partition. The image for Android 14 is smaller for example.

mkfs.ext4 /dev/block/mmcblk0p9

Now we recreate the old partitions and start with the hidden vendor partition.

gdisk /dev/block/mmcblk0

We want to create a new partition with the letter "n".

Partition number (10-128, default 10):

The old partition was the number 10 and we chose it again:

10

The default value for the starting sector of the new partition is fine:

10278912

Here is the line of the output from gdisk, before we resized SYSTEM:

10 5423104 6569983 560.0 MiB 0700 HIDDEN

We need the number of sectors of the old partition for our new partition:

6569983 - 5423104 = 1146879

Add that sector size to our new starting position:

10278912 + 1146879 = 11425791

Enter the calculated end sector into parted:

11425791

The type is "0700":

0700

Change the name:

c

Select this partition:

10

And enter it's old name:

HIDDEN

With that we have recreated that old partition. The content will be restored after the reboot. Now to the OTA partition.

Create a new partition with "n":

n

This partition was the number 11 and we chose it again:

11

The default value for the starting sector of the new partition is fine:

11425792

Here is the line of the output from gdisk, before we resized SYSTEM:

11 6569984 6586367 8.0 MiB 0700 OTA

We need the number of sectors of the old partition for our new partition:

6586367 - 6569984 = 16383

Add that sector size to our new starting position:

11425792 + 16383 = 11442175

Enter the calculated end sector into parted:

11442175

The type is "0700":

0700

Change the name:

c

Select the partition:

11

And enter it's old name:

OTA

At last we can create the new userdata partition.

n

The old partition was the number 12 and we chose it again:

12

For start and end values we can use the defaults.

The type is "0700":

0700

Change the name:

c

Select the partition:

12

And enter it's old name:

USERDATA

Write changes to disk:

w

And quit the gdisk:

q

Reboot with TWRP again into TWRP recovery as we have changed the partition table.

Push again the binaries:

adb push mkfs.ext4 /sbin
adb push parted /sbin
adb push gdisk /sbin

Log in again:

adb shell

And make your binaries executable:

chmod 777 /sbin/mkfs.ext4
chmod 777 /sbin/parted
chmod 777 /sbin/gdisk

Finally we can restore the data in those partitions:

dd if=/external_sdcard/android_image_backups/img_mmcblk0p10_HIDDEN_vendor.img of=/dev/block/mmcblk0p10
dd if=/external_sdcard/android_image_backups/img_mmcblk0p11_OTA.img of=/dev/block/mmcblk0p11

The first command will take some time.

And lastly format the new userdata partition:

mkfs.ext4 /dev/block/mmcblk0p12

And reboot again with TWRP into it. Now you can install bigger images!

Remember, that you only have changed the partition size and not the size of the filesystem. Most images will have smaller sizes. You can resize a filesystem with the help of TWRP. Just under "Wipe" -> "Advanced Wipe" select the partition and tap "Repair or Change File System". Depending on your image, it is sometimes needed to repair them before resizing. But there is a button for that too in that screen.

Sadly BitGapp does not worked for me. I could install it. It did some updates and then the phone couldn't get internet via WLAN. It could connect, but nothing more.

A big thanks to html6405, arch-dev, elbarna, DualJoe and xenosaur.