[Samsung Galaxy Star] LehKeda:
Repartitioning device storage .

Repartitioning device storage

​

After you read the thread I've mentioned before... start repartitioning your device,but actually I won't write every steps of repartitioning but I'll clear some points and give you important tips when you repartition the device .

Let me clear something, the way we are going to use is that we will cut some space from any unimportant partitions and glue it to kernel or recovery partition .

Tip 1 :

So what are the unimportant and important partitions ?

Important and dangerous partitions :

PIT , MD5HDR , Product info , DSP , Modem , odin reserved , EFS , ......

Unimportant and safe partitions :

System , User data , Cache partitions

This doesn't mean that you can mess up with those partitions, it's just mean that you can only take space from those partitions without any worries of break phone functions .​

Tip2 :

when you repartition the device you must know where you are and specify your situation ....

There are two situation :

Lucky one .

Unlucky one .

Lucky situation :

the lucky situation is that when your recovery and kernel partitions aren't next to any dangerous partitions.you will just cut some space of the unimportant partitions and glue it to kernel and recovery partition

like those ones ....

​

Unlucky situation :

the lucky situation is that when your recovery and kernel partitions are next to any dangerous partitions. so in this situation you will have to change and rearrange places of kernel and recovery partitions.

this is unlucky situation....

​

​

Tip3 :

If kernel and recovery partitions are next to each other and you're in the unlucky situation you will just need to move one partition from its place then give its space to the other partition and you should move the kernel partition and give its space for recovery partition as it's safer than moving recovery partition. In case you're in the lucky situation you will just cut the space of unimportant partition and glue it to the partition... look here :

This is unlucky situation :

kernel and recovery partitions are next to each other so I'll just delete kernel partition, cut some space of system partition, make that space for kernel partition and give old kernel partition space for recovery partition .

Before :

​

After :

​

This is the lucky situation :

You will remove kernel partition and safe_partition then make new kernel partition and new safe_partition, but leave some free space before kernel partition because you will add this space to recovery partition later when you make sure that you have done the steps correctly and the kernel is loaded.

Before :

​

After :

​

​

Tip4 :

If kernel and recovery partitions aren't next to each other and you are in lucky situation. You will cut some space and glue it to the partition you want .

And if you are in the unlucky situation you will just move the partition from its place, then cut some space from any safe partition and make this space for the kernel/recovery partition.

Tip 5 :

How much space should you make for kernel and recovery partitions ?

It's good to make each of them about 20~25 MG and don't go too high like 40 or more unless you really this much of space and keep in mind that you take this space from other partitions like system , user data or cache partitions .Also it's good to take the space from your system or cache partitions as you will not need them a lot like user-data partition .

Tip 6 :

Be organized and do everything in order So If you have to remove system and kernel partitions and you will make anything like formate or anything do it in order so first start with removing system partition and recreate it in smaller size then remove kernel partition and recreate it in the new size. WHY ? as if you just removed kernel and system partitions at the same time when you recreate them again you will end up with wrong partition number and your phone won't boot .

Tip 7 :

While you're repartitioning you will find free space at the beginning and end of your device do mess up with them they are related to bootloader and other stuff ... just act like you don't see them at all \.

​

Let's get started :

-What I will do is remove system partition, cut some space of it, recreate it again in new size, make new kernel partition then assign old kernel space to recovery partition. (I am in unlucky situation) .

You will need parted program to do all partitioning stuff .

-I do recommend using TWRP recovery as it's so powerful .

-Make sure to put parted program in safe place away from the partitions you will take space from it

Put parted in you internal storage .

Boot to recovery .

Plug your device to your pc .

Give parted execution permission ... open a new terminal/console and type "adb shell" then type "chmod a+x /sdcard/parted"

​

From current shell type "/sdcard/parted /dev/block/mmcblk0p" or "/sdcard/parted /dev/mmcblk0" if your device uses /dev/mmcblk0*" then type "unit mb" then "print". you should see some thing like that .

​

Then open new terminal/console , type "/sdcard/parted /dev/block/mmcblk0" or "/sdcard/parted /dev/mmcblk0" . then type "unit s" then "print". you should see some thing like that .

​

Remove system partition "rm 21 " . then type "print free"

​

Recreate system partition in the new size . "mkpart partition_name start_sector end_sector"

-I'll take 26MB from system partition so new partition size will be ( old size in sectors - the amount of space I want in sectors[(26*1024*1024)/sector_size] )

so new size will be 1,835,008 - [(26*1024*1024)/512]=1781760​

-To get end sector: ( start sector + partition size in sectors ) so mine will be ( 1252864 + 1781760 )=3034623

finally the command is "mkpart system 1252864 3034623"

Put a name for system partition "name partition_number new_name" the name should be like old partition name so if it was system then name it system and if it was KERNEL name it KERNEL

so mine should be "name 21 system"

Make new kernel partition and name it . "mkpart KERNEL 3034624 3087871 " -> "name 5 KERNEL" .

Also make partition instead at old kernel partition space and just name it anything then formate it as fat16 .

this steps just to make us sure that the phone is using new kernel partition not the old one .

so for me I'll do... "mkpart dummy 64512 84992" -> "name 28 dummy" -> "mkfs" -> "yes"->"28"->"fat16"

Now you will have to formate system , kernel partitions as fat16/fat32 ...type "mkfs" then type "Yes" then type partition number then type fat16 or fat32 .

-But , why ? Let's say that system partition was 1000 sectors and I made it 900 sectors only the device will still read last 100 sectors as the old filesystem type which will make errors because those 100 sectors will be kernel partition and it will be a mess .Don't worry they will be back to their old filesystem types when we restore system and kernel again .

-Why fat16 and fat32 ? Because parted only supports fat16/fat32/ext2 , and ext2 cause recovery not to mount system and kernel partitions .

-OK , which one to use fat16 or fat32 ? fat16 for small partitions like kernel and fat32 for large partitions like system .

-Now it will be like that .

​

I won't add the space of old kernel partition to recovery until I make sure that everything is okay.

Now I will edit pit map for my device.

After that restore kernel and system and see if the system is booting or not .

If the system booted with the new kernel partition I'll remove recovery partition so it will be merged with the old kernel space then I'll recreate recovery partition again then formate it to fat16 after that I'll edit pit file again then push it to device then put it back to its partition.

Now you can either use heimdall or odin to flash the recovery and make sure that it works well.