The Problem
This is a weird one. I updated my Samsung S2 to Cyanogenmod 13.0 (cm-13.0-20160528-NIGHTLY-i9100 / Android 6.01) which went well but every time I tried installing the GApps I got the error ’Not enough room on the system partition to install’. At first I check my drives and there was room on the SD card and data partition. These are not the system partition which was my first mistake. The system partition on an S2 is on 500mb in size so it is only just enough room for CM13.0 but not GAPPS as well.
The Fix/Theory
In simple terms we need to alter the partition sizes. The S2 comes with a 16GB flash chip but for some reason Samsung on gave 500mb to the system partition and 2.0GB to the data partition.
We will make the system partition larger and while we are at it, make the data partition bigger. System partition will go to 1GB and the data partition will go to 6GB. The Internal SD will take the remainder and ends up about 7.5GB
What Are We Going To Do?
Now I have given you the idea of what we are going to achieve, here come the tricky bit. I have learnt this information from many different places to put together simple instructions especially for those who are not experienced at flashing but I do encourage you to read my instructions and then have a look at the links and research I have put together just in case I have got anything wrong.
To repartition the phone we will use the REPIT from Lanchon but that needs to have an IsoRec compatible Bootloader/Recovery in place otherwise issues will occur and could possibly brick your phone.
The ROM being loaded also needs to be IsoRec compatible I believe otherwise it might not load correctly. I am not 100% about this.
Because of how things are you most likely cannot just install the latest version of TWRP which is IsoRec compatible because it is only available in an img format. To get around this we will install an older version of TWRP which is available in zip format that can be installed from most Custom Recoveries. Once this old version of TWRP is installed we can then use it to install the newer version in the img package format. There are other ways to install the img package:
- HeimDall - I tried this and it doesn’t work. The software just give me errors and I don’t think the software has been updated in ages
- Side load – not 100% what this is
- ADB – via the command line
- Other Custom Recoveries
NB: I don’t think you can install the img packages via ODIN. ODIN is file system aware and I think img are binary files
Make sure your battery is charged and perform these actions whilst the phone is plugged into the mains.
Instructions
These instructions are geared for my Samsung Galaxy S2 i9100 Int
Overview
- Backup phone
- Install CM13 (IsoRec compatible ROM)
- Install old version of TWRP via a custom recovery to add img support
- Install TWRP 3 which is an IsoRec compatible recovery
- Run the REPIT software to repartition the Samsung S2 Flash Drive
- Install GAPPS
- Wipe cache and data
- Reboot
- Done
Full Instructions
Preparation
1. Download the following files to your PC
- recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip - This is an IsoRec compatible version of TWRP v2.8.7.0 by arnab in a zip format that you can install via most Recoveries. This is specific to a Samsung S2
or
twrp-3.0.2-0-i9100.zip (latest version in zip format) - twrp-3.0.2-1-i9100.img - This is a new official version of TWRP in img format for a Samsung S2
- lanchon-repit-20160415-system=1.0-data=same-sdcard=max-preload=min+wipe-i9100.zip
- This is REPIT by Lanchon for the Samsung S2
- The files are specific to your phone, if there is no file then you cannot use this method.
- You can request a file for the process
- SAMSUNG_USB_Driver_for_Mobile_Phones.zip - needed to connect to your phone, if not already installed
- cm-13.0-20160528-NIGHTLY-i9100.zip - Latest version of Cyanogen mod Android for the Samsung S2
- open_GApps-arm-6.0-micro-20160529.zip - CM13 / Android 6 compatible GAPPS
2. Rename the REPIT file
lanchon-repit-20160415-system=1.0-data=same-sdcard=max-preload=min+wipe-i9100.zip
-->
lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip
- I changed -data=same to -data=6
- This files will set 1GB system partition and a 6GB data partition
- The file name controls the repartitioning options
- The file is specific to the model of the phone
3. Copy the following files to your phones Internal SD Card
- recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip
- twrp-3.0.2-1-i9100.img
- lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip (note it is the one with the larger data partition)
- cm-13.0-20160528-NIGHTLY-i9100.zip
- open_GApps-arm-6.0-micro-20160529.zip
4. Backup all that is important to you, pick whatever method you prefer. A nandroid and a files backup is the best. Copy the backup of the phone on to your PC
Install Cyanogen mod 13
- Install cm-13.0-20160528-NIGHTLY-i9100.zip via recovery as normal
- Can be done later just before installing GAPPS, I found I had to do it this way because TWRP would not replace Clockworkmod. (or appeared so)
- It did install but when Clockworkmod rebooted to bootloader, Clockworkmod just re-loaded
- after I installed CM13 and booted to Recovery, TWRP loaded without re-installing it again meaning it must of installed previously but Clockwordmod did not properly unload from memory
- NB as ever, it is better to wipe your cache and do a factory reset to prevent incompatibilities
Upgrade the Recovery with IsoRec compatible TWRP
- Install an old version of TWRP via recovery (recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip)
- SD Card might of got wiped here
- We have to install an old version of the TWRP so we can install the latest version of TWRP which is in img format.
- If your custom recovery supports the install of img files you can probably skip this step
- Reboot to recovery - This loads TWRP v2.8.7.0
- Upgrade to the latest vcersion of TWRP (twrp-3.0.2-1-i9100.img)
- Flash twrp-3.0.2-1-i9100.img via TWRP - When prompted which partitions to flash, select Recovery
- Reboot to Recovery - this loads the new TWRP v3.0.2.1
Repartition the Flash Drive
We now are going to repartition the drive which is very simple, when you know how. This will give a 1gb system partition and a 5.91GB data partition, the internal SD Card will take the rest of the space which is about 7.49GB
- Plug your phone into the mains if not already.
- Assuming you are still in TWRP v3.0.2.1 , Browse to and flash the REPIT file:
lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip - It most likely will fail first time and say it has copied itself to the /tmp/ directory. This is fine. If it actually processes your phone skip flashing from the /tmp/ directory steps.
- Browse to /tmp/ in TWRP by going up one level in the folder tree
- Flash the REPIT file in the /tmp/ directory:
/tmp/lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip - The partitions will now get resized. Mine took about 15 minutes and kept the /system/ files, possibly the /data/ files and the Internal SD Card files. I did not have that much on my phone, possibly a 200mb – 300mb, so you time might vary.
- Perform a System Reboot to make sure Android loads and runs ok and the partitions are the correct size etc... (optional)
Install GAPPS
- Reboot back in to recovery and install GAPPS
- Flash this file via the recovery partition open_GApps-arm-6.0-micro-20160529.zip
- Clear /Cache/ and /data/ partitions
- A Factory Reset as might remove GAPPS (check this)
- Perform a System Reboot
Final Settings
- CM13 will now load and you should setup as normal.
- Once you have setup the phone, make sure that Cyanogen mod is not configured to replace the bootloader as I am not 100% sure if this will stop things working or if it was just whilst repartitioning the drive. This option is found in the Developer Options.
- Finished
Done, What Now?
You now should have a Samsung S2 with a much larger system and data drive. Dont forget you can always re-run this process and make the drives larger, but for now you can just use your phone for flashing ROMs as you have in the past. The only exceptions I can see is do not flash stuff by ODIN as I do not know if it will break anything.
Notes
These are my notes I made whilst I figured all of this out, which would of not been possible without the guys who did the all of the programming.
Flashing Compatible TWRP
- TWRP for Samsung Galaxy S2 i9100 – Official Home Page for the Samsung S2
- Installing TWRP 3 the Easy Way – This shows you how you can load TWRP img file via ADB. (it is also the IsoRec homepage)
- [RECOVERY] [ISOREC] [TWRP 3.0.2-1] [OFFICIAL] [26/04/2016] (Official thread by arnab)
- Flash via Recovery
- Flash via Heimdall Suite (Windows only)
- Update via Recovery
- Side Load
- Can you get a new compatible recovery via the play store?
- Two things I found:
- adb side load isn't actually exposing any adb, but instead creates a "USB storage" device
- when files are copy-pasted via MTP, last modified date is changed
IsoRec
- IsoRec is a new feature which I believe allows for the use of a combined recovery/bootloader partition. Either way bootloader either support it or they don’t.
- [MOD] IsoRec: Isolated Recovery for the Galaxy S2 – XDA Developers thread explaining what this technology is
- [RECOVERY] [ISOREC] [TWRP 3.0.2-1] [OFFICIAL] [26/04/2016]
- XDA Developer thread for TWRP 3.0.2-1
- Maintained by arnab
- This has various installation instructions
- Flash via Recovery
- Flash via Heimdall Suite (Windows only)
- Update via Recovery
- Download links for:
- HeimdallSuite_v1.4.0.zip
- SAMSUNG_USB_Driver_for_Mobile_Phones.zip
- The i9100 does not support a separately bootable recovery partition. To install and use TWRP, you will need to install a custom kernel or boot image that supports IsoRec
- CM12.1 and CM13 has IsoRec support
REPIT
- GitHub Homepage
- This site has some very good instructions on how it works
- The example instructions and filenames are for the i9100
- Original XDA Developers thread (no longer updated)
- The Software
- A Device-Only Data-Sparing Repartitioning Tool For Android (keeps your data)
- The REPIT files are Phone specific
- The operations are controlled by the filename
- Use of this requires an IsoRec compatible Recovery to be installed
PIT Files
- i9100 PIT with 1.5GB System e.g. for CM13 with Full GApps [PIT-files] i9100-1.5gbSystem-6gbData (the.gangster - XDA)
- PIT file with 1GB system and 12GB data for I9100 download here I91001GB_12GB.zip (Dr AM - XDA)
Cyanogen mod
- You need to make sure that you install GAPPS and CM13 at the same time otherwise it might go mental (check this)
- I have not seemed to of had any problem but if you install GAPPS before 1st use, the Google wizard runs on first boot. This might also happen when you install GAPPS later but I am not sure.
- CM 13.0 Release 1 – Official blog post. It outlines some issues.
- CM13.0 is funny about installing GApps apparently. You must install both packages at the same time (CM and GApps) with no reboot otherwise it might go mad. I have not seen this.
- Samsung Galaxy S2 by CNBLACK ROM set which Contains
- cm-12.1-20160406-UNOFFICIAL-i9100.zip
- cm-12.1-20160406-UNOFFICIAL-i9100.zip.md5sum
- Cyanogen Recovery - i9100.tar - An ODIN Flashable Recovery
Heimdall
- The interface claim error was a bug in libusbx, and should be fixed in Heimdall 1.41RC2
- https://forum.cyanogenmod.org/topic/67084-error-claiming-interface-failed/
- http://glassechidna.com.au/heimdall/
- this mentions about being on a usb3.0 controller or a USB hub
- When I swapped to another USB port I got the following error:
ERROR: Failed to access device. libusb error: -12 - Installing and using HeimDall Suite to install latest TWRP Recovery
- After using Heimdall, don’t forget to remove the drivers you install with zadiag, by using zadiag to reverse the process. Instructions are in the Heimdall readme.
- When I first ran Heimdall-frontend.exe , both in normal and admin, I got the following error when downloading the PIT. It seems to be quite common and a known bug.
Heimdall v1.4.0 Copyright (c) 2010-2013, Benjamin Dobell, Glass Echidna http://www.glassechidna.com.au/ This software is provided free of charge. Copying and redistribution is encouraged. If you appreciate this software and you would like to support future development please consider donating: http://www.glassechidna.com.au/donate/ Initialising connection... Detecting device... Claiming interface... ERROR: Claiming interface failed!