[Galaxy Tab 2 7" Android Development] tuxafgmur:
:

You have chosen to continue (you're a risky guy...)

We change the info into number of sectors (512 byts each one)

(parted) u s

(parted) p

Model: MMC MAG2GA (sd/mmc)

Disk /dev/block/mmcblk0: 30777344s

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Num... Start................ End............ Size........ Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4....EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s...... 1540095s... 1433600s.... ext4... CACHE

8...... 1540096s...... 1581055s....... 40960s................MODEM

9...... 1581056s...... 4448255s... 2867200s.... ext4... FACTORYFS

10.... 4448256s.... 29728733s..25280478s.... ext4... DATAFS

11...29728734s.... 30777309s... 1048576s.... ext4... HIDDEN
​

(From here onwards, I'll omit the heading, so that it's always the same)

We can see easily the ratio between MB and sectors: 4096 sectors equal 2 MB, so 1 MB are 2048 sectors.

Now, we'll delete the last partition, 'cause starting with it will make work easier at end.

(parted) rm 11
​

Now, we create it again, but with different data, specifying the sector where it begins (30775263) and sector where it finishes (30777310)

(parted) mkpart 11 30775263 30777310

(parted) p

Num...... Start................ End............ Size..... Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4......EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s...... 1540095s... 1433600s.... ext4...CACHE

8...... 1540096s...... 1581055s....... 40960s................MODEM

9...... 1581056s...... 4448255s... 2867200s.... ext4... FACTORYFS

10.... 4448256s.... 29728733s..25280478s.... ext4... DATAFS

11... 30775263s... 30777310s......... 2048s​

So, we have a 1 MB partition that previously was a 537 MB one :)

Yes, you're right. I've changed last sector from 30777309 into 30777310. I haven't added one new sector to disk, it was yet there, but unassigned.

This is so 'cause I want the total to be an even number of sectors, and also this partition sectors number has to be even.

Previously, this partition had a name. So, let's be polite with it:

(parted) name 11 HIDDEN

(parted) p

Num...... Start................ End............ Size..... Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4.....EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s...... 1540095s... 1433600s.... ext4....CACHE

8...... 1540096s...... 1581055s....... 40960s................MODEM

9...... 1581056s...... 4448255s... 2867200s.... ext4... FACTORYFS

10.... 4448256s.... 29728733s..25280478s.... ext4... DATAFS

11... 30775263s... 30777310s......... 2048s............... HIDDEN​

Done. Now, we can forget it, and not even format it.

So that it is the last partition, and will not be used, all this work was really unnecessary, but, preventing the case that any process could count partitions, we keep home tidy.

OK. By now we have:

Deleted partition

Created partition

Named partition

If we have a previously calculated chart, we'll just have to do next steps for each partition and we don't need even to look at it, just to check at end if the obtained result was the one expected.

Anyway, in this How-To we'll do things one by one.

We shrink the CACHE partition

We calculate: 400 x 2048 = 819200 (400 MB x 2048 sectors = 819200 sectors)

106496 + 819200 = 925696 -1 = 925695

Our new partition starts in sector 106496 and finishes in sector 925695

(parted) rm 7

(parted) mkpart 7 106496 925695

(parted) name 7 CACHE

(parted) p

Num...... Start................ End............ Size..... Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4.....EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s........ 925695s..... 819200s.... ext4... CACHE

8...... 1540096s...... 1581055s....... 40960s................MODEM

9...... 1581056s...... 4448255s... 2867200s.... ext4... FACTORYFS

10.... 4448256s.... 29728733s..25280478s.... ext4... DATAFS

11... 30775263s... 30777310s......... 2048s............... HIDDEN

​

We just move the MODEM partition : 925696 + 40960 -1 = 966655

(parted) rm 8

(parted) mkpart 8 925696 966655

(parted) name 8 MODEM​

Now, let's go for the FACTORYFS one

(parted) rm 9

(parted) mkpart 9 966656 2195455

(parted) name 9 FACTORYFS

(parted) p

Num...... Start................ End............ Size..... Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4.....EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s........ 925695s..... 819200s.... ext4... CACHE

8........ 925696s...... . 966655s....... 40960s................MODEM

9........ 966656s.......2195455s....1228800s................FACTORYFS

10.... 4448256s.... 29728733s..25280478s.....ext4....DATAFS

11.. 30775263s.... 30777310s..........2048s................HIDDEN

​

There only rest DATAFS.

For it, no calculations are needed: it starts in the sector following FACTORYFS and ends in the previous to HIDDEN.

(parted) rm 10

(parted) mkpart 10 2195456 30775262

(parted) name 10 DATAFS

(parted) p

Num...... Start................ End............ Size..... Fs....... Name

1............ 8192s.......... 49151s....... 40960s... ext4.....EFS

2.......... 49152s.......... 53247s......... 4096s............... SBL1

3.......... 53248s.......... 57343s......... 4096s............... SBL2

4.......... 57344s.......... 73727s....... 16384s............... PARAM

5.......... 73728s.......... 90111s....... 16384s............... KERNEL

6.......... 90112s........ 106495s....... 16384s............... RECOVERY

7........ 106496s........ 925695s..... 819200s.... ext4... CACHE

8........ 925696s...... . 966655s....... 40960s................MODEM

9........ 966656s...... 2195455s....1228800s................FACTORYFS

10.... 2195456s.... 30775262s..28579807s................DATAFS

11.. 30775263s.... 30777310s......... 2048s............... HIDDEN

​

So, that's what we got. It seemed difficult, but it's done! :cool:

Finishing:

We exit parted, for the end of feast using quit command

(parted) q​

In this moment, we've returned to recovery.

Now, and only if our tab is a 3G/GSM one, we have to recover the modem:

dd count=40960 bs=512 if=/external_sd/modem.bin of=/dev/block/mmcblk0p8​

Format:

Remember that we are in recovery. So, let's go to tablet and we select:

- mounts and storage

Search for and click on:

- format system

- format cache

- format /data and /data/media (/sdcard)

Just and only this options.

To check, now click on:

- mount /system

- mount /cache

- mount /data

If everything is OK, each one of the 3 options will change into unmount
​

If you are an expert user, surely you know how to format from shell, without using recovery options.

WE HAVE FINISHED. HURRAY!

Now, we have two options to reinitialize:

We install our favourite Rom, boot, configure, restore data, etc.

Or we restore the backup we did with the recovery in the external MicroSD card and we remain as if nothing had happened (but with lot more free space).

NOTE: I've wrote this how-to using CWM recovery, On others recovery, mount options can be slightly different

Disclaimer: If you have read this post, and did what is told in it, it will be ONLY under YOUR RESPONSIBILITY. You've being warned... ;)

CopyRight Tuxafgmur - Dhollmen 2013-2014. You can copy and distribute this post only if you mentions Author and references this XDA theread.