[GUIDE][Noob-Friendly][adb] How to avoid Superbrick // How to revive your bricked Tab

Search This thread

Androguide.fr

Account currently disabled
Jul 21, 2012
2,056
7,236
GB
meettomy.site

HOW TO AVOID BRICKING YOUR TAB


The best advice I can give to people who haven't bricked their tab (already?^^) : DO NOT EVER WIPE ANYTHING WHILE RUNNING STOCK 7.7 ROMS
Here is what to do in order to flash a custom rom safely when coming from stock :

- Flash the latest cwm with ODIN
- Do NOT wipe anything
- Flash the custom rom of your choice
- Reboot recovery
- Wipe what you need to wipe
- Re-flash the custom rom
- flash the gapps or whatever
- Reboot, done.



Ok guys, I'm seeing more and more people bricking their 7.7 and, being one of the unlucky owners of a bricked p6810, I understand how stressful and annoying it can be.
I've been reviving my tab like a hundred times using this technique, as you'll most likely have to re-do that whole process everytime you wanna flash something.


There are two ways of reviving from superbrick I know of :

- The first is to flash a PIT file with ODIN that will repartition your tab for you.
I will not cover this method as hg42 already wrote a very detailed tutorial about this. This tutorial is about Galaxy Note but you can appIy it to our 7.7 and you'll find PITs for P6800 there. I will soon make pits for P6810 using the scripts provided in hg42's guide.

- The second way is to repartition your tab manually through adb. This is the method I'll try to teach you here.



Let's first be very clear :


- This won't get your tab back in its former state
- Your internal storage will shrink by a lot
- All your data will be lost
- No guarantee it works for you
- You'll most likely have to do that every time you flash
- Your tab might rebrick itself after some days, so you'll have to do this again, get used to it.
- If you can get Samsung to repair your tab then go ahead
- I'm not responsible for any further damage made to your tab
- You need a computer for this tutorial


Ok, you read the above carefully ? You are ok with it ? then let's begin
!







Using the Android Debugging Bridge (adb) to revive your tab






Setting up your environment

Prior to anything, you need to download and install the android sdk, I won't cover the installation here, it's explained on developer.android.com and there are plenty of guides on how to get adb and the sdk on xda.
Make sure you install the platform-tools in the sdk manager.


Ok now I assume you got the sdk installed, so let's move on to the serious things.





1) How to open an adb shell ?

First, you're going to need the latest ClockWorkMod Recovery (a.k.a CWM), download and instructions on locerra's thread here
Then boot your tab in recovery (Maintain power+volume up buttons) and plug it into your computer via usb.
Then do the following :

a- On Windows

Navigate to the directory where you installed the sdk, and open the folder called "platform-tools" (e.g : go to C:\android-sdk\platform-tools if your sdk is installed in C:\android-sdk)
Press shift and do a right clic on an empty space in the folder, then select "open a command prompt here" (or something like that).



b- On Linux

Open a terminal window (ctrl+T)
Let's assume you put the sdk in a folder called "android-sdk", located at the root of your home folder (~/android-sdk).
Then you have to enter this in the terminal :
Code:
cd ~/android-sdk/platform-tools



So now, all the rest of the commands you'll have to enter are the same on windows and linux, as the adb shell will actually be running in your tablet.







2) Meet a new friend, he's called parted.


First, we are going to use parted to take a look at our partitions and their file systems, and eventually replace the corrupt partitions with clean, freshly created ones.
Then, you'll meet your other very good friend with a barbarian name : e2fsck (e2 stands for ext2, and fsck for file system check. Not that barbarian finally is it ?). He will check your filesystems and fix the possible errors they got.


Ok now we've made the presentations, let's go !




First make sure you read the following :

In the code boxes of this tutorial, there are symbols at each line start, DO NOT COPY IT with the rest of the command ! :


-the "$" represents your bash shell or command prompt

-the "#" represents the adb shell

-the"(parted)" represents the (parted) shell

-Each end of line means "press Enter".

-The partitions numbers are not the same on p6810 and p6800 (please report to this reference), so there will be two code boxes in the examples, one for p6810 and one for p6800, it's indicated in bold red but make sure you don't mix it up, that could screw your tab even more.


Ok here we go !



Issue the following in your terminal/command prompt :
Code:
$ adb shell
# parted /dev/block/mmcblk0
(parted) print


The output should look like this :

>>> P6810 <<<
Code:
Number  Start   End     Size    File system  Name       Flags
 1      4194kB  25.2MB  21.0MB  ext4         EFS
 2      25.2MB  26.5MB  1311kB               SBL1
 3      27.3MB  28.6MB  1311kB               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  264MB   209MB   ext4         CACHE
 8      264MB   1137MB  872MB   ext4         FACTORYFS
 9      1137MB  15.3GB  4163MB  ext2         DATAFS
10      15.3GB  15.7GB  470MB   ext4         HIDDEN
11      15.7GB  15.8GB  8389kB               FOTA

>>> P6800 <<<
The start/end values are wrong, please give me your p6800 output so I can update this.
Code:
Number  Start   End     Size    File system  Name       Flags
 1      4194kB  25.2MB  21.0MB  ext4         EFS
 2      25.2MB  26.5MB  1311kB               SBL1
 3      27.3MB  28.6MB  1311kB               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  264MB   209MB   ext4         CACHE
 8      3054MB  3926MB  872MB   ext4         MODEM/RADIO (not sure as I don't own this model)
 9      264MB   1137MB  872MB   ext4         FACTORYFS
10      1137MB  15.3GB  4163MB  ext2         DATAFS
11      15.7GB  15.8GB  8389kB               HIDDEN
12      15.8GB  15.9GB  8389kB               FOTA




The superbrick MMC_CAP_ERASE bug that affects our tab apparently only corrupts the /system and /data partitions (sometimes, /cache can also get corrupt in the process, I cover this in the last part of this guide, "extra cases").

Your emmc chip on which resides those /data & /system partitions is corrupt at some places.
To give you an example, think of it as a chain of dashes :
Code:
-----------------------------------------------------

This dash chain is divided in two parts (our /system and /data partitions), I'll symbolize their length with "[]" for /system and "()" for /data :
Code:
[----------](-------------------------------------------)

So that's how it was on your tab before brick, but now it's bricked some blocks (the dashes "-" here) are corrupt. I'll symbolize them with "?" :
Code:
[--??--???-](--???-?-----------????-----------??-?--??--)

Now you figure the workaround don't you ? We need to move our /system & /data partitions to places that are clean, at the cost of reducing their sizes :
Code:
--??--???---???-?[-----------]????(-----------)??-?--??--
We will strive to give /system its original size, or something close to it, while we can sacrifice more of the /data partition.




Ok, enough theory, let's move on to practice.




Here, in parted, /system = FACTORYFS and /data = DATAFS
We are going to remove the /data partition first, so we have some space to work on.

Enter the following :

>>> P6810 <<<
Code:
(parted) rm 9

>>> P6800 <<<
Code:
(parted) rm 10

Now please refer to the output of (parted) print you had earlier, just scroll up a little in your terminal window. See those Start/End values ? Well check the end value of your DATAFS partition and remember it.

Here's an example for P6810 :
Code:
9     *START -->*1137MB  15.3GB*<-- END*  4163MB  ext2         DATAFS




So now comes the boring part. We are going to try to make a new clean /data partition.
Seems easy but the problem is :

- if you try to make it too big, it'll get stuck and return an I/O error.
- if some blocks are corrupt between the start/end values you'll enter it will get stuck and return an I/O error.


In both cases you'll have to reboot recovery and re-enter this in your terminal :
Code:
# adb shell
# parted /dev/block/mmcblk0

So this is long and boring to find the right place and the right size. Don't be greedy on the size, as long as you get at least 150-200mb it's cool, you'll be able to expand that later.
First you're gonna try to put the original end value (15300 in the p6810 example up there) as the new end value. So for the same example, if you wanna try to make a 500mb /data partition, you're gonna use 14800 as start value and 15300 as end value.

Ok let's go (this is still an example for p6810, for the p6800 owners, use your own (parted) print results) :
Code:
(parted) mkpartfs primary ext2 14800 15300

It will output something like this :
Code:
writing per-group metadata : XX %




Here there are two options :

- You were lucky, it will complete up to 100% and return "(parted)", which case you just have to enter the following :

>>> P6810 <<<
Code:
name 9 DATAFS

>>> P6800 <<<
Code:
name 10 DATAFS

- You were not lucky, it got stuck before reaching 100%, which case you have to reboot your recovery, re-enter parted and try again with a smaller start/end gap, or reducing the end value, you got about 14gb of space to try to make your partition, so it's sure you can find somewhere to put your small partition, just requires some blind testing.

Just remember to try to put your /data partition quite close to the end (original end value), so you still have some space to find somewhere to put your /system partition.

So now we'll assume you managed to have mkpartfs complete till 100%

Type this to see your updated partition table :
Code:
(parted) print



Now we're going to repeat last step with the /system partition.
Issue this :

>>> P6810 <<<
Code:
rm 8

>>> P6800 <<<
Code:
rm 9

The /system partition is much more important than /data, so you want to try to have its size remaining the same (872mb).
At first, you can try to re-make the /system partition with the same start/end values. It's not likely to work but it's worth trying.

Here's an example on P6810:
(again, if you're on P6800, then use your own start/end values for the 9th partition (FACTORYFS), you get them by typing print in parted).
Code:
(parted) mkpartfs primary ext2 264 1137

Same thing here, if it doesn't complete, then reboot recovery, type :
Code:
$ adb shell
# parted/dev/block/mmcblk0

And repeat this step until you find somewhere it works : (where YYY - XXX = 872)
Code:
(parted) mkpartfs primary ext2 XXX YYY

Remember to limit your research between FACTORYFS original start value (264 for P6810) and the new DATAFS start value you made, so you keep the order of the partitions.

Once you found the right place (where "writing per-group metadata" completes till 100%), type this :

>>> P6810 <<<
Code:
name 8 FACTORYFS

>>> P6800 <<<
Code:
name 9 FACTORYFS


The hardest part is done, if you type this you should get a full table of partition, make sure no number is missing or disordered (1,2,3,4,etc...).
Code:
(parted) print






3) Meet another good friend : e2fsck




Now we've done our fresh and clean partitions, you must be thinking we're done, but we're not ^^
In fact the two partitions we made are using ext2 filesystem, but the /system partition's filesystem should be ext4 (like it was at the beginning).

There are two ways of converting an ext2 filesystem to ext4 that I know of :

- Simply formatting /system in cwm recovery will convert the filesystem to ext4. To do this, just head to "mounts & storages" and select "format /system".
If it gets stuck while formatting, reboot your recovery by pressing the power+volume-up buttons for about 15 seconds, and head to the next part, you have to do something before you can try to format it again.


- Or issuing this in terminal :

>>> P6810 <<<

Code:
# tune2fs –O dir_index,uninit_bg,has_journal /dev/block/mmcblk0p8

>>> P6800 <<<
Code:
# tune2fs –O dir_index,uninit_bg,has_journal /dev/block/mmcblk0p9

To make sure either of the two ways worked do this :
Code:
# parted /dev/block/mmcblk0
(parted) print
And look if FACTORYFS shows ext4.

If it does, reboot recovery, then on to next part. If it doesn't, then still reboot recovery and head to next part, after which I'll redirect you here to try again.




Now we are going to use e2fsck to check our new partitions for errors, but not only, it also fixes some erros and it will even for example create lost & found in /data
So let's go, we'll begin with /system. If you're still in the (parted) shell, use ctrl+c and type "adb shell", then issue the following :

>>> P6810 <<<
Code:
e2fsck -yfDC0 /dev/block/mmcblk0p8

>>> P6800 <<<
Code:
e2fsck -yfDC0 /dev/block/mmcblk0p9

This might take long, or not, this might get stuck, or not. Either way reboot recovery if it gets stuck or whatever, but do it again till it finishes properly.
This is what my /system e2fsck final output looks like (p6810) :
Code:
/dev/block/mmcblk0p8: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p8: 2636/53312 files (1.2% non-contiguous), 101948/212890 blocks
If you got 0.0% or like less than 5% in "(X.X% non-contiguous)" this is a good sign.




Now reboot recovery and let's do the same for /data :

>>> P6810 <<<
Code:
# e2fsck -yfDC0 /dev/block/mmcblk0p9

>>> P6800 <<<
Code:
# e2fsck -yfDC0 /dev/block/mmcblk0p10

Same thing here, if it gets stuck then reboot recovery and do it again.
Here you should get 0.0% non contiguous. If you don't, in cwm do wipe data/factory reset, then reboot recovery and do this e2fsck again.



Ok now you got both clean e2fsck, (if you still have an ext2 FACTORYFS then now is the time to go back to try converting ext2 to ext4 again)

Make sure the e2fsck still are clean by doing this (it should be quick this time) :

>>> P6810 <<<
Code:
# e2fsck -cy /dev/block/mmcblk0p8
# e2fsck -cy /dev/block/mmcblk0p9

>>> P6800 <<<
Code:
# e2fsck -cy /dev/block/mmcblk0p9
# e2fsck -cy /dev/block/mmcblk0p10



Now you should be nearly good to go ! :laugh:


Download the cm9/cm10-based rom you want, make sure you check known issues and that you like this rom because everytime you'll want to flash a rom it's likely you'll have to do the whole e2fsck part again, or even sometimes the whole guide.

Now reboot in recovery and flash the rom. Two options :

- it flashes, then reboot, pray and be patient, if it takes more than 15 minutes to boot first time, then reboot it again, do this a few times if it doesn't boot, it might eventually do. If it doesn't, then reboot recovery and redo the e2fsck command for both /data and /system, let it fix things if it has to, then reboot again. Anyway it should have booted by now.

- flashing gets stuck : make sure you waited at least 5 minutes then reboot recovery---> wipe data/factory reset---> wipe dalvik cache---> reboot recovery---> adb shell and redo the e2fsck on both /data and /system, then try flashing again.


DO NOT FLASH THE GAPPS NOW, that will screw all you just done ! If you need the gapps then head to the following section of this guide.







4) Installing the gapps




If you flash the gapps after flashing the rom you'll be screwed, you'll have to redo the e2fsck part and maybe even the parted, and I know you don't want to.
So the workaround is to add the gapps to the cm-based rom you downloaded.

It's easy, just follow me :

Open the zipped rom you downloaded with 7zip or WinRar (Windows), or with Archive Manager or else (Ubuntu). Do not extract it, we'll modify the zip directly.
Do the same with the gapps, so you have both archive side to side.

In the rom, you have boot.img, and two folders : "META-INF" and "system". We will modify things in "system" folder ONLY. Open "system" folder.
In the gapps we will only use things from the "system" and "optional" folders.

The rest is pretty easy to figure out. In the gapps's "system" and "optional" folders you have folders which have the same name as some folders in "system" of the rom.
Just copy/replace everything that is in those folders of the gapps to the corresponding folders of the rom. Don't forget to do that with both "system" AND "optional" folders of the gapps.

When it's done just close the freshly modified rom, copy it to your tab's external sdcard and flash it.

If you don't have an external sdcard, then reboot recovery, copy the rom to the "platform-tools" folder of your android-sdk and rename it rom.zip.
Then return to your terminal and do the following :
Code:
$ adb push rom.zip /sdcard
It will now be in your internal sdcard (remember you shrinked it earlier so make sure the rom doesn't take all the space).





5) Expanding your internal storage



I don't recommend you do this the first time you follow this guide.
It might screw your /data partition so you have to do the whole process I describe in this guide again.
Anyway if you wanna try, this allowed me to earn a few extra gigs (never managed to get back more than 4gb and boot).

Here's what to do :

>>> P6810 <<<
Code:
$ adb shell
# parted /dev/block/mmcblk0
(parted) resize 9

>>> P6800 <<<
Code:
$ adb shell
# parted /dev/block/mmcblk0
(parted) resize 10

This will output something like :
Code:
Start ?
End ?
writing per-group metadata : XX %

You can only move the end value in fact, trying to change the start value will return an error. Try doing this to earn like 250mb at a time so it doesn't get stuck. Good luck.





6) Extra cases



If when booting in recovery, the recovery says something like "can't read /cache/recovery/last-log, Read-Only file system" then your /cache partition is corrupt.
Then you'll need to recreate it with parted. /cache is quite small (209mb) so it should be easy to have "writing per-group metadata" finishing.

Here are the commands to remove and recreate /cache with parted (it's the same on both models) :
Code:
$ adb shell
# parted /dev/block/mmcblk0
(parted) print
(parted) rm 7
(parted) mkpartfs primary ext2 XX YY (where YY - XX = 209 and YY < FACTORYFS start value)
 
Last edited:

Josvaz

Senior Member
Feb 17, 2012
250
23
i being running e2fsck -yfDC0 /dev/block/mmcblk0p10 on my p6800 since yesterday this time. till now still show error reading block *******<attempt to read block from filesystem resulted in short read> while getting next indoe from scan. ignore error? yes
force rewrite? yes

question now is should i let it keep running or change to e2fsck -fDC0 /dev/block/mmcblk0p10 ?? hmm
 

Dablah90

New member
Aug 19, 2012
2
0
i being running e2fsck -yfDC0 /dev/block/mmcblk0p10 on my p6800 since yesterday this time. till now still show error reading block *******<attempt to read block from filesystem resulted in short read> while getting next indoe from scan. ignore error? yes
force rewrite? yes

question now is should i let it keep running or change to e2fsck -fDC0 /dev/block/mmcblk0p10 ?? hmm

Not sure but this "attempt to read block resulted in short-read" error remembers me of my own brick, I think it's the error you get when you can't mount /data in recovery's mounts & storages.
Try to mount /data and if recovery can't mount it, then u need to recreate your /data partition with parted, like it's explained in this guide.
e2fsck alone won't fix it if it's not mountable.

Just talking from my own experience, but there might be other ways.
 
Last edited:

aletheus

Senior Member
Oct 13, 2011
586
280
two questions:

1) i read something about having to back up the /efs partition? as it contains your bluetooth mac id and your emei number before flashing any alternative pit file
2) when i try to start the android SDK installer it says "Java SE Development Kit (JDK) no found. </br> Error: Failed to find Java version for 'C:\Windows\system32\java.exe,' blah blah blah"--is it because i tried to install the jdk 64-bit?

---EDIT--- solved the installation problem. setting up android SDK now...
 
Last edited:

Androguide.fr

Account currently disabled
Jul 21, 2012
2,056
7,236
GB
meettomy.site
two questions:

1) i read something about having to back up the /efs partition? as it contains your bluetooth mac id and your emei number before flashing any alternative pit file
2) when i try to start the android SDK installer it says "Java SE Development Kit (JDK) no found. </br> Error: Failed to find Java version for 'C:\Windows\system32\java.exe,' blah blah blah"--is it because i tried to install the jdk 64-bit?

---EDIT--- solved the installation problem. setting up android SDK now...

Well yeah you can backup your efs but if you follow exactly this guide there's no way you can mess up your efs, as it's the first partition and we only deal with partitons 8 to 10.


Not sure but this "attempt to read block resulted in short-read" error remembers me of my own brick, I think it's the error you get when you can't mount /data in recovery's mounts & storages.
Try to mount /data and if recovery can't mount it, then u need to recreate your /data partition with parted, like it's explained in this guide.
e2fsck alone won't fix it if it's not mountable.

Just talking from my own experience, but there might be other ways.

I guess e2fsck won't run if the partition you check isn't mountable.
But you're right that e2fsck can't fix everything, the method I describe is drastic but it works.

So Josvaz, if after running e2fsck - try any options you want, won't harm (but add -y so it answers yes to all and you can go have a coffee) - you see more than 2 or 3% in " XX.XX% non contiguous" then remove your partition and recreate it using parted's mkpartfs, and re-run e2fsck, it should now be clean (0.0% non contiguous) and you can flash on it and boot your tab if your /system is clean (or close to) too.

Good luck.
 
Last edited:

aletheus

Senior Member
Oct 13, 2011
586
280
- The first is to flash a PIT file with ODIN that will repartition your tab for you.
I will not cover this method as hg42 already wrote a very detailed tutorial about this. This tutorial is about Galaxy Note but you can appIy it to our 7.7 and you'll find PITs for P6800 there. I will soon make pits for P6810 using the scripts provided in hg42's guide.

but if i use this method, do i need to back up the /efs partition? i guess, i need the experience with abd, and its certainly not going to hurt anything if i do, and didn't need to. so i'll try that and see if i get a response in the mean time.

You should be able to flash any stock ROM from samfirmware (click on n7000 under "models"), I would recommend the one you had before the brick and and before any stock ICS, else you risk a brick again!.
Note: I think the standard recovery doesn't give you enough format options (a guess, I am running cm9).

is this possibly a way to avoid having to go through this process every few days or so?
 
Last edited:

Androguide.fr

Account currently disabled
Jul 21, 2012
2,056
7,236
GB
meettomy.site
but if i use this method, do i need to back up the /efs partition? i guess, i need the experience with abd, and its certainly not going to hurt anything if i do, and didn't need to. so i'll try that and see if i get a response in the mean time.

Yeag for the PIT method, backing up your efs is wise, although the PITs won't mess with it normally. But yeah, can't hurt to back it up.
You don't need no experience with adb to flash a PIT, just know how to use odin, download the pit for your particular model (eg : p6800 16gb) put it in odin's "PIT" slot (the first slot), make sure repartion IS ticked, click start and let it flash.
 
Last edited:

Josvaz

Senior Member
Feb 17, 2012
250
23
giving up lol .. any thing i need to do before i send to samsung ? like original pit, rom etc? anyone have original pit file ?
 

aletheus

Senior Member
Oct 13, 2011
586
280
Yeag for the PIT method, backing up your efs is wise, although the PITs won't mess with it normally. But yeah, can't hurt to back it up.
You don't need no experience with adb to flash a PIT, just know how to use odin, download the pit for your particular model (eg : p6800 16gb) put it in odin's "PIT" slot (the first slot), make sure repartion IS ticked, click start and let it flash.

okay, but i need adb to back up /efs i think.
 

Josvaz

Senior Member
Feb 17, 2012
250
23
hee i wanna quit cos i cant save more than half the space, manage 3.82GB left~
 

aletheus

Senior Member
Oct 13, 2011
586
280
Yeag for the PIT method, backing up your efs is wise, although the PITs won't mess with it normally. But yeah, can't hurt to back it up.
You don't need no experience with adb to flash a PIT, just know how to use odin, download the pit for your particular model (eg : p6800 16gb) put it in odin's "PIT" slot (the first slot), make sure repartion IS ticked, click start and let it flash.

the efs back up, is that used from within adb, or flashed as part of a recovery or? in other words, how do i use it?
 

Androguide.fr

Account currently disabled
Jul 21, 2012
2,056
7,236
GB
meettomy.site
even on stock honeycomb ?????
am going to get a p6800 3g tomorrow, please don't scare me lol

Yeah whether hc or ics, for some reason, samsung devs thought it was a good idea to include mmc_cap erase a.k.a superbrick bug in their kernels.
Anyway I doubt you'd love to stay on y
touchwiz hc, which the most laggy experience I ever had.
 
  • Like
Reactions: sos_sifou

sos_sifou

Senior Member
Mar 30, 2009
480
261
Algiers
www.sifou.jimdo.com
Anyway I doubt you'd love to stay on y
touchwiz hc, which the most laggy experience I ever had.

yeah :) I don't think that i will keep using hc for long, but consider that most isc roms are pipi-caca (wifi issues and battery drain) Ill wait for some stable builds (just like overcome on my beloved "sold" GTP1000).

I think that dedraks made a new kernel which is without the brick bug ? is it safe to use with hc ??

and thanks for the great work you're doing on the new galaxy tab 7.7 (merci beaucoup !)
 
Last edited:

aletheus

Senior Member
Oct 13, 2011
586
280
so i have not figured out how to get a working pit file flashed. there are so many, and i VAGUELY understand his numbering system, so i figured i'd start with the smallest available space first, because that one would be the most likely to account for any bad blocks. i tried nearly ALL of them. now i'm trying to test to see whether adb is able to access ANYTHING-- (tab is booting into recovery and download, and adb detects the device from windows) however, what i'm getting is "/sbin/sh: parted: not found" is that saying that parted cant be found or that parted cant find the reference block? researching this now.

so obviously, i've had to sit down and warm up to your NOOB GUIDE!!! its very clear, i just havent done this level of anything with android, tho what better way to learn than sink or swim? problem is, i'm an artist, and pretty broke.... my computer fried months and months ago, and i just decided i'd rather spend my extra cash on the gTab 7.7 cus is the largest affordable sAMOLED to date, and well, a 30% expansion of the standard color model really appealed to me, so the only thing i have to work on is my super bricked tab!!! a friend of mine is lending me her laptop while she's at work, and i'd like to try to fix it this evening.... ughh....

if anybody can help me figure out my way through this tutorial, i'll be researching why 'parted' isn't working.

THANKS!!!

---UPDATE

okay, so for some reason, i can't seem to push files from adb to the device. from what i've read, i have to manually install parted to sbin, (or there's a flashable kit available also) but i can't figure out how to get it to pick up the file (its in the folder with ADB.exe, so i shouldn't need to reference the path for the copy location, right?)

now i'm looking up general "ADB device navigation and testing"
---ugghhh....
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 24

    HOW TO AVOID BRICKING YOUR TAB


    The best advice I can give to people who haven't bricked their tab (already?^^) : DO NOT EVER WIPE ANYTHING WHILE RUNNING STOCK 7.7 ROMS
    Here is what to do in order to flash a custom rom safely when coming from stock :

    - Flash the latest cwm with ODIN
    - Do NOT wipe anything
    - Flash the custom rom of your choice
    - Reboot recovery
    - Wipe what you need to wipe
    - Re-flash the custom rom
    - flash the gapps or whatever
    - Reboot, done.



    Ok guys, I'm seeing more and more people bricking their 7.7 and, being one of the unlucky owners of a bricked p6810, I understand how stressful and annoying it can be.
    I've been reviving my tab like a hundred times using this technique, as you'll most likely have to re-do that whole process everytime you wanna flash something.


    There are two ways of reviving from superbrick I know of :

    - The first is to flash a PIT file with ODIN that will repartition your tab for you.
    I will not cover this method as hg42 already wrote a very detailed tutorial about this. This tutorial is about Galaxy Note but you can appIy it to our 7.7 and you'll find PITs for P6800 there. I will soon make pits for P6810 using the scripts provided in hg42's guide.

    - The second way is to repartition your tab manually through adb. This is the method I'll try to teach you here.



    Let's first be very clear :


    - This won't get your tab back in its former state
    - Your internal storage will shrink by a lot
    - All your data will be lost
    - No guarantee it works for you
    - You'll most likely have to do that every time you flash
    - Your tab might rebrick itself after some days, so you'll have to do this again, get used to it.
    - If you can get Samsung to repair your tab then go ahead
    - I'm not responsible for any further damage made to your tab
    - You need a computer for this tutorial


    Ok, you read the above carefully ? You are ok with it ? then let's begin
    !







    Using the Android Debugging Bridge (adb) to revive your tab






    Setting up your environment

    Prior to anything, you need to download and install the android sdk, I won't cover the installation here, it's explained on developer.android.com and there are plenty of guides on how to get adb and the sdk on xda.
    Make sure you install the platform-tools in the sdk manager.


    Ok now I assume you got the sdk installed, so let's move on to the serious things.





    1) How to open an adb shell ?

    First, you're going to need the latest ClockWorkMod Recovery (a.k.a CWM), download and instructions on locerra's thread here
    Then boot your tab in recovery (Maintain power+volume up buttons) and plug it into your computer via usb.
    Then do the following :

    a- On Windows

    Navigate to the directory where you installed the sdk, and open the folder called "platform-tools" (e.g : go to C:\android-sdk\platform-tools if your sdk is installed in C:\android-sdk)
    Press shift and do a right clic on an empty space in the folder, then select "open a command prompt here" (or something like that).



    b- On Linux

    Open a terminal window (ctrl+T)
    Let's assume you put the sdk in a folder called "android-sdk", located at the root of your home folder (~/android-sdk).
    Then you have to enter this in the terminal :
    Code:
    cd ~/android-sdk/platform-tools



    So now, all the rest of the commands you'll have to enter are the same on windows and linux, as the adb shell will actually be running in your tablet.







    2) Meet a new friend, he's called parted.


    First, we are going to use parted to take a look at our partitions and their file systems, and eventually replace the corrupt partitions with clean, freshly created ones.
    Then, you'll meet your other very good friend with a barbarian name : e2fsck (e2 stands for ext2, and fsck for file system check. Not that barbarian finally is it ?). He will check your filesystems and fix the possible errors they got.


    Ok now we've made the presentations, let's go !




    First make sure you read the following :

    In the code boxes of this tutorial, there are symbols at each line start, DO NOT COPY IT with the rest of the command ! :


    -the "$" represents your bash shell or command prompt

    -the "#" represents the adb shell

    -the"(parted)" represents the (parted) shell

    -Each end of line means "press Enter".

    -The partitions numbers are not the same on p6810 and p6800 (please report to this reference), so there will be two code boxes in the examples, one for p6810 and one for p6800, it's indicated in bold red but make sure you don't mix it up, that could screw your tab even more.


    Ok here we go !



    Issue the following in your terminal/command prompt :
    Code:
    $ adb shell
    # parted /dev/block/mmcblk0
    (parted) print


    The output should look like this :

    >>> P6810 <<<
    Code:
    Number  Start   End     Size    File system  Name       Flags
     1      4194kB  25.2MB  21.0MB  ext4         EFS
     2      25.2MB  26.5MB  1311kB               SBL1
     3      27.3MB  28.6MB  1311kB               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  264MB   209MB   ext4         CACHE
     8      264MB   1137MB  872MB   ext4         FACTORYFS
     9      1137MB  15.3GB  4163MB  ext2         DATAFS
    10      15.3GB  15.7GB  470MB   ext4         HIDDEN
    11      15.7GB  15.8GB  8389kB               FOTA

    >>> P6800 <<<
    The start/end values are wrong, please give me your p6800 output so I can update this.
    Code:
    Number  Start   End     Size    File system  Name       Flags
     1      4194kB  25.2MB  21.0MB  ext4         EFS
     2      25.2MB  26.5MB  1311kB               SBL1
     3      27.3MB  28.6MB  1311kB               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  264MB   209MB   ext4         CACHE
     8      3054MB  3926MB  872MB   ext4         MODEM/RADIO (not sure as I don't own this model)
     9      264MB   1137MB  872MB   ext4         FACTORYFS
    10      1137MB  15.3GB  4163MB  ext2         DATAFS
    11      15.7GB  15.8GB  8389kB               HIDDEN
    12      15.8GB  15.9GB  8389kB               FOTA




    The superbrick MMC_CAP_ERASE bug that affects our tab apparently only corrupts the /system and /data partitions (sometimes, /cache can also get corrupt in the process, I cover this in the last part of this guide, "extra cases").

    Your emmc chip on which resides those /data & /system partitions is corrupt at some places.
    To give you an example, think of it as a chain of dashes :
    Code:
    -----------------------------------------------------

    This dash chain is divided in two parts (our /system and /data partitions), I'll symbolize their length with "[]" for /system and "()" for /data :
    Code:
    [----------](-------------------------------------------)

    So that's how it was on your tab before brick, but now it's bricked some blocks (the dashes "-" here) are corrupt. I'll symbolize them with "?" :
    Code:
    [--??--???-](--???-?-----------????-----------??-?--??--)

    Now you figure the workaround don't you ? We need to move our /system & /data partitions to places that are clean, at the cost of reducing their sizes :
    Code:
    --??--???---???-?[-----------]????(-----------)??-?--??--
    We will strive to give /system its original size, or something close to it, while we can sacrifice more of the /data partition.




    Ok, enough theory, let's move on to practice.




    Here, in parted, /system = FACTORYFS and /data = DATAFS
    We are going to remove the /data partition first, so we have some space to work on.

    Enter the following :

    >>> P6810 <<<
    Code:
    (parted) rm 9

    >>> P6800 <<<
    Code:
    (parted) rm 10

    Now please refer to the output of (parted) print you had earlier, just scroll up a little in your terminal window. See those Start/End values ? Well check the end value of your DATAFS partition and remember it.

    Here's an example for P6810 :
    Code:
    9     *START -->*1137MB  15.3GB*<-- END*  4163MB  ext2         DATAFS




    So now comes the boring part. We are going to try to make a new clean /data partition.
    Seems easy but the problem is :

    - if you try to make it too big, it'll get stuck and return an I/O error.
    - if some blocks are corrupt between the start/end values you'll enter it will get stuck and return an I/O error.


    In both cases you'll have to reboot recovery and re-enter this in your terminal :
    Code:
    # adb shell
    # parted /dev/block/mmcblk0

    So this is long and boring to find the right place and the right size. Don't be greedy on the size, as long as you get at least 150-200mb it's cool, you'll be able to expand that later.
    First you're gonna try to put the original end value (15300 in the p6810 example up there) as the new end value. So for the same example, if you wanna try to make a 500mb /data partition, you're gonna use 14800 as start value and 15300 as end value.

    Ok let's go (this is still an example for p6810, for the p6800 owners, use your own (parted) print results) :
    Code:
    (parted) mkpartfs primary ext2 14800 15300

    It will output something like this :
    Code:
    writing per-group metadata : XX %




    Here there are two options :

    - You were lucky, it will complete up to 100% and return "(parted)", which case you just have to enter the following :

    >>> P6810 <<<
    Code:
    name 9 DATAFS

    >>> P6800 <<<
    Code:
    name 10 DATAFS

    - You were not lucky, it got stuck before reaching 100%, which case you have to reboot your recovery, re-enter parted and try again with a smaller start/end gap, or reducing the end value, you got about 14gb of space to try to make your partition, so it's sure you can find somewhere to put your small partition, just requires some blind testing.

    Just remember to try to put your /data partition quite close to the end (original end value), so you still have some space to find somewhere to put your /system partition.

    So now we'll assume you managed to have mkpartfs complete till 100%

    Type this to see your updated partition table :
    Code:
    (parted) print



    Now we're going to repeat last step with the /system partition.
    Issue this :

    >>> P6810 <<<
    Code:
    rm 8

    >>> P6800 <<<
    Code:
    rm 9

    The /system partition is much more important than /data, so you want to try to have its size remaining the same (872mb).
    At first, you can try to re-make the /system partition with the same start/end values. It's not likely to work but it's worth trying.

    Here's an example on P6810:
    (again, if you're on P6800, then use your own start/end values for the 9th partition (FACTORYFS), you get them by typing print in parted).
    Code:
    (parted) mkpartfs primary ext2 264 1137

    Same thing here, if it doesn't complete, then reboot recovery, type :
    Code:
    $ adb shell
    # parted/dev/block/mmcblk0

    And repeat this step until you find somewhere it works : (where YYY - XXX = 872)
    Code:
    (parted) mkpartfs primary ext2 XXX YYY

    Remember to limit your research between FACTORYFS original start value (264 for P6810) and the new DATAFS start value you made, so you keep the order of the partitions.

    Once you found the right place (where "writing per-group metadata" completes till 100%), type this :

    >>> P6810 <<<
    Code:
    name 8 FACTORYFS

    >>> P6800 <<<
    Code:
    name 9 FACTORYFS


    The hardest part is done, if you type this you should get a full table of partition, make sure no number is missing or disordered (1,2,3,4,etc...).
    Code:
    (parted) print






    3) Meet another good friend : e2fsck




    Now we've done our fresh and clean partitions, you must be thinking we're done, but we're not ^^
    In fact the two partitions we made are using ext2 filesystem, but the /system partition's filesystem should be ext4 (like it was at the beginning).

    There are two ways of converting an ext2 filesystem to ext4 that I know of :

    - Simply formatting /system in cwm recovery will convert the filesystem to ext4. To do this, just head to "mounts & storages" and select "format /system".
    If it gets stuck while formatting, reboot your recovery by pressing the power+volume-up buttons for about 15 seconds, and head to the next part, you have to do something before you can try to format it again.


    - Or issuing this in terminal :

    >>> P6810 <<<

    Code:
    # tune2fs –O dir_index,uninit_bg,has_journal /dev/block/mmcblk0p8

    >>> P6800 <<<
    Code:
    # tune2fs –O dir_index,uninit_bg,has_journal /dev/block/mmcblk0p9

    To make sure either of the two ways worked do this :
    Code:
    # parted /dev/block/mmcblk0
    (parted) print
    And look if FACTORYFS shows ext4.

    If it does, reboot recovery, then on to next part. If it doesn't, then still reboot recovery and head to next part, after which I'll redirect you here to try again.




    Now we are going to use e2fsck to check our new partitions for errors, but not only, it also fixes some erros and it will even for example create lost & found in /data
    So let's go, we'll begin with /system. If you're still in the (parted) shell, use ctrl+c and type "adb shell", then issue the following :

    >>> P6810 <<<
    Code:
    e2fsck -yfDC0 /dev/block/mmcblk0p8

    >>> P6800 <<<
    Code:
    e2fsck -yfDC0 /dev/block/mmcblk0p9

    This might take long, or not, this might get stuck, or not. Either way reboot recovery if it gets stuck or whatever, but do it again till it finishes properly.
    This is what my /system e2fsck final output looks like (p6810) :
    Code:
    /dev/block/mmcblk0p8: ***** FILE SYSTEM WAS MODIFIED *****
    /dev/block/mmcblk0p8: 2636/53312 files (1.2% non-contiguous), 101948/212890 blocks
    If you got 0.0% or like less than 5% in "(X.X% non-contiguous)" this is a good sign.




    Now reboot recovery and let's do the same for /data :

    >>> P6810 <<<
    Code:
    # e2fsck -yfDC0 /dev/block/mmcblk0p9

    >>> P6800 <<<
    Code:
    # e2fsck -yfDC0 /dev/block/mmcblk0p10

    Same thing here, if it gets stuck then reboot recovery and do it again.
    Here you should get 0.0% non contiguous. If you don't, in cwm do wipe data/factory reset, then reboot recovery and do this e2fsck again.



    Ok now you got both clean e2fsck, (if you still have an ext2 FACTORYFS then now is the time to go back to try converting ext2 to ext4 again)

    Make sure the e2fsck still are clean by doing this (it should be quick this time) :

    >>> P6810 <<<
    Code:
    # e2fsck -cy /dev/block/mmcblk0p8
    # e2fsck -cy /dev/block/mmcblk0p9

    >>> P6800 <<<
    Code:
    # e2fsck -cy /dev/block/mmcblk0p9
    # e2fsck -cy /dev/block/mmcblk0p10



    Now you should be nearly good to go ! :laugh:


    Download the cm9/cm10-based rom you want, make sure you check known issues and that you like this rom because everytime you'll want to flash a rom it's likely you'll have to do the whole e2fsck part again, or even sometimes the whole guide.

    Now reboot in recovery and flash the rom. Two options :

    - it flashes, then reboot, pray and be patient, if it takes more than 15 minutes to boot first time, then reboot it again, do this a few times if it doesn't boot, it might eventually do. If it doesn't, then reboot recovery and redo the e2fsck command for both /data and /system, let it fix things if it has to, then reboot again. Anyway it should have booted by now.

    - flashing gets stuck : make sure you waited at least 5 minutes then reboot recovery---> wipe data/factory reset---> wipe dalvik cache---> reboot recovery---> adb shell and redo the e2fsck on both /data and /system, then try flashing again.


    DO NOT FLASH THE GAPPS NOW, that will screw all you just done ! If you need the gapps then head to the following section of this guide.







    4) Installing the gapps




    If you flash the gapps after flashing the rom you'll be screwed, you'll have to redo the e2fsck part and maybe even the parted, and I know you don't want to.
    So the workaround is to add the gapps to the cm-based rom you downloaded.

    It's easy, just follow me :

    Open the zipped rom you downloaded with 7zip or WinRar (Windows), or with Archive Manager or else (Ubuntu). Do not extract it, we'll modify the zip directly.
    Do the same with the gapps, so you have both archive side to side.

    In the rom, you have boot.img, and two folders : "META-INF" and "system". We will modify things in "system" folder ONLY. Open "system" folder.
    In the gapps we will only use things from the "system" and "optional" folders.

    The rest is pretty easy to figure out. In the gapps's "system" and "optional" folders you have folders which have the same name as some folders in "system" of the rom.
    Just copy/replace everything that is in those folders of the gapps to the corresponding folders of the rom. Don't forget to do that with both "system" AND "optional" folders of the gapps.

    When it's done just close the freshly modified rom, copy it to your tab's external sdcard and flash it.

    If you don't have an external sdcard, then reboot recovery, copy the rom to the "platform-tools" folder of your android-sdk and rename it rom.zip.
    Then return to your terminal and do the following :
    Code:
    $ adb push rom.zip /sdcard
    It will now be in your internal sdcard (remember you shrinked it earlier so make sure the rom doesn't take all the space).





    5) Expanding your internal storage



    I don't recommend you do this the first time you follow this guide.
    It might screw your /data partition so you have to do the whole process I describe in this guide again.
    Anyway if you wanna try, this allowed me to earn a few extra gigs (never managed to get back more than 4gb and boot).

    Here's what to do :

    >>> P6810 <<<
    Code:
    $ adb shell
    # parted /dev/block/mmcblk0
    (parted) resize 9

    >>> P6800 <<<
    Code:
    $ adb shell
    # parted /dev/block/mmcblk0
    (parted) resize 10

    This will output something like :
    Code:
    Start ?
    End ?
    writing per-group metadata : XX %

    You can only move the end value in fact, trying to change the start value will return an error. Try doing this to earn like 250mb at a time so it doesn't get stuck. Good luck.





    6) Extra cases



    If when booting in recovery, the recovery says something like "can't read /cache/recovery/last-log, Read-Only file system" then your /cache partition is corrupt.
    Then you'll need to recreate it with parted. /cache is quite small (209mb) so it should be easy to have "writing per-group metadata" finishing.

    Here are the commands to remove and recreate /cache with parted (it's the same on both models) :
    Code:
    $ adb shell
    # parted /dev/block/mmcblk0
    (parted) print
    (parted) rm 7
    (parted) mkpartfs primary ext2 XX YY (where YY - XX = 209 and YY < FACTORYFS start value)
    2
    Parted not found

    okay, so for some reason, i can't seem to push files from adb to the device. from what i've read, i have to manually install parted to sbin, (or there's a flashable kit available also) but i can't figure out how to get it to pick up the file (its in the folder with ADB.exe, so i shouldn't need to reference the path for the copy location, right?)

    now i'm looking up general "ADB device navigation and testing"
    ---ugghhh....[/QUOTE]

    Hi!
    I had the same problem - parted not found. I resolved is this way - i install last CWM recovery v.6.0.1.1 via ODIN. That recovery includes parted.
    After that i could use it via ADB shell.
    2
    I have a question regarding the first part of this thread, the "How to avoid Superbrick"

    Having already stock ICS and CWM, is it save to flash one of the custom kernels then wipe data and dalvik and after that flash the stockrom again? All that done with Mobile Odin Pro?

    Hope that doing a clean ICS install will eliminate the launcher fc and shutdowns.
    If you have CWM, it's safe to wipe through it. If you're flashing through Mobile Odin, remember to set it not to flash the recovery (select "open file", select your .tar, then click on "recovery", and "clear". That way, it will flash everything on the ROM except for the recovery, and you keep CWM). You can select the kernel on Mobile Odin as well, so you install it all at once. After installing, go to CWM and wipe (or select "wipe data" from Mobile Odin, if you feel so inclined. Not sure on how Chainfire's kernel stands on MMC_CAP_ERASE, though).
    1
    okay, but i need adb to back up /efs i think.

    Good for you xda recognized developer lyriquidperfection made a tool to backup and restore your efs on samsung devices, head to this thread : http://xdaforums.com/showthread.php?t=1308546
    1
    even on stock honeycomb ?????
    am going to get a p6800 3g tomorrow, please don't scare me lol

    Yeah whether hc or ics, for some reason, samsung devs thought it was a good idea to include mmc_cap erase a.k.a superbrick bug in their kernels.
    Anyway I doubt you'd love to stay on y
    touchwiz hc, which the most laggy experience I ever had.