[ HOW-TO ] - Resizing partitions (Universal Mode) - Galaxy Tab 2 7" Android Development

I wrote this How-To several months ago and published in a spanish forum.
Now I've recovered to share here as it may interest someone.
This was originally written in spanish and now, our friendly companion @nachordez
has been kind enough to translate it to english. Thank you very much for your help. :good:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'll try to explain here how to change the size of our device partitions.
Though the presented data are referred to a 16 GB, a p5110 in this case, they are easy to adapt to a 8 GB one, and/or any other model, with some light corrections.
There can be other ways, but this one has the advantage that depends only on not writing wrong data, and that's easily achieved with a little extra concentration during our work.
Anyway, it's needed to follow very strictly this how-to.
In case of total failure, we should restore the tab through the flashing of a Stock version using the pit file.
ALL the data not saved in the external MicroSD card WILL BE LOST, 'cause we'll delete the /system, /data and /cache partitions.
What is needed:
A computer.
A properly running adb program.
Recovery installed.
External MicroSD card installed and with available space.
Connection cable.
Full Battery.
For 3G (GSM) models, the original “modem.bin” file, obtained from a stock ROM.
The modem.bin file is not really needed as we can get it from our tablet with next command
dd count=40960 bs=512 if=/dev/block/mmcblk0p8 of=/external_sd/modem.bin​
All process is done from computer, except a short intervention at end, done from tablet.
This how-to is planned for a AOSP-like ROM, such as CyanogenMod (for example).
In the case of a Stock ROM, the partition sizes we are adjusting will be too short for it.
Before starting:
We have to check that there is enough free space in the MicroSD card, and we have to do a backup through recovery, choosing EXTERNAL SDcard.
If the internal one is used, IT WILL BE LOST DURING PROCESS.
This step is very important, to recover the ROM without re-install from zero.
So, let me say it again: EVERY USER DATA that has being not COPIED to the EXTERNAL SDcard, WILL BE LOST.
After next steps, ONLY the external MicroSD will be conserved without erasing.
So, we check once again that everything is saved, and copy to the external MicroSD (if our tab is a 3G model) the “modem.bin” file that will be needed afterwards.​
So... Let's start hacking!:
We always wrote in our PC.
We reboot our tab in recovery mode, and connect the cable.
To enter the tab from our computer:
> adb shell
Once entered correctly on the tablet, we like more clear ls command:
> alias ls='ls -an'
Now we access the partition table:
> parted /dev/block/mmcblk0
We'll get something like:
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)​
The command line for parted is (parted), so, every time a line starts so, that what follows this is a command.
We ask for information about current partitions:
(parted) p
Model: MMC MAG2GA (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number... Start... ....End......... Size...........File system...... Name.... Flags
1............4194kB.... 25.2MB.... 21.0MB...... ext4................ EFS
2........... 25.2MB.... 27.3MB....2097kB............................... SBL1
3........... 27.3MB.....29.4MB....2097kB............................... SBL2
4........... 29.4MB.... 37.7MB....8389kB............................... PARAM
5........... 37.7MB.... 46.1MB... 8389kB............................... KERNEL
6........... 46.1MB.... 54.5MB... 8389kB............................... RECOVERY
7............54.5MB...789.0MB.. 734.0MB....... ext4................CACHE
8......... 789.0MB.. 810.0MB.... 21.0MB.............................. MODEM
9......... 810.0MB.., 2278MB... 1468MB....... ext4............... FACTORYFS
10........ 2278MB.... 15.2GB.... 12.9GB........ext4............... DATAFS
11......... 15.2GB..... 15.8GB.... 537MB....... ext4............... HIDDEN​
Comments:
Analizing the current partitions we can see this tablet is a 16 GB one:
/cache (CACHE) has 734 MB assigned
/system (FACTORYFS) has 1468 MB assigned
/data (DATAFS) has 12,9 GB assigned
There's also a funny 537 MB partition called HIDDEN: that's where the Samsung video, musical theme and demo pictures are stored.
If I don't mistake, I think I extracted them time ago, and they were just about 14 MB. In our case, we'll opt for destroying that!
In this how-to we'll assign:
/cache (CACHE) 400 MB
/system (FACTORYFS) 600 MB
/data (DATAFS) the sum of: its current size + 394 MB from CACHE + 868 MB from FACTORYFS + 536 MB from HIDDEN.
So, we'll grow our /DATAFS space in 1798 MB, which will mean more than 14 GB free space.
I use in this example 600 MB for /system was what I did in my tab.
In real world, 240 MB /cache and 500 MB /system are more than enough.
As we'll see later, all this numbers are just aproximations, not completely exact, and probably you're thinking: “My maths do not agree with this numbers”. Mine do not, also, as a fact.​
Let's see all that more slowly:
21+2+2+8+8+8+21+1 (for the 'hidden' partitions) give us 71 MB.
If we add 71 + 400 +600 we'll get 1071 MB.
If we have 16 GB and we use 1 GB, more than 15 GB should rest.
On one hand: 1 GB are 1048 MB. So, 16 GB should be 16768 MB, but we have just 15709.
That has a easy explanation: The hard disk makers started to measure 1 GB as 1000 MB (kind of a commercial trick). So, just beginning with that, 768 MB have disappeared in thin air.
On the other hand, we have 34 initial sectors to sustain the partition table, alternative sectors for errors recovering, rounding of numbers in sectors to partitions assignations, etc.
We have 11 partitions just now:.............................................. And they should get like that:
01 00021 MB...........................................................................01 00021 MB
02 00002 MB...........................................................................02 00002 MB
03 00002 MB...........................................................................03 00002 MB
04 00008 MB...........................................................................04 00008 MB
05 00008 MB...........................................................................05 00008 MB
06 00008 MB...........................................................................06 00008 MB
07 00734 MB...........................................................................07 00400 MB *
08 00021 MB...........................................................................08 00021 MB
09 01468 MB...........................................................................09 00600 MB *
10 12900 MB...........................................................................10 14638 MB *
11 00537 MB...........................................................................11 00537 MB
.....15709 MB................................................................................15709 MB​
The difference can seem small compared to the original partitioning, nevertheless will allow us to get all our usual apps installed and, even so, preserve a free space higher than we had previously, even before than start to install anything. That's saying: even more than with a pure CM just installed and not even configured.
Obviously, if we translate all that to a 8 GB model, the proportional gain is much higher.
Also, consider that an AOSP rom like CM is not bigger than 460 MB in /system, and that cache will need just 60 MB for dalvik and what we can download from google-play at a certain time. 170 MB should be enough, unless we want to download an app bigger than 100 MB. The bigger ones I've saw are around 90-105 MB.
In this moment, we'll have to decide if we want to follow on or not.
Till now, I was just fun, but nothing has being 'broken'.
Disclaimer: If you continue reading next post, and you do what's there exposed, 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.

:
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!
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.

I insert below partitions data from a p3110 tablet.
This data was attached by the user Saitoh00 from spanish HTCmania forum. This user resized partitions following this How-To.
Model: MMC M8G2FB (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1.........4194kB..........25.2MB............21.0MB.......ext4.......EFS
2........ 25.2MB..........27.3MB...........2097kB......................SBL1
3.........27.3MB..........29.4MB...........2097kB..................... SBL2
4.........29.4MB..........37.7MB...........8389kB......................PARAM
5.........37.7MB..........46.1MB...........8389kB......................KERNEL
6.........46.1MB..........54.5MB...........8389kB......................RECOVERY
7.........54.5MB...........474MB............419MB.......ext4........CACHE
8..........474MB...........495MB...........21.0MB......................MODEM
9..........495MB...........914MB............419MB.......ext4........FACTORYFS
10........914MB.........7817MB..........6903MB.......ext4........DATAFS
11......7817MB.........7818MB...........1049kB......................HIDDEN
​
Model: MMC M8G2FB (sd/mmc)
Disk /dev/block/mmcblk0: 15269888s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
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........785855s.......819200s.........ext4......FACTORYFS
10....1785856s....15267806s...13481951s.........ext4......DATAFS
11..15267807s....15269854s...........2048s......................HIDDE
​

I have cyanogenmod installed over tab 2 7 inches 16 gb which I want to change but flashing stock firmware is not possible as it gives error....I feel something is wrong at partition table. I want to repartition for stock rom. ...can u guide
Sent from my SM-A500H using XDA Free mobile app

Did you ever edit partition table of your tab? If you haven't, then nothing is wrong with partition table and no need to repartition it. Installing custom roms don't change partition structure.
You should start a new thread and post exact problem there only.

If we resized the partitions, maybe all custom rom would not boots?
Sent from my GT-I9300 using XDA Premium 4 mobile app

bangdes said:
If we resized the partitions, maybe all custom rom would not boots?
Sent from my GT-I9300 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Don't worry, as long as the rom sticks on the partition (specially system partition)

bangdes said:
If we resized the partitions, maybe all custom rom would not boots?
Sent from my GT-I9300 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
If you set the correct path for Partitions and available space/filesystem is correct, you can play with partition table as long as you want.

Deleted

@prav3955 what does it has to do with this thread? Use the Q&A section please.
Send from OnePlus One using Tapatalk

I request moderator to remove this post plz....
Sent from my SM-A500H using XDA Free mobile app

Not exactly, just move to 'hardware hacking' thread. This is a bleeding edge and too highrisk for newbie like me
Sent from my GT-I9300 using XDA Premium 4 mobile app

hooray! I've made it on my 8gb p3110 Here is my table if you want:
Number Start End Size File system Name Flags
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 15267806s 13072351s DATAFS
11 15267807s 15269854s 2048s HIDDEN
Click to expand...
Click to collapse
but it's nothing special, it uses OP's values adapted to 8gb model. I'm very happy with results: https://www.dropbox.com/s/haq4j16shfcdf9q/Screenshot_2015-04-27-21-46-12.png?dl=0
btw I had strage issue. After whole process I couldn't format my cache partition. I tried to remove it and add again but it didn't help. Hopefully solution was easy: I had to reboot my recovery. Now everything is fine
Thanks for great guide
p.s.
repartitionig is preatty easy but i've spent more than hour trying to fix adb drivers

btw some ot
If you repartitioned your galaxy tab it doesn't mean that you can repartition every other android device. I made that mistake and I've just hardbricked my xperia phone trying to repartition it (I belive it's somehow protected). My bootloader died so it's impossible to fix it at home. Keep it in mind before you try to repartition your other device.

Repartition system might cause issue flashing some/most lollipop roms because of blockbased implementation.

Android-Andi said:
Repartition system might cause issue flashing some/most lollipop roms because of blockbased implementation.
Click to expand...
Click to collapse
So, how to revert. I want to flash your rom and I cannot.
Do I have to revert to stock? Or is someone having the original partition?

cantabro said:
So, how to revert. I want to flash your rom and I cannot.
Do I have to revert to stock? Or is someone having the original partition?
Click to expand...
Click to collapse
Omni 5.1 and AOSP 5.1 should work i think. Or stay on KK.
Theres a different way too, let me see if i find it.
---------- Post added at 03:26 PM ---------- Previous post was at 03:19 PM ----------
cantabro said:
So, how to revert. I want to flash your rom and I cannot.
Do I have to revert to stock? Or is someone having the original partition?
Click to expand...
Click to collapse
Start Reading here on page 69 (and the following Pages) http://forum.xda-developers.com/showthread.php?t=3060319
They had same issue on ZMod rom and solved it.

Android-Andi said:
Omni 5.1 and AOSP 5.1 should work i think. Or stay on KK.
Theres a different way too, let me see if i find it.
---------- Post added at 03:26 PM ---------- Previous post was at 03:19 PM ----------
Start Reading here on page 69 (and the following Pages) http://forum.xda-developers.com/showthread.php?t=3060319
They had same issue on ZMod rom and solved it.
Click to expand...
Click to collapse
Thanks. But where can I find the system.tar for this?
And the last Omni founds no mirrors for download on your AndroidFileHost
I do like Lollipop

I flased omni 5.1 on my repartitoned tab and it works but 600 mb system partiton is too small for heavy lp rom and some of my favourite gapps so I decided to change partition layout again. I think that 400mb for cache it too much, my new moto e has 8 gb of storage too and only 256 mb of cache. So I changed my layout to: 256mb cache, 800mb system and rest for data. So I lost only 56mb of my data partiton while boosted by system by 200 mb so I think it is worth. Here are my commands (I think that they looks more clear than table):
I have 7'' 8 gb model
Code:
(parted) rm 7
(parted) mkpart 7 106496 630783
(parted) name 7 CACHE
(parted) rm 8
(parted) mkpart 8 630784 671743
(parted) name 8 MODEM
(parted) rm 9
(parted) mkpart 9 671744 2310143
(parted) name 9 FACTORYFS
(parted) rm 10
(parted) mkpart 10 2310144 15267806
(parted) name 10 DATAFS
It looks like that: https://dl.dropboxusercontent.com/u/37270614/Screenshot_2015-07-11-13-16-54.png

cantabro said:
So, how to revert. I want to flash your rom and I cannot.
Do I have to revert to stock? Or is someone having the original partition?
Click to expand...
Click to collapse
I solved the very same problem by flashing stock AND the special .PIT file for my version (beware: there are a 8GB and a 16GB pit files)

Related

[Q] Can not delete partitions on mmcblk0

Hello!
My problem is that my galaxy hang with lightning buttons. After that it doesn't work correct. Done a wipe, that doesn't help. Flashed 3 file rom jm1, not working correctly.
Now i wan't to delete partitions on internal sd with adb and parted. But it doesn't work.
I used : #parted /dev/block/mmcblk0 as root!
then rm 1, rm 2.
When i do a print after that everything stays the same as before. :
(parted) print
print
print
Model: MMC M8G4DD (sd/mmc)
Disk /dev/block/mmcblk0: 8221MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.8kB 6208MB 6208MB primary fat32 lba
2 6208MB 8221MB 2013MB primary lba
(parted)
Anybody an idea what to do?
Thanks
I have a similar. Did you look inside /dev/block/ ?
a normal phone has mmcblk0, mmcblk0p1 and mmcblk0p2.
Mine has only mmcblk0 and partition table looks broken or I get I/O error.

[Q] Issues with Upgrade to Overcome 3.1.0

Hello!
I have a SGT UK, Unbranded... It was on Froyo 2.2. I had a issue where the Tab froze while browsing. Restarted it and it would get stuck at the Samsung Logo.
Having read the threads on XDA on how to flash it to stock, I decided to goto Stock 2.3.3. Followed the instructions, but got the 'E:Can't mount... /data' error.
Tried flashing a few more times and no luck. Eventually, I flashed the CWM 3 Kernel and was able to use the Tab and also had root.
I then decided to try the Overcome 3.1.0 ROM... After going thru the instructions, I flashed it and had the rom (wipe version) in the internal sdcard... on reboot, the 'voice' started its process but complained mid way about 'not enuf space on data partition'. It eventually finished the process but got stuck again at the Samsung logo.
Tried this again and same problem. I then decided to use the stock rom provided by Overcome and I still continue to face the same problem.
However, if I now flash the stock rom and only the Overcome Kernel, I can boot up and use the Tab but cannot delete any files from the internal sdcard. Also, any settings changed are lost if i restart the tab.
Long story short, How do i completely remove and flash stock 2.2 or 2.3.3?
TIA!
The fine folks at Team Overcome have put together an amazing guide at http://p1000.teamovercome.net/?page_id=64. When I browse through the threads here on XDA I notice that 99% of the time when people have troubles its because they accidentally skipped a step, or thought it was unimportant.
My advice is to follow the guide to the letter, and do a complete wipe, re-stock, and stop when you finish step 6 of "The Installation" if you only want to stay as close to stock as possible.
@Blittz... I have followed that guide and tried to go back to the stock using the '001001-GB-Stock-Safe-v5.zip' file. I do get the error related to 'dbdata' or 'mmcblk0' etc but after a reboot, it gets stuck at the Samsung Logo. In other words, trying to go back to stock 2.3.3 doesnt work. I then have to flash the Overcome Kernel over the stock rom to get the Tab to boot.
Another thing I noted was after flashing the Overcome Kernel over stock 2.3.3, I go thru the 'adb shell' and check the internal sdcard partitions - mmcblk0p1 etc thru parted or fdisk, and they report errors and i cannot even format the internal sdcard.
All the files that i had before i started the process for Overcome ROM are still there and cannot be deleted. I feel the internal sdcard partitions are corrupt. Any way I could rebuild them?
Further... Here's what happens if I try to remove the partitions on the int sdcard --
~ # parted /dev/block/mmcblk0
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
print
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.8kB 13.8GB 13.8GB primary fat32
2 13.8GB 15.8GB 2043MB primary ext4
3 15.8GB 15.9GB 105MB primary
(parted) check 1
check 1
check 1
Fatal: Bad FAT: unterminated chain for \DCIM\THUMBN~1. You should run dosfsck
or scandisk.
(parted) check 2
check 2
check 2
No Implementation: Support for opening ext4 file systems is not implemented yet.
(parted) check 3
check 3
check 3
Error: Could not detect file system.
(parted)
~ # fdisk /dev/block/mmcblk0
fdisk /dev/block/mmcblk0
The number of cylinders for this disk is set to 1944064.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
p
Disk /dev/block/mmcblk0: 15.9 GB, 15925772288 bytes
1 heads, 16 sectors/track, 1944064 cylinders
Units = cylinders of 16 * 512 = 8192 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 5 1681920 13455328 83 Linux
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 1681921 1931264 1994752 83 Linux
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 1931265 1944064 102400 83 Linux
Partition 3 does not end on cylinder boundary
Command (m for help):
~ # parted /dev/block/mmcblk0
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos
mklabel msdos
mklabel msdos
Warning: The existing disk label on /dev/block/mmcblk0 will be destroyed and all
data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Yes
Yes
(parted) p
p
p
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.8kB 13.8GB 13.8GB primary fat32
2 13.8GB 15.8GB 2043MB primary ext4
3 15.8GB 15.9GB 105MB primary
(parted) rm 3
rm 3
rm 3
(parted) rm 2
rm 2
rm 2
(parted) rm 1
rm 1
rm 1
(parted) print
print
print
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.8kB 13.8GB 13.8GB primary fat32
2 13.8GB 15.8GB 2043MB primary ext4
3 15.8GB 15.9GB 105MB primary
(parted)
I'm no expert, but I think your problem may be with the error you got:
Fatal: Bad FAT: unterminated chain for \DCIM\THUMBN~1. You should run dosfsck or scandisk.
Click to expand...
Click to collapse
You may have something corrupted there, did you try running dosfsck or scandisk? You may need to fix that before you can go on.
Back after few weeks... Well.. tried all i could to flash back to stock firmware... not luck. Took the Tab to the Service Center eventually... Got a new replacement from Samsung... Sweet!
sudeep1106 said:
~ # parted /dev/block/mmcblk0
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
print
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.8kB 13.8GB 13.8GB primary fat32
2 13.8GB 15.8GB 2043MB primary ext4
3 15.8GB 15.9GB 105MB primary
(parted) check 1
check 1
check 1
Fatal: Bad FAT: unterminated chain for \DCIM\THUMBN~1. You should run dosfsck
or scandisk.
(parted) check 2
check 2
check 2
No Implementation: Support for opening ext4 file systems is not implemented yet.
Click to expand...
Click to collapse
sounds like a corrupted SD card to me! try running scandisk or dosfsck on this, maybe it solves the error!
EDIT: woops didnt read the last post! grats on your new tab

[Dualboot] i9082 {Stock 4.2.2/AOSP 4.4.2 and AOSP 4.4.2} 23032014 V2

Hi guys,
finally I found a way to make dualboot on our beloved i9082 working!!
This way isn't as much easy as on other devices like the desire HD where
you have just to install an app and everything is done by itself, so follow this
guide at your own risk!!
THIS IS WORST RISK YOU TAKE FOR YOUR PHONE>>>>
IT MAY BRICK YOUR PHONE.....
DONT DO IT IF YOU DONT KNOW WHAT YOU DOING...
How to dual boot your I9082...
1. Make a backup of your internal sdcard to your PC!! All your data on the sd card will be gone!
2. Reboot to cwm-recovery
3. connect your phone to your pc.
4, open up cmd or a terminal and type:
PHP:
adb shell
5. type:
PHP:
cd /dev/block
parted mmcblk0
print
This looks like following
Code:
print
Model: MMC M8G1WA (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 14.7MB 15.7MB 1049kB cal
2 15.7MB 16.0MB 262kB sysparm_dep
3 16.0MB 16.3MB 262kB parm-spml_dep
4 16.3MB 16.5MB 262kB RF_CAL_FILE
5 16.5MB 24.9MB 8389kB KERNEL
6 24.9MB 33.3MB 8389kB RECOVERY
7 33.3MB 53.0MB 19.7MB modem
8 53.0MB 86.2MB 33.3MB reserved
9 86.2MB 88.3MB 2097kB SBL1
10 88.3MB 90.4MB 2097kB SBL2
11 90.4MB 98.8MB 8389kB PARAM
12 98.8MB 99.4MB 524kB DTSBK
13 99.4MB 99.9MB 524kB DTS
14 99.9MB 108MB 8389kB VC-FirmwareBK
15 108MB 117MB 8389kB VC-Firmware
16 117MB 117MB 262kB FOTA_SIG
17 117MB 138MB 21.0MB ext4 efs
18 138MB 1212MB 1074MB ext4 CSC
19 1212MB 2822MB 1611MB ext4 system
20 2822MB 3409MB 587MB ext4 HIDDEN
21 3409MB 7813MB 4404MB ext4 data
The last partiton i.e data partion which is our internal SD card to be re partitioned .
6. Type
PHP:
rm 21
7. Note the start and end of the data partiton. In my case its 3409 and 7813
Firstly we have to create data partition. See the size of system partition i.e 1024 MB. So the new partion will be as follows
PHP:
mkpartfs primary ext2 3409 4433
second is system 2 partition
PHP:
mkpartfs primary ext2 4433 6044
next is cache2 partion
PHP:
mkpartfs primary ext2 6044 6744
next is data2 partion
Code:
mkpartfs primary ext2 6744 7813
Code:
quit
It will say
Code:
quit
Information: You may need to update /etc/fstab.
Ignore the warning Reboot into recovery again on pc type
Code:
adb shell
mke2fs /dev/block/mmcblk0p21
tune2fs -j /dev/block/mmcblk0p21
mke2fs /dev/block/mmcblk0p22
tune2fs -j /dev/block/mmcblk0p22
mke2fs /dev/block/mmcblk0p23
tune2fs -j /dev/block/mmcblk0p23
mke2fs /dev/block/mmcblk0p24
tune2fs -j /dev/block/mmcblk0p24
This will create ext3 partition from ext2
Now convert them to ext4
Code:
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p21
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p22
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p23
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24
Now lets check everything is ok
Code:
cd /dev/block
parted mmcblk0
print
This should look like following
Code:
print
Model: MMC M8G1WA (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 14.7MB 15.7MB 1049kB cal
2 15.7MB 16.0MB 262kB sysparm_dep
3 16.0MB 16.3MB 262kB parm-spml_dep
4 16.3MB 16.5MB 262kB RF_CAL_FILE
5 16.5MB 24.9MB 8389kB KERNEL
6 24.9MB 33.3MB 8389kB RECOVERY
7 33.3MB 53.0MB 19.7MB modem
8 53.0MB 86.2MB 33.3MB reserved
9 86.2MB 88.3MB 2097kB SBL1
10 88.3MB 90.4MB 2097kB SBL2
11 90.4MB 98.8MB 8389kB PARAM
12 98.8MB 99.4MB 524kB DTSBK
13 99.4MB 99.9MB 524kB DTS
14 99.9MB 108MB 8389kB VC-FirmwareBK
15 108MB 117MB 8389kB VC-Firmware
16 117MB 117MB 262kB FOTA_SIG
17 117MB 138MB 21.0MB ext4 efs
18 138MB 1212MB 1074MB ext4 CSC
19 1212MB 2822MB 1611MB ext4 system
20 2822MB 3409MB 587MB ext4 HIDDEN
21 3409MB 4433MB 1024MB ext4
22 4433MB 6044MB 1611MB ext4
23 6044MB 6744MB 700MB ext4
24 6744MB 7813MB 1069MB ext4
Then
Code:
quit
Now flash your first stock ROM..ofcource custom one from recovery.
Now You can flash your desired AOSP rom as primary and dualboot enabled secondary rom.
Scripts to switch roms has been updated.
Download following dualboot enabled AOSP rom by me CosmicCm
http://www.androidfilehost.com/?fid=23329332407579496
Download following tool kit and extract on your External sd card for AOSP rom and in Internal SD for your stock rom.
http://www.androidfilehost.com/?w=files&flid=12981
Install smanager (os.tools.scriptmanager-1.apk) in zip.
Instructions on ROM switching:
1. Go to Play Store and install SManager (or included in dualboot-k2wl-V2.zip)
2. Run SManager, browse to your DualBoot folder and select "StockPrimary.sh/AOSPprimary.sh" or "AOSPSecondary.sh". depending upon which rom you want to boot into.
3. Mark favourite and su options and run the script.
4. Optional - SManager has a homescreen widget system. It lets you add buttons in your homescreens that will directly run the linked script (it has to be put in favourites first).
AGAIN this is a nuclear level risky procedure and is for ADVANCE users only....
DO NOT TRY IF YOU DONT KNOW WHAT YOU ARE DOING.......
Bugs:-
Your data partitions will be small about 1 GB.
External SD card not working in stock rom.
More?>..... You telll me...
HAPPY FLASHING.....
Credits:-
dreccon
berni987654321
51dusty
and for best inspiration and beta tester....
xenon92
Reverting
To revert
Boot into recovery
start
Code:
adb shell
Code:
cd /dev/block
parted mmcblk0
print
rm 24
rm 23
rm 22
rm 21
Code:
mkpartfs primary ext2 3409 7813
Code:
quit
Reboot into recovery again
on pc type
Code:
adb shell
mke2fs /dev/block/mmcblk0p21
tune2fs -j /dev/block/mmcblk0p21
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p21
now you reverted back.
another one
Awesome work bro
Thanks man
Sent from my GT-I9082 using Tapatalk
Awsm work bro..keep up the good wrk..stay blessed..
Sent from my GT-I9082 using Tapatalk 2
Does this method works with only cosmiccm ROM or it works with all aosp based ROM ?
Sent from my GT-I9082 using Tapatalk
Right now only CosmicCm but if developers willing for making their dualboot compatible rom, it wil.
k2wl said:
Right now only CosmicCm but if developers willing for making their dualboot compatible rom, it wil.
Click to expand...
Click to collapse
@k2wl
Please update your signature for awesome Rom "CosmicCm":good:
OMG!! REallyy Superb workk man:angel::angel:
good work mate but how to undo ..these all changes ? any procedure?
himuslg123 said:
good work mate but how to undo ..these all changes ? any procedure?
Click to expand...
Click to collapse
Flashing PIT file probably.
Sent from my GT-I9082 using Tapatalk
himuslg123 said:
good work mate but how to undo ..these all changes ? any procedure?
Click to expand...
Click to collapse
akiratoriyama said:
Flashing PIT file probably.
Sent from my GT-I9082 using Tapatalk
Click to expand...
Click to collapse
@himuslg123 @akiratoriyama
Look into the second post...
reverting changes...
thanks for the tutorials k2wl
but I have a doubt
suppose ..I have installed 2 roms
now if I want to flash a mod zip( i.e pagapps or so) file for a specific rom via CWM recovery ...ll they be installed on a specific partition for a specific rom ?
for second rom its a problem, i.e AOSP.
thats why i included gapps core in CosmicCM dual boot rom.
for original primary rom stock, you can flash any mods you want.
Give me links for the mods and gapps you wanted.
i will change them into dual boot...
aahh ..that's all I want ..you rock \m/
k2wl said:
for second rom its a problem, i.e AOSP.
thats why i included gapps core in CosmicCM dual boot rom.
for original primary rom stock, you can flash any mods you want.
Give me links for the mods and gapps you wanted.
i will change them into dual boot...
Click to expand...
Click to collapse
Well ..first thanks for this procedure..the more i thank u , the less it would be mahn!..
Now, as u say that u will help guys for mods to dual boot too, the only thing i flash after ur roms is ur kernel ... I dont think its already in there in cosmic rom,And cant live without evolution kernel mahn :|..but i think kernel flashing will screw things up right??
yes it might screw things up..
bt dont worry i will add option for evaluation dualboot kernel soon.
this is work in progress.
will add more options...
k2wl said:
yes it might screw things up..
bt dont worry i will add option for evaluation dualboot kernel soon.
this is work in progress.
will add more options...
Click to expand...
Click to collapse
general question plss..y kernel is not put as a default in ROM( I mean ur kernel and ur ROM).
Though it will not allow users of RR and carbon to use this kernel. just of curosity
Any possibility for a GUI apps or flashable zip to do all this procedure of dual boot in future development? What I mean is like GUI apps of EFS backup
wiryawang said:
Any possibility for a GUI apps or flashable zip to do all this procedure of dual boot in future development? What I mean is like GUI apps of EFS backup
Click to expand...
Click to collapse
No...not so soon...
firstly this is risky procedure
and second
i like commandline better.
better control and fast..
so i cant help you with this.

[GUIDE] Increase your Nexus 4's system partition for more space!

I got tired of installing amazing ROMs created by the talented folks here on XDA, but being held back on things like Google Apps because of the tiny /system partition we have on the Nexus 4. I looked around and found guides to increase the system space in the Nexus 5 and Nexus 7 2013, so I basically just adapted them to work on our beloved Nexus 4.
As always, do this at your OWN risk. I am not responsible for bricking your Nexus 4. I will simply list the process which I used to increase my Nexus 4's system partition (by taking a big ol' chunk from the cache partition). Remember, any sort of modification to your device of this caliber WILL void any warranty you might still have.
REQUIREMENTS:
parted (Uploaded to my Google Drive. If it downloads as a .txt, rename it to remove the extension and make it a plain file)
adb and fastboot, and preferably knowledge on how they work
Step 1: Install TWRP onto your Nexus 4 and reboot into it.
Step 2: Open up command prompt / terminal and check to see if your Nexus 4 is connected properly with "adb devices".
Step 3: Once you've confirmed that adb is fully working and your Nexus 4 is properly connected to your PC, download parted and use adb to push it to your Nexus 4 using the command:
Code:
adb push parted /
Step 4: Now enter the following command:
Code:
adb shell
and then the command:
Code:
chmod +x parted
This will enter adb shell and make the "parted" binary you pushed to your device earlier executable.
Step 5:
Now run the command
Code:
./parted /dev/block/mmcblk0 p
You should see a long list with a bunch of numbers and names in your terminal. These are the partitions on your device. parted will give you the partition number, the "start" and "end" of the partition, the size, and the name.
This is the partition layout on my device. It will probably be the same on your device, though the size of userdata may vary depending on whether you have the 8gb or 16gb Nexus 4.
Code:
~ # ./parted /dev/block/mmcblk0 p
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 15.8GB 14.1GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
Step 6:
Now run the following three commands:
Code:
umount /data
umount /sdcard
umount /cache
Step 7: So, on my Nexus 4, the system partition is number 21, and cache is 22. We're kinda lucky in the fact that system and cache are right next to each other, meaning we don't have to touch any other partition.
You'll want to run these two next commands. These commands will essentially "remove" the two partitions.
Code:
./parted /dev/block/mmcblk0 rm 21
./parted /dev/block/mmcblk0 rm 22
Step 8: Now it is time to recreate these two partitions, however, when recreating them, we will make system bigger and the cache smaller. From the partitions list we got in Step 5, we can see that system starts at 159 and ends at 1040, while cache starts at 1040 and ends at 1627. The following two commands will rebuild /system starting at 159, but ending at 1590, while rebuilding cache at 1590, and ending at 1627. We are essentially stealing a large chunk from cache, since we don't really need that anymore on newer ROMs.
Code:
./parted /dev/block/mmcblk0 mkpart primary 159 1590
./parted /dev/block/mmcblk0 mkpart primary 1590 1627
Step 9: Now run this command:
Code:
./parted /dev/block/mmcblk0 p
This will bring up the partitions list, or table, again. This time, however, we'll see the new partitions where system and cache were, however, they have no names! The following two commands will name the two partitions again.
Code:
./parted /dev/block/mmcblk0 name 21 system
./parted /dev/block/mmcblk0 name 22 cache
Step 10: Great! Now the partitions should be named again! Now, we still have to format the partitions as ext4 so that we can actually use them. The following two commands will do that for you.
Code:
mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p21
mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p22
Step 11: At this point, feel free to run the command from Step 5 to take one more look at the partition table and make sure everything looks good. Now run the command
Code:
mount -a
and then type in
Code:
exit
.
Step 12: Now we are pretty much done. We've extended the system partition from approx. 881mb to 1431mb, which is a nice large chunk of memory. In the future, we could always mess with the partitions more to add even more space by stealing from userdata, but until we reach that point, I think we are pretty well set for now!
Now...
You'll want to reboot TWRP, and flash a new ROM. You can now use a much bigger Google Apps package, without any worries.
Do note, however, that flashing a ROM will "resize" system to be smaller, but this isn't a huge deal. After flashing a ROM, while still in TWRP, you'll want to go to Wipe > Advanced Wipe > check "system" then head to "Repair or Change File System", > then tap on "Resize File System." If you encounter any errors while trying to resize, try remounting system or rebooting TWRP. Afterwards, you should be able to flash your Google Apps package. I'm not sure if you need to repeat these steps after flashing things other than ROMs, but repeating this process within TWRP should work just as well.
I hope I helped y'all out and feel free to post if this guide worked for you or if you have any other comments!
CREDITS:
@surfrock66 for his Nexus 5 guide here.
@rkhat for his Nexus 7 2013 guide here.
RESERVED
Worked Thanx
It worked here on my 8 Gb mako. Here are the original parted output:
Code:
Model: MMC 008G92 (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 7817MB 6190MB ext4 userdata
24 7817MB 7818MB 524kB DDR
25 7818MB 7818MB 507kB grow
I'm using Nitrogen OS 8.1 with GZR Gapps
jfsobreira said:
It worked here on my 8 Gb mako. Here are the original parted output:
Code:
Model: MMC 008G92 (sd/mmc)
Disk /dev/block/mmcblk0: 7818MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext2 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 7817MB 6190MB ext4 userdata
24 7817MB 7818MB 524kB DDR
25 7818MB 7818MB 507kB grow
I'm using Nitrogen OS 8.1 with GZR Gapps
Click to expand...
Click to collapse
Awesome! Thanks for letting me know. Glad it worked for you. :good:
thank you very much !
Thx !
Thx !
Great guide works perfectly.. has anyone tried to reverse the process and go back to stock to reflash a factory image?
I just tried it on my old Nexus 4, and after resettting the partitions, and reflashing the factory image, its just a permanent bootloop. I've cleared all the cache, tried a wipe from the stock recovery, tried flashing TWRP and wiping there.. nothing seems to work. Im not too worried, but it'd be nice if it could boot again.
Thanks for your guide. It worked like a charm for my Nexus 4.
Just a small addition: To resize the system partition automatically I placed a script in /system/addon.d:
Code:
#!/sbin/sh
#
# /system/addon.d/10-resize-system.sh
#
. /tmp/backuptool.functions
case "$1" in
backup)
# Stub
;;
restore)
# Stub
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
/sbin/resize2fs /dev/block/platform/msm_sdcc.1/by-name/system
;;
post-restore)
# Stub
;;
esac
If it doesn't work for you
Thanks for this great guide!
Decided to breath some new life into an old N4 in my family and now it's going (very) strong again with LineageOS 15.1. Still had to clear a bit over 100 MB with .gapps-config from Stock-OpenGapps, but that's no biggie. I always liked to start with the big package and then remove everything that I don't need from it.
Second issue gave me some headaches at first.
"Resize File System" in TWRP apparently worked and Gapps-Install went through (~100 MB free at the end), but boot would fail and crash back to recovery.
(I'm using the daily LOS-nightlies by Milaq and Stock-Package from OpenGapps, maybe it's no problem with other ROMs and/or Gapps-Packages.)
Turns out the fix in TWRP wasn't really working, nevermind what partition size it shows for /system afterwards. It's somehow corrupted and still has the original size -> most of the gapps stuff get's written to nirvana, thus the failing boot.
I found the solution over in the Nexus5-Thread:
JekaPinsk said:
Hello guys!
Try this:
1) Install ROM
2) Backup ROM
3) Enable "Use 'rm -rf' instead of formatting" in TWRP settings
4) Format /system
4.1) Unmount /system and use 'resize2fs -f /dev/block/mmcblk0p21' in terminal (TWRP)
5) Reboot TWRP
5.1) Uncheck "Use 'rm -rf' instead of formatting" in TWRP settings
6) Restore backup
7) Install Stock OpenGapps
8) Done!
The idea behind it is that ROM installation somehow corrupt /system partition thus any write operations above normal data region silently fail.
Click to expand...
Click to collapse
at step 4.1 I already changed the partition number to 21 for Nexus4. In the original post it says mmcblk0p25, because on the Nexus 5 that's /system.
Now it works.
In theory this procedure should also work for updating the ROM without losing data, but haven't tested it yet. (Maybe throw in a wipe of /system as step 0...?)
To be clear: This isn't the fault of the guide to resize system-partition.
Problem is (at least certain) ROMs resetting size of file system to original and then TWRP failing to fix that doing it the easy way as described in OP (-> bug in TWRP?).
EDIT:
Above procedure also works for an update without data loss. Only difference was I did a normal wipe of /system first, "step 0" so to say.
No idea if all this is still necessary with TWRP 3.2.3-0, I'm not willing to risk a full wipe at this point. ^^
i need this...can't even install the smallest gapps package after oreo.... word!! thanks!
Really wanted to thank-you for this!
Two questions:
1. When you printed the partitions, system (21) was ext2. When you recreated it after resizing, you created it as ext4. Was that intentional?
2. You also made the claim that modern ROMs don't need such a big cache partition (your new one was 37MB, I wasn't so brave). Can you justify that claim or provide some technical details? It's not that I don't believe you (I trusted you enough to do this on my device!), just merely curious as to why/how this would be.
Thanks!
X:\xxx\xxx\xxx\xxx\adb>adb push parted /
487 KB/s (346680 bytes in 0.695s)
X:\xxx\xxx\xxx\xxx\adb>adb shell
~ # chmod +x parted
chmod +x parted
~ # ./parted /dev/block/mmcblk0 p
./parted /dev/block/mmcblk0 p
Error: Can't have overlapping partitions.
~ # 
Please Help!!!!!!!!!!!!!!!!!!!
caliban2 said:
Thanks for this great guide!
Decided to breath some new life into an old N4 in my family and now it's going (very) strong again with LineageOS 15.1. Still had to clear a bit over 100 MB with .gapps-config from Stock-OpenGapps, but that's no biggie. I always liked to start with the big package and then remove everything that I don't need from it.
Second issue gave me some headaches at first.
"Resize File System" in TWRP apparently worked and Gapps-Install went through (~100 MB free at the end), but boot would fail and crash back to recovery.
(I'm using the daily LOS-nightlies by Milaq and Stock-Package from OpenGapps, maybe it's no problem with other ROMs and/or Gapps-Packages.)
Turns out the fix in TWRP wasn't really working, nevermind what partition size it shows for /system afterwards. It's somehow corrupted and still has the original size -> most of the gapps stuff get's written to nirvana, thus the failing boot.
I found the solution over in the Nexus5-Thread:
at step 4.1 I already changed the partition number to 21 for Nexus4. In the original post it says mmcblk0p25, because on the Nexus 5 that's /system.
Now it works.
In theory this procedure should also work for updating the ROM without losing data, but haven't tested it yet. (Maybe throw in a wipe of /system as step 0...?)
To be clear: This isn't the fault of the guide to resize system-partition.
Problem is (at least certain) ROMs resetting size of file system to original and then TWRP failing to fix that doing it the easy way as described in OP (-> bug in TWRP?).
EDIT:
Above procedure also works for an update without data loss. Only difference was I did a normal wipe of /system first, "step 0" so to say.
No idea if all this is still necessary with TWRP 3.2.3-0, I'm not willing to risk a full wipe at this point. ^^
Click to expand...
Click to collapse
I'm using TWRP 3.2.3-0 and it has this bug, too. After I followed your steps I was able to install Nitrogen OS and Open Gapps Micro in my phone without erros.
Thanks!
I believe that resize2fs step can be packaged as a flashable zip so we can batch flashing without manual intervention to it (i.e. manually resize fs on system after each rom flash) .
ivanich said:
I believe that resize2fs step can be packaged as a flashable zip so we can batch flashing without manual intervention to it (i.e. manually resize fs on system after each rom flash) .
Click to expand...
Click to collapse
Maybe then more users would dare to use this solution and could calmly install gapps on Pie.
You have a lot of experience. What do you suggest?
Hi all. I only discovered this thread after independently figuring out the partitioning scheme (plain GPT) and process.
Sadly, even after this effort, it seems L-OS upgrades won't work unless L-OS devs modify their upgrade script to make use of resize2fs. Here's what happens as of package 2018-09-11:
L-OS runs backup procedure for all addons found in the existing /system/addon.d/
The above creates files (I guess) in /tmp
The /system is unmounted
The partition is overwritten with the image in the upgrade package
The script in addon.d/ are then run to restore the addons from /tmp
The problem is, the partition image in the upgrade package is for the old partition size, and therefore step 5 fails when the free space runs out. It seems the install or restore scripts don't detect this failure, and just exit without reporting an error, with 0B free space on /system.
I'm guessing the problem can be "solved" by formatting the system partition and installing LOS and all addons from scratch, but that's ridiculous. has anyone tried to raise this issue with devs? I'm about to report this in L-OS's JIRA, as I haven't seen any relevant report there.
EDIT: If anyone wants to track: https://jira.lineageos.org/browse/BUGBASH-2306
myxal said:
Hi all. I only discovered this thread after independently figuring out the partitioning scheme (plain GPT) and process.
Sadly, even after this effort, it seems L-OS upgrades won't work unless L-OS devs modify their upgrade script to make use of resize2fs. Here's what happens as of package 2018-09-11:
L-OS runs backup procedure for all addons found in the existing /system/addon.d/
The above creates files (I guess) in /tmp
The /system is unmounted
The partition is overwritten with the image in the upgrade package
The script in addon.d/ are then run to restore the addons from /tmp
The problem is, the partition image in the upgrade package is for the old partition size, and therefore step 5 fails when the free space runs out. It seems the install or restore scripts don't detect this failure, and just exit without reporting an error, with 0B free space on /system.
I'm guessing the problem can be "solved" by formatting the system partition and installing LOS and all addons from scratch, but that's ridiculous. has anyone tried to raise this issue with devs? I'm about to report this in L-OS's JIRA, as I haven't seen any relevant report there.
EDIT: If anyone wants to track: https://jira.lineageos.org/browse/BUGBASH-2306
Click to expand...
Click to collapse
You may be able to fix that on your own by adding an add-on.d named 00-resize-system (so that's it's ran first) that just does "resize2fs /dev/block/.../system", with maybe an unmount before and a mount after. This way, LOS can just flash the full image when upgrading and the system is resized before the other addons.d scripts run.
Fif_ said:
You may be able to fix that on your own by adding an add-on.d named 00-resize-system (so that's it's ran first) that just does "resize2fs /dev/block/.../system", with maybe an unmount before and a mount after. This way, LOS can just flash the full image when upgrading and the system is resized before the other addons.d scripts run.
Click to expand...
Click to collapse
Thanks for the tip, will give that a try. Any idea where I could find an "authoritative" docs/guide to those scripts? Just looked at the one supplied by open g-apps, and I don't really see the difference between the various commands that the script is supposed to handle (which is executed when?). Also what list_file() is supposed to provide.
backup
restore
pre-backup
pre-restore
post-backup
post-restore
myxal said:
Thanks for the tip, will give that a try. Any idea where I could find an "authoritative" docs/guide to those scripts? Just looked at the one supplied by open g-apps, and I don't really see the difference between the various commands that the script is supposed to handle (which is executed when?). Also what list_file() is supposed to provide.
backup
restore
pre-backup
pre-restore
post-backup
post-restore
Click to expand...
Click to collapse
You want to put the resize2fs call in the pre-restore section.
It should look like this:
Code:
pre-restore)
unmount /system
resize2fs /dev/block/platform/.../system
mount /system
;;
This includes unmounting and remounting /system which I think are needed, but YMMV. You'll need to fill in the full path to system under /dev.
There is no authoritative resource for backup scripts that I know of, but the gapps script is a good example.
P.S.: If you make it work, please post the script for others...

[DEV][ Expand System Partition To 5GB - MediaPad M3 ]

Hello !
Here you will find the information needed to change the system partition from 2GB to 5GB - this operation is somewhat useful for installing any version of GApps on your device : Huawei MediaPad M3 8.4 Kirin version ( BTV-DL09; BTV-L0J; BTV-W09 )
Thanks to @accerian for his help, and you can also check out this tutorial for more information !
Download mkfs.ext4 and parted from here : https://forum.xda-developers.com/attachments/parted_gdisk_fdisk_mkfs-ext4-arm-zip.4494671/
Warning : the entire data partition will be deleted following this procedure, make sure you have backed up and saved it to a microsd card
Step I : extended system partition from about 2GB to 5GB ( example for a 32GB device, for 64GB devices the procedure is 99% similar, only one operation differs which will be specified at the appropriate time ) - also this example is for BTV-DL09 which is with LTE capabilities.
- extract "mkfs.ext4" and "parted" from previously download archive and put them into a new created tmp directory
- connect the device to the computer via the USB cable and bring the device into TWRP revovery with this command :
> adb reboot recovery
- copy the two executable files from the computer to the device :
> adb push tmp data/local
> adb shell
# cp -r data/local/tmp/mkfs.ext4 sbin/mkfs.ext4
# chmod 0777 sbin/mkfs.ext4
# cp -r data/local/tmp/parted sbin/parted
# chmod 0777 sbin/parted
- launch the "parted" function as follows :
# parted /dev/block/mmcblk0
- display all properties of all partitions : (I wrote what needs to be displayed as a command before pressing enter, so you just have to type "print" and press enter because (parted) is already displayed as promter ... be careful not to type (parted) twice in the following commands)
(parted) print
- go to line 43, which should be the same for all devices :
43 1174MB 3255MB 2080MB ext2 system msftdata
44 3255MB 3456MB 201MB ext4 cust msftdata
45 3456MB 3490MB 33.6MB ext4 version msftdata
46 3490MB 4127MB 638MB ext2 vendor msftdata
47 4127MB 4329MB 201MB ext4 product msftdata
48 4329MB 4333MB 4194kB hisitest2 msftdata
49 4333MB 31.3GB 26.9GB userdata msftdata
Click to expand...
Click to collapse
- if line 43 is not identical to this one here, please stop the process by writing quit and enter, I'm waiting for a private message with what is written on line 43 in the case of your device so that I can guide you correctly .
- assuming that all devices have the same system partition ( the same 43 line ) - approximately 2GB, we go to the next steps:
- access the Mount menu in TWRP and uncheck Data, and follow the steps below step by step :
(parted) rm 49
(parted) rm 48
(parted) rm 47
(parted) rm 46
(parted) rm 45
(parted) rm 44
(parted) rm 43
(parted) mkpart system ext2 1174 6501
(parted) name 43 system
(parted) set 43 msftdata on
(parted) mkpart cust ext4 6501 6702
(parted) name 44 cust
(parted) set 44 msftdata on
(parted) mkpart version ext4 6702 6736
(parted) name 45 version
(parted) set 45 msftdata on
(parted) mkpart vendor ext2 6736 7374
(parted) name 46 vendor
(parted) set 46 msftdata on
(parted) mkpart product ext4 7374 7575
(parted) name 47 product
(parted) set 47 msftdata on
(parted) mkpart hisitest 7575 7579
(parted) name 48 hisitest2
(parted) set 48 msftdata on
- for devices with 32GB :
(parted) mkpart userdata 7579 31.3GB
- for devices with 64GB :
(parted) mkpart userdata 7579 62.5GB
(parted) name 49 userdata
(parted) set 49 msftdata on
(parted) quit
Step II : activating partitions for reuse :
# mkfs.ext4 /dev/block/mmcblk0p43
# mkfs.ext4 /dev/block/mmcblk0p44
# mkfs.ext4 /dev/block/mmcblk0p45
# mkfs.ext4 /dev/block/mmcblk0p46
# mkfs.ext4 /dev/block/mmcblk0p47
# mkfs.ext4 /dev/block/mmcblk0p49
- go to TWRP -> Wipe -> Advanced Wipe -> select System -> Repair or Change File System -> Change File System -> EXT4 -> Swipe to Change
- go to TWRP -> Wipe -> Advanced Wipe -> select Vendor -> Repair or Change File System -> Change File System -> EXT4 -> Swipe to Change
- go to TWRP -> Wipe -> Format Data -> yes
- reboot device from TWRP to TWRP in order to use data again after formated !
- go to TWRP -> Wipe -> Advanced Wipe -> select Dalvik/ART Cache, Cache, Data, Internal Storage, System, Vendor -> Swipe to wipe
- copy the new updated of LOS 17.1 with system partition of 5GB into your device
- copy any GApps arm64 Android 10 to your device
- Install them like always, enjoy !
Mention :
- if your device is WiFi only, you may have fewer partitions .... the above instructions can be easily adapted from case to case !
The main idea is that we must first find out what position the system partition is in, in this case it was at position 43 which corresponds to /dev/block/mmcblk0p43 - then we need to delete all partitions from userdata to system, and recreate them in the same order !
To calculate the start and end position, it is again very easy : for example the system partition starts from the initial position 1174, which is the same as the end position of the previous partition 42 (42 1160MB 1174MB 14.7MB reserved3 msftdata), and the end position was incremented by 5327 in this case (almost 5GB), resulting in 6501. .. the next partition 44 (cust) will have the starting position 6501, and the end position will be incremented by 201 (i.e. 201MB) as shown on line 44 (44 3255MB 3456MB 201MB ext4 cust msftdata)
If really needed, a concrete example will be added here for WiFi only devices !
Thanks for this guide.
Thank you surdu_petru.
The internal storage size of BTV-L0J is 16GB, is the above procedure effective?
Is it possible to restore a partition size back to its original size? I sometimes use a dd command as a way to restore from LineageOS to stock ROM. So I need to restore it to its original size before using a dd command.
According to z3DD3r, who created a tool to resize the Nexus 5 system partition, it is recommended that after changing the partition size, TWRP should also be changed.
z3DD3r said:
Because TWRP includes size of system partition. This size should match the size of system partition on device. Otherwise bad things can happen...
Click to expand...
Click to collapse
Is there any problem without changing TWRP?
I am sorry for asking so many questions. I am cautious about changing the partition size because it is perilous.
Me said:
Thank you surdu_petru.
The internal storage size of BTV-L0J is 16GB, is the above procedure effective?
Is it possible to restore a partition size back to its original size? I sometimes use a dd command as a way to restore from LineageOS to stock ROM. So I need to restore it to its original size before using a dd command.
According to z3DD3r, who created a tool to resize the Nexus 5 system partition, it is recommended that after changing the partition size, TWRP should also be changed.
Is there any problem without changing TWRP?
I am sorry for asking so many questions. I am cautious about changing the partition size because it is perilous.
Click to expand...
Click to collapse
If you still have 49 partitions, and partition 43 (system) shows that in the above tutorial then the procedure is identical, you just have to put a lower value of the user data partition in the last corresponding line of 16GB!
- for devices with 16GB:
(parted) mkpart userdata 7579 ?? GB
Click to expand...
Click to collapse
There is no need to change anything, neither TWRP nor the partition to the initial value ... the most important thing is to pay attention to the Start and End position of system partition to make the calculations as accurate as possible !
I can help you if you can send me a screenshot of what the command below displays on your device (from the system down to the last partition):
> adb shell
# parted /dev/block/mmcblk0 print
surdu_petru said:
If you still have 49 partitions, and partition 43 (system) shows that in the above tutorial then the procedure is identical, you just have to put a lower value of the user data partition in the last corresponding line of 16GB!
There is no need to change anything, neither TWRP nor the partition to the initial value ... the most important thing is to pay attention to the Start and End position of system partition to make the calculations as accurate as possible !
I can help you if you can send me a screenshot of what the command below displays on your device (from the system down to the last partition):
> adb shell
# parted /dev/block/mmcblk0 print
Click to expand...
Click to collapse
Thank you for your reply.
It is good news that if each partition has the same number it is effective.
I am currently not having trouble with the size of system partitions, so I will give it some more thought.
@surdu_petru - many thanks for this guide, I found it very clear and straightforward. I wasn't sure if you were wanting confirmation that these instructions work with other models of the tablet - if so, I can confirm it works perfectly with my (wifi only, 32GB) BTV-W09.
Herby007 said:
@surdu_petru - many thanks for this guide, I found it very clear and straightforward. I wasn't sure if you were wanting confirmation that these instructions work with other models of the tablet - if so, I can confirm it works perfectly with my (wifi only, 32GB) BTV-W09.
Click to expand...
Click to collapse
Thanks for confirmation. I'm not waiting especially confirmation, but it's always better if you can confirm. I'm here to help in case that something goes wrong.
I'm going for the 3rd time as the first I messed up. Second I did it right but I think I have to switch it up a little as I have the WIFI, and I can't do mkfs.ext4 after doing the parted commands. But I'll keep on it to see if all the partitions are exactly correct. I know 43 is the same as the directions said to make sure. 3rd times the charm. Good luck out there
Hey man, things are kinda messed up for me at the moment.
I've followed your steps however my cmd crashed for some reason during the process. Now I can't mount data to start the process again. Using the genuine EMUI Recovery offerd at startup doesn't work because the partitions are messed up and my own recovery points are inaccessible probably due to a currupted ext sd card (you can't make this up )
Do you have any tips on how to regain control? Or are all hopes lost?
I've tried using pro-team multi tool, however their database/website seems to be unavailable at the moment...
Edit: I have it fixed now, using a sd-card I did a force update to stock firmware, that fixed the storage. Had to restart the entire process starting with TWRP installation, device was still unlocked though. Don't be stupid like me and always check your recovery data before and not after you already messed things up
hey guys,
I somehow messed it up and I'm getting this error message
/data is not present!
Failed to mount '/data'
Partitions are formatted:
43 1174MB 6501MB 5327MB ext4 system msftdata
44 6501MB 6702MB 201MB ext4 cust msftdata
45 6702MB 6736MB 33.6MB ext4 version msftdata
46 6736MB 7374MB 638MB ext4 vendor msftdata
47 7374MB 7575MB 201MB ext4 product msftdata
48 7575MB 7579MB 4194kB hisitest2 msftdata
49 7579MB 31.3GB 23.7GB userdata msftdata
Here is an output of "df" command:
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.8G 184.0K 1.8G 0% /dev
tmpfs 1.8G 2.0M 1.8G 0% /tmp
/dev/block/mmcblk0p36 232.0M 756.0K 223.6M 0% /cache
/dev/block/mmcblk0p46 582.4M 468.0K 563.7M 0% /vendor
/dev/block/mmcblk1p1 59.5G 5.0G 54.5G 8% /external_sd
I can't continue with "TWRP -> Wipe"
Any ideas what went wrong?
BlueLife98 said:
Hey man, things are kinda messed up for me at the moment.
I've followed your steps however my cmd crashed for some reason during the process. Now I can't mount data to start the process again. Using the genuine EMUI Recovery offerd at startup doesn't work because the partitions are messed up and my own recovery points are inaccessible probably due to a currupted ext sd card (you can't make this up )
Do you have any tips on how to regain control? Or are all hopes lost?
I've tried using pro-team multi tool, however their database/website seems to be unavailable at the moment...
Edit: I have it fixed now, using a sd-card I did a force update to stock firmware, that fixed the storage. Had to restart the entire process starting with TWRP installation, device was still unlocked though. Don't be stupid like me and always check your recovery data before and not after you already messed things up
Click to expand...
Click to collapse
hey man, how did you install the stock firmware? tried to install these firmware's but didn't work at all https://firmwarefile.com/huawei-mediapad-m3-btv-dl09

Categories

Resources