[Galaxy S II Android Development] Saber:
Increasing system partition size

Since there is no official thread for increasing the system partition size (not data partition size as there is one already), I've decided to make a thread. :)

Disclaimer:

This process will wipe all of your data off your phone. This includes all of your apps, system storage and internal sd card. It doesn't wipe your external sd card. Make sure to backup all of your apps and data to the cloud, micro sd card or onto a computer

Make a backup!! Why am I saying this again? Because there is always a few careless people who do this process and complain how they lost all of their data.

If you try to use the modified system partition with stock rom, your rom will not boot! You must revert to stock system partition sizes first then install stock rom!

What you need:

- A Samsung Galaxy S2 i9100 16GB International variant. You must have this model otherwise you will brick your device! Other models can use the lanchon repit tool.

- A kernel in .tar format. I highly recommend gustavo kernel as it doesn't suffer the formatting problem that dorimanx (using default recovery) or apolo kernel (TWRP) does. Pre-made files Update: DorimanX kernel supports isorec recoveries in the newest builds. Flashing a isorec recovery will remove this formatting limit and will be usable in all partition sizes.

- System pit files (Provided in the attachments)

- A PC (preferably Windows, if using OS X or linux, use JOdin instead!)

- A archiving/compression utility such as 7-zip or winrar. I recommend 7-zip because it is for free and it is open source.

- ODIN (to flash the kernel of course, again use JOdin for linux and OS X). Also, I have made ODIN installation easier with fewer options! :)

Benefits

Why do people increase the partition sizes? Here are some reasons why:

- Can allocate more storage space for more apps (removes the need for moving apps to sd card)

- Allows people to upgrade to android lollipop or marshmallow easier (if you don't want to go through any messages saying that there isn't enough space)

- Since it will delete everything, this will restore all lost space taken up by apps and other programs

- Gapps (Google Apps) will be much easier to install (you can choose larger gapps file if you want, only if you increase system partition). For CM12.1 and CM13, re-partitioning has become a necessity before flashing current gapps packages.

- Can fix soft bricks. However hard bricks can not be solved this way!

- Can fix problems with partition errors

Please note that this guide requires a PC and a working USB jack. If you don't meet these requirements, use lanchon's tool instead!

CM13 Nightlies have been released. Please note that the link to the premade .tar kernels are compatible up to Android Lollipop. You will still be able to repartition your device using Lollipop kernel! Since you will be reflashing or restoring CM13 during the process, marshmallow kernels are not required!

Instructions

Make a recovery backup (CWM or TWRP) onto your external sd card or PC (VERY IMPORTANT!!! All backups in internal sd card will be deleted so move them!)

Download the system pit files (attached in OP)

Extract the pit zip file

Open ODIN (Attached in the OP, JOdin for linux and OS X)

Connect your phone to your PC via USB while in download mode (make sure your phone is detected on ODIN, it should say COM:{number})

Click on the PIT button and locate and select your desired pit file

Click on PDA or AP and select your kernel .tar file (look at this post if you don't have one: Pre-made kernel tar Link)

Make sure that re-partition has been ticked then click start. If your phone successfully flashes, move onto the next step. If not, try changing usb ports, changing ODIN version, changing pit files or seeing if your device has a corrupt nand (or broken). If your memory chip is corrupt or broken, you won't be able to flash with ODIN (and you will need to buy a new motherboard). If you are still unsure what to do, look at the screenshot in the attachments.

Disconnect the USB cable. Take out your phone battery, then re-insert it.

Press and hold button combinations (home button + power button + volume up) to boot into recovery. You only need to hold for about 5 seconds.

If you have CWM recovery, go to mounts and storage then select format /sd card0 or /internal sd card. Select default and your internal sd card should successfully format. If not, try ext4 format. If you have TWRP recovery, you will need to go to wipe>advanced and select format emmc or /sd card0, then swipe to confirm . If you can successfully format your phone here, skip steps 11, 12, 13, 14. Note: DorimanX kernel doesn't support ext4 formatted sd cards. You will need to format your sd cards to vfat or fat32 for DorimanX kernel to detect.

----IF FORMATTING FAILS IN RECOVERY----

Connect your phone back to your PC.

If formatting sd card in recovery fails, connect your phone to your PC. While still in recovery (CWM), go to mounts and storage and select mount mass storage. If you have TWRP recovery, go to mount and select mount sd card. It should prompt you that the storage isn't ready yet and you need to format. If your PC still doesn't detect your phone, check if the proper drivers are installed (in attachments). Also, if your phone doesn't get detected and you've done everything in this step, try changing usb ports, computers and even usb cables.

Click format

You can leave all of the settings to default, I personally like to change the allocation size to 4KB (4KB is good if you want to make the most out of your phone's storage while having enough speed)

Click format.

----AFTER SUCCESSFULLY FORMATTING----

Go back to your phone. You can choose to restore from your backup or install a new rom. If you choose to restore from a backup, skip all of the remaining steps. (Note: DorimanX kernel recoveries can not format /data partition more than 2gb, use an alternative first when restoring a backup then flash back if needed)

In mounts and storage, choose format /data, /cache and /system (Note: DorimanX kernel recoveries can not format /data partition more than 2gb, use an alternative first then flash back if needed)

Now you can flash a ROM as you normally would

Huge thanks to ElGamal for providing the modified pit files and metalgearhathaway for providing the stock pit file and the.gangster for providing the 1.5GB system pit files.

I've also included ODIN and Samsung drivers in the attachments

Too difficult for you? Try Lanchon's flashable repartition zip