[Galaxy Ace II Android Development] judas1977:
DISCLAIMER!

Operations on phone’s partition could be EXTREMALY dangerous.

As You surely expect - I take no resposibility if something will go... not as it supposed to. The responsibility for potential damages caused by using this guide is Yours, and Yours only!

New system partition scheme is “designed” for custom ROMs NOT based on original Samsung firmwares (because of it’s size and using /preload partition, which we intend to extremely resize;)), to name just a few reasons).​

The method of modification is created by [MENTION=5464206]Tesla-MADAL93[/MENTION] from Galaxy Advance sub-forum, all credits should go to him!!! He spend many hours using trials and errors method to achieve final success.

Part ONE: Preparations / theory.

1.Procedure requires any Linux distro with usb connection configured (tested on Ubuntu 12.04 LTS).

2.Working ADB (android debug bridge) – you don’t need to install whole ADK, just adb file with correct path added.

[EDIT/CAUTION]You can use Windows with adb configured, as proven by [MENTION=5050926]maxprzemo[/MENTION], but I wasn’t tested by author of this guide!

3.It is strongly recommended to make a backup of your apps and data before start (using titanium backup or simipar app) Restoring nandroid backup will destroy your new partitions, so don’t use it!!!

4.With this method “safe partiotions” of phone’s eMMC memory are being removed and recreated „safe” using „parted” command in adb shell mode. Some partitions are extremely decreased, one is totally deleted. And the most important – partition of your choice will be expanded. Example displayed below sets internal (DATA) partition as large as possible (almost;)).

5.You will need external micro SD card after remodelling partitions;))

6.Memory swap (SD0 and SD1) required BEFORE first start of your chosen ROM!!!

7.You can restore original partition scheme using Heimdall or Odin (not tested by me, problems with Odin reported by the author of whole modification) with repartition selected.

8.Partition numbers and names are very important (crucial), so we need to create them correctly, setting beginning and the end of each one very carefully.

9.Last important thing! I use minimal gapps pack for every ROM. I didn’t tested if full gapss fit on new /system partition! You’ll have to check it by yourself!

Default partitions and sizes are displayed here:

​

With this guide you will achieve something like this:

[Side Note: this is just an example – you can make internal card (UMS partition) bigger, leaving /DATA partition intact, just to install bigger games – you’ll have to calculate your own values]

Part TWO: Repartition

OK., let’s do it! You have to perform all steps EXACTLY in described order!

1.Turn phone on in recovery mode, connect it to computer using usb cable.

2.Open terminal / console (Ctrl+Alt+T)

2a. Enter command:

adb devices

You should see device connected (some numbers and letters)

3.Write (press enter after each command):

adb shell
su
parted /dev/block/mmcblk0
unit kb
print

You should see default partition scheme (just as one first screen above)

OK., say goodbye to your old partitions. Deleting other partitions could (and probably – will) have irreversible consequences!!

Now we will delete partitions, starting from the last one:

rm 8
rm 11
rm 9
rm 4

Now you will encounter some error – despite of the unmounting partitions before abovementioned procedure - /cache partition is now mounted. Do not unplug phone, just enter “mount and storage” submenu in recovery, and unmount cache partition)

So let’s continue:

rm 4
rm 5
rm 3

You just deleted all “safe” partitions, enter to check this:

print

OK., it’s time to (re)create! 

(SYSTEM, partition 3)

mkpart primary 105906 525906

(CACHEFS, partition 4)

mkpart primary 3848809 3948809

(DATAFS, partition 5)

mkpart primary 525906 3848809

(HIDDEN, partition 8)

mkpart primary 3948873 3948937

(UMS, partition 9)

mkpart primary 3948809 3948873

Let’s rename them properly (probably you can do it in one mkpart command, but it doesn’t matter):

name 3 SYSTEM
name 4 CACHEFS
name 5 DATAFS
name 8 UMS
name 9 HIDDEN

Almost done, let’s check:

print

Nice? Of course it’s nice!!! ;))

One last thing – we have to make our magic /preload (HIDDEN) partition visible for phone [it won’t boot without it!!] Because recovery won’t format it properly, lets use parted command for a last time (wait after each command):

mkfs
y
9
ext2

Now you can unplug the phone and format (in recovery) partitions:

/system

/data

/cache

OK, as I said before – you’ll have to switch storages BEFORE using phone again.

For now – you will have to manage it by yourself, just to make it short:

-for 4.2.x ROMs you can use modified vold.fstab file

-for 4.3.x ROMs – you have to manually modify build.prop, or use available zip package that will do it for you (that method is supposed to work with 4.2.x ROMs, but I didn’t test it!)

-I never used any of 4.4.x ROMs, but as I heard, there is method for switching memories too.

WARNING!

I didn’t test the way back to original partition sizes! It was tested by tesla-Madal93 though…

Sometimes (when transfer ring from one android version ROM to other, or using some old version where /preload partition was set as SWAP) you will need manualny format HIDDEN partition, just as shown above:

in adb shell mode:

parted /dev/block/mmcblk0

mkfs
y
9
ext2

FINAL WORD: If you are not sure – DON’T DO IT!!!