Monday, January 13, 2020

cyanogenmod - Resize /system partition of Galaxy S 2


I need to increase the size of my Galaxy S 2's /system partition from 503.4MB to... Well, anything possible.


The (main) reason why I want to do this is because I want to install GApps 20140606, which is not compatible with devices with small (under 500MB) /system partitions.


The Galaxy S 2's internal storage is 16GB but I mostly use my SD card, so I don't really care how much of this will be taken to use in the /system partition.



I've found a lot of pages explaining different methods to achieve this, like this one from TechoTV, and this one from XDA, but all of them were phone-specific and never gave the information if it would be compatible with other models or not, or they would resize to a specific set size.


There's also this question from Android SE, but the answer weren't satisfactory enough for me, as the author limited himself to only say that it is possible, but not saying how.


To add a few more information, the phone is rooted and with CyanogenMod 11 (20140806-NIGHTLY), which is Android 4.4.4.


It would be interesting if the information provided works under Linux. I have access to Windows but rather not have to use it.


Aren't there any simple way of resizing the partitions, like GParted (but for Android)?



Answer




I made this following this great tutorial at XDA-Developers by user metalgearhathaway: http://forum.xda-developers.com/galaxy-s2/development-derivatives/mod-partition-internal-memory-app-t2538947


I used PIT files (I'll explain what they are, don't worry) made from user ElGamal from XDA also, located here (comment number 509).


And a little bit of help from user CrackDaddy, also from XDA.





  • A machine running Windows. I used Windows 7 Ultimate 64-bits;

  • Odin 3.07. Careful when installing, it is full of optional AdWares. There's also a Linux and Mac version available called JOdin3, but I didn't try it;

  • Flashable ClockWorkMod 6 for Galaxy S II (it is a .tar file with a file named zImage inside);

  • PIT file with desired partition table configuration;

  • Samsung drivers for Galaxy S2. Usually you can install Samsung Kies but there's also a installer just with drivers available;

  • Your original stock unrooted Samsung Jellybean firmware. You can find it at sammobile.com;

  • Any ROM of your choice. I highly recommend the last nightly build of Cyanogenmod 11;

  • Optionally: GApps 20140606 or newer.



I made most of those available in the following bundle file: https://drive.google.com/open?id=0BxccpydIocBpd21FOE5MaGJiMkU&authuser=0


What is missing is GApps, CyanogenMod, and a stock Samsung JellyBean ROM (as it depends of country and carrier, and might not be legal to provide it here).




I am not responsible for anything that might go wrong with your device, neither any of the mentioned users nor anyone here at Stack Overflow or XDA-Developers. This procedure will root your phone if it isn't already and also void your warranty if it isn't already. If anything goes wrong, don't panic, it is most likely fixable by reflashing the stock ROM and starting over again.




This will only work with the 16GB International version (GT-I9100) of Samsung Galaxy S II


Firstly, copy CyanogenMod 11 .zip file (or your desired ROM) and optionally GApps .zip file to your external SD card;



Make a backup of everything inside your internal storage, copy it to your computer or somewhere else. It will be completelly erased. Don't worry about your external SD Card, it won't be touched.


Make a NAnd backup of your current ROM, you'll be able to restore it after the repartition. To do it, you must have ClockWorkMod recovery installed, then boot your phone into recovery mode (Volume UP + Home + Power), select backups and restore, then backup to /storage/sdcard1;


When backup finishes, reboot your phone into Download mode (Volume DOWN + Home + Power) and connect your phone to the computer. Let Windows install the drivers. If it fails, try to install Samsung Kies or just the drivers provided in the bundle I made available, and try again.


Open Odin3 as Administrator and connect the phone. It should detect your phone and show it under the label ID:COM, and also in the Message. If it didn't, try to restart your computer, phone, reinstall drivers, check your USB cable, etc., and try again.


Now you'll need to choose a PIT file. PIT means Partition Information Table and it is a Samsung-only thing. In the bundle file, I made available ElGamal's PIT file (I91001GB_6GB.pit) which also resizes /system partition to 1GB, /data to 6GB and the rest goes to internal storage. If you wish different sizes, check the thread at XDA-Developers as he made many different versions available. I also included a PIT file for the default configuration (I9100_2GB-STOCK.pit) if you wish to go back to as it was later.


When you have chosen your PIT file, go to Odin and tick the following checkboxes: Re-Partition, Auto Reboot and F. Reset Time. In the Re-Partition section, click on the PIT button and select your chosen PIT file. In the Files (Download) section, click on the AP button and select Samsung's stock JellyBean ROM. Double check everything and click Start. This can take a while, go grab a coffee.


After everything finishes, your phone will reboot into the stock Samsung JellyBean ROM. Two things can happen now, or it will work normally and if so you can use it and check if everything is as you want. Or it can ask you for a password to access the "encrypted volume", which is nothing but your internal storage that is not formatted. In both ways, unplug your phone (it it's still plugged) and reboot it into Download mode again.


It is interesting to close and reopen Odin3 to reset the settings. Plug your phone again and wait until Odin3 detects it. This time, leave checked just Auto Reboot and F. Reset Time and make sure Re-Partition is NOT checked. Click on AP button and select the ClockWorkMod Recovery .tar file, then click Start. This one is faster, but if you feel sleepy, go for another coffee ;)


When it finishes, you should have ClockWorkMod Recovery 6 installed in your phone, so go ahead and reboot into Recovery mode. Go to mounts and storage, select format /storage/sdcard0 and format it as exfat (if for some reason you have write problems in your internal storage later, come back here and select another format until it works, but exfat should do the trick).


When it finishes, still in Recovery mode, Wipe data/factory reset, Wipe cache and Wipe Dalvik cache. Let's be sure nothing remains from the previous ROMs.



Now, install zip -> choose zip from /storage/sdcard1 and select the CyanogenMod 11 .zip file (or of your desired ROM) and flash it. Optionally also flash GApps afterwards. Reboot your phone and check if everything is right.


If everything is right, reboot your phone into Recovery mode again, do a new wipe data/factory reset, wipe cache and wipe Dalvik cache, and then recover your backed up ROM from the beginning. Reboot your phone.


Check again if everything works right. A few apps might need to be reinstalled (Spotify and Waze are examples) to work correctly again, but that's be only major issue.


Hope everything goes well.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...