[Dev/Chefs] HD2 "Awareness" Post Regarding Bad Blocks Affects Android

AngelDeath

Senior Member
May 12, 2009
2,305
1,446
193
Cherry Hill, New Jersey
Greetings All,

Now before I start, or anyone else trolls through here: I know that this is probably the wrong place to a degree, but to another degree it is not, so please save the posts.

I decided to make this an 'Awareness' post, due to the fact that many people are starting to complain about problems with Roms they are flashing. I for one with my Roms thought people were doing something wrong, or there was another underlying problem, but couldn't understand, until it happened to me during the building of my last ROM.

As we know our HD2's are aging and definitely showing their age as new and bigger Roms get released, and as many people see new Dev's are coming up with new ways to create partitions to make it easier for noobs. But one of the things that I think everyone fell short seeing is the Bad Block issue that is resulting with many flashes, and as well with Bad flashes.

Now some may argue the point that the bad blocks do not effect how the ROM flashes and that it runs fine even with bad blocks. My firm belief is that this theory or statement is 25% correct, and 75% incorrect. The reason I feel its 75% incorrect is most of the Roms currently out, such as CM7, or 2.1 Roms, use less space then the larger 3.0 Roms, And even the vanilla GB Roms use less. So in theory I feel thats where the 25% of the statement is correct. But again, there is a problem then too.

According to my last testing of my ROM, I encountered this Bad Block syndrome, why I don't know, How I don't know, age I am guessing or too many times of flashing of Roms. My Bad Blocks occurred in the data partition at least based on the recovery log and the restore log on my phone, which then created the following symptoms:

HTC Sync - Hot reboot
Installing Apps from Market - Hot Reboot
Restoring apps from Titanium Back up - Hot reboot
USB Disk drive Mount - Hot Reboot.
Random Reboots for no reason.
Spontaneous Reboots during charging.

I feel that depending on the location of the bad block(s) will result in different issues/errors during flashing or day to day use. Many people who have been flashing my ROM have been complaining of a wide variety of issues that I never seen, until now. And now I am asking people for their recovery log to see if my suspicion is true, and it seems it is.

So I went to search of why this occurs or if there is a way to fix it, I seen the posts about task 29, tried it, and failed, it did not remove the bad blocks, tried the goldcard way to restore back to factory default, which would wipe the phone and the bad blocks would be gone, again failed, the bad blocks remained. The I saw about a program called MTTY 1.42, I tried that program, did the task 28, Task 32, task 29, Task 2a (suppose to correct bad blocks) and doing an info 8 results in the bad blocks remain and not corrected.

So after exhausting all possible ideas, I decided to try something, since I wanted to get my ROM out, I tested my other HD2 phone with a bad screen (I own 2 TMOUS HD2 phones), and the test came back with a completely clean phone, no bad blocks, tested my ROM, none of the issues that I had didn't exist on the test phone, which firmed my stance that the bad blocks are affecting Android OS's far more then windows mobile OS. You may ask why, my theory is that being that this phone was originally a WinMo phone, WinMo phones again are smaller, and also use the whole phone for flashing, there also might be (do not know this for sure) an error checking routine for bad blocks, maybe it doesn't, but I think having more room to flash makes it possible to avoid the location, or I could be completely wrong.

Here is what my Result was after a info 8 in mtty:

Cmd>info 8

--- 2K bytes sector version ---

DEVICE NAME=samsung_KBY00U00VM
DEVICE ID=0xB3
DEVICE MAKER ID=0xEC
PAGE SIZE=0x800
TOTAL PAGE SIZE=0x840
BLOCK COUNT=0x2000
BLOCK PAGE=0x40

Checking block information

BLOCK 0 (0x0) is reversed block
BLOCK 1 (0x1) is reversed block
BLOCK 2 (0x2) is reversed block
BLOCK 3 (0x3) is reversed block
BLOCK 8 (0x8) is reversed block
BLOCK 10 (0xA) is reversed block
BLOCK 11 (0xB) is reversed block
BLOCK 12 (0xC) is reversed block
BLOCK 13 (0xD) is reversed block
BLOCK 14 (0xE) is reversed block
BLOCK 15 (0xF) is reversed block
BLOCK 4691 (0x1253) is bad block
BLOCK 6714 (0x1A3A) is bad block
BLOCK 7045 (0x1B85) is bad block
BLOCK 7275 (0x1C6B) is bad block
BLOCK 7430 (0x1D06) is bad block
BLOCK 7509 (0x1D55) is bad block

Partition[0], type=0x20, start=0x2, total=0x63E
Partition[1], type=0x23, start=0x640, total=0xA40
Partition[2], type=0x25, start=0x1080, total=0x1D780
Partition[3], type=0x4, start=0x1E800, total=0x59380

CE Total Length(with sector info) = 0xF4F4000
CE CheckSum Length(without sector info) = 0xF400000

Again according to the recover.log this is located in the data part of the system.
And I am seeing many people having the same issue. Now being that I have a tmous, but obviously with limited room now with bad blocks, I decided to attempt installing a EU version of my ROM which uses SD-Ext, and App2SD in it on my bad phone, repartitioned my phone from 400mb to 220mb in the system, flashed it and all the issues I had disappeared completely.

Now having a Tmous phone and doing this makes it obviously easy to by pass this problem, and for how long its unknown, but the Eu Versions of the phone will not be so lucky, and again its showing, because in the EU phones having only 512mb of space they have no choice but to use their SDcards already, so if they start running into this situation, they really have no alternative way to install Android except to move completely over to the SD version of android.

So what am I looking for with making this post?

Making Aware:

To the Chefs that certain issues that arise not to dismiss that someone did something wrong, understand that the possibility of the bad blocks can cause issues as I stated, and it could end up getting progressively worse.

To the Dev's hoping that someone will take on the task of trying to either a) find a way to implement an error checking routine script that can be used in a ROM so that locations that come back bad, can be marked bad or remembered so that they are not written to and stop the misc. issues that can occur, b) re-write the magdlr or clk &/or CWR as to check for these errors and mark them bad, just as a Hard Drive would, c) Write a program that actually fixes the bad blocks since mtty cannot.

To the Users: Understand that the Roms created work differently on every phone, no two phones will respond the same hence no different then computers. But also that people should start making it a habit to pull their recovery logs after a flash and check them to make sure their phones are clean and everything went fine. Because by checking the log if you see Bad Blocks, or blocks that couldn't be erased, it would be safe to say that you should expect errors or possibly erratic behavior of your phone on a daily basis.

How to See if you have Bad Blocks:

Okay since people are asking, here is a short step by step for both EU and TMous:

1) Format your Boot, Data, Cache, System, Dalvik Cache (Eu users your Dalvik Cache is on your sdcard on the SD-EXT)
2) Flash your rom.
3) After flashing DO NOT REBOOT.
4) Go to Advanced, then Error Report.
5) This will copy the Recover.log to your SDCard.
6) Go Back and enter Mount & Storage.
7) Mount USB SD.
8) On your computer navigate your SD Drive.
9) Look for a folder called: clockworkmod.
10) Inside you will find a file called: recovery.log
11) Copy this to your Desktop.
12) Open with Wordpad or Notepad++

If you see in that whole log, Could not erase blah blah bad block, or anything that says bad block, with the exception of a location called "system/xbin/badblocks" (This location is normal hats a file name), then you have bad blocks, and the more you have, the smaller your cwr partition actually is.
 
Last edited:

AngelDeath

Senior Member
May 12, 2009
2,305
1,446
193
Cherry Hill, New Jersey
The first Thread states task 2a, which I have performed, and has done nothing, if it worked trust me I wouldnt have made this post. The second is in the General section, not much of an attention getter, and I am part of that thread as well, but I gave a bit more detail.

Unless I did something completely wrong and some others I have read ith the same result of it not working, I'd love to know how the task 2a did it after 3 attempts back to back.
 

ph03n!x

Senior Member
Dec 18, 2010
2,157
1,586
0
Thanks @AngelDeath!

But also that people should start making it a habit to pull their recovery logs after a flash and check them to make sure their phones are clean and everything went fine. Because by checking the log if you see Bad Blocks, or blocks that couldn't be erased, it would be safe to say that you should expect errors or possibly erratic behavior of your phone on a daily basis.
It would be helpful if the quoted part is elaborated, just so that people not in the know can know how do check the recovery logs.
 

pyrorob

Senior Member
Oct 19, 2006
1,091
175
93
39
Hickory, NC
my 2 cents, i had an hd2 for a whole year flashing winmo roms on it and not an issue, ive been runing android on my hd2 since January and ive had to send in my original and the replacement hd2 ive had into the htc service center. both started showing bad blocks, the second also froze and restarted when it got slightly warm. im on my third hd2 now, they ended up sending me a brand new one.. i hope this one lasts longer then the last 2...
from my understanding normally the device is supposed to mark off bad blocks so they dont get written to, so you dont get read errors and weird stuff doesnt happen, this doesnt appear to be happening..also try running a winmo rom and feeling how hot your hd2 gets.. from my experience it hardly gets hot at all, install android and you can feel the device cook, im thinking that the heat might be affecting the nand and various other chips leading to these issues.. and i believe this is due to something with how android is writing data to the nand (most apparent right at the initial setup after installing a android rom), its causing the chip to get wayyyy to hot and leading to these effects..
 
  • Like
Reactions: aalbrecht

AngelDeath

Senior Member
May 12, 2009
2,305
1,446
193
Cherry Hill, New Jersey
my 2 cents, i had an hd2 for a whole year flashing winmo roms on it and not an issue, ive been runing android on my hd2 since January and ive had to send in my original and the replacement hd2 ive had into the htc service center. both started showing bad blocks, the second also froze and restarted when it got slightly warm. im on my third hd2 now, they ended up sending me a brand new one.. i hope this one lasts longer then the last 2...
from my understanding normally the device is supposed to mark off bad blocks so they dont get written to, so you dont get read errors and weird stuff doesnt happen, this doesnt appear to be happening..also try running a winmo rom and feeling how hot your hd2 gets.. from my experience it hardly gets hot at all, install android and you can feel the device cook, im thinking that the heat might be affecting the nand and various other chips leading to these issues.. and i believe this is due to something with how android is writing data to the nand (most apparent right at the initial setup after installing a android rom), its causing the chip to get wayyyy to hot and leading to these effects..
You may very well be right in your way of thinking, but I think it also has to do with what rom your using as for it getting hot, and the reason why I say that is aside from say navigation apps most non-sense roms run cool for the most part, and sense roms run warm normally, unless your playing a graphic intense game, I would think it getting hot under normal use would be if its not over clocked then the battery frequency could be the cause, but you could very well be right and it could have something to do with it. In my case though my phone has never gotten hot at all except using a navigation app, which i think is normal but doesnt omit that it can happen then too.
 

AngelDeath

Senior Member
May 12, 2009
2,305
1,446
193
Cherry Hill, New Jersey
+1 to this, i would also like to know how to check this...
Okay since people are asking, here is a short step by step for both EU and TMous:

1) Format your Boot, Data, Cache, System, Dalvik Cache (Eu users your Dalvik Cache is on your sdcard on the SD-EXT)
2) Flash your rom.
3) After flashing DO NOT REBOOT.
4) Go to Advanced, then Error Report.
5) This will copy the Recover.log to your SDCard.
6) Go Back and enter Mount & Storage.
7) Mount USB SD.
8) On your computer navigate your SD Drive.
9) Look for a folder called: clockworkmod.
10) Inside you will find a file called: recovery.log
11) Copy this to your Desktop.
12) Open with Wordpad or Notepad++

If you see in that whole log, Could not erase blah blah bad block, or anything that says bad block, with the exception of a location called "system/xbin/badblocks" (This location is normal hats a file name), then you have bad blocks, and the more you have, the smaller your cwr partition actually is.

Also added this to post 1 incase it gets lost as this thread probably will get large.
 

mootmetal

Senior Member
Apr 9, 2011
370
39
0
casa
i agree with pyrocop about what he said ... and i can see the difference in my phone ...here's the situation :

with wm the phone wors as it should be i can reboot the phone and do what i want.
with android i cant reboot the phone ... if i reboot the phone stuck on android screen ( the one befor the boot animation) no matter what i do ...and the same thing if i shut down the phone and turn it on after a short time ( less than 2 mn) i always ned to wait between 2 and 3 mn after the phon is off ...

for me the probleme is not the rom itself ...i get this probleme even with clean install and only recovery installed :
with magldr it stuck on go go go screen
with clk i get some caracters and " suspend" in the end ....nedd to wait 2 mn ...

so maybe the recovery it self has something to do ...befor arrinving to the rom
 

Rick_1995

Inactive Recognized Developer
Sep 3, 2009
1,118
3,016
0
Santa Clara
This is a total myth that task 2a or task 29 fix bad sectors.
Bad sectors in hardware cannot be fixed unless the NAND itself is replaced on chip level which is impossible as manufacturers attach it to the main board using ball connection and with epoxy on top.

What does task 29 does then ? -> It clears out the partitions on your nand by writing 0x00 (which is 0 in binary) to them.

What does task 2a does then ? -> Well, even i was uninformed about this specific function of SPL, so studied it a bit and here are my conclusions.

Task2a cleans the nand COMPLETELY including the partition layout, try info 8 after and before task 2a (you must be having a stock WM before doing this, i did this using 3.14 stock). Well, it did clear the partitions including the splash which is totally white for me after this task.
Also, i had some interesting findings, after seeing that my splash was gone, i wrote a small ARM program to read NAND and display the data in terms of pixels on screen and wow, a pattern. Task 2a writes 0 and 1 alternatively instead of 0's or rubbish data as in task 29.

Here is the picture of my program running after task 2a:
 
Last edited:

05081983

Senior Member
Jun 2, 2008
87
9
0
Northridge
This would explain why my HD2 was freezing a lot whenever I used to install a new application, and this was not only happening in android but HD2 was freezing when I would install a new app in WM6.5 also. And then I would have to take out the battery and restart the phone again. Just for the information my HD2 was also getting very hot.
Hence I had to replace it with the other HD2 from Tmobile. Lets hope I dont face that problem again.
I would also like to know if we users can do anything to avoid this problem in future.
 
  • Like
Reactions: flcrs84

arkatis

Senior Member
Dec 24, 2008
1,071
415
0
Cyprus-Nicosia
Good posts and informative i must say!
Crying.............:(
So i will flash back to WinMo and will Never look for Android anymore! :eek: :confused: I don't want to fck up my phone!

Actually...if my phone fck$ up then i will trade with another Leo or Tmous from a friend of mine that sells/trades phones! So no worries about me! :rolleyes:

Also i read somewhere in Xda that task 2a MTTy commands can Brick your phone? CE, Radio, SPL, OS are deleted from phone..Is it true?
 
Last edited:

mootmetal

Senior Member
Apr 9, 2011
370
39
0
casa
Good posts and informative i must say!
Crying.............:(
So i will flash back to WinMo and will Never look for Android anymore! :eek: :confused: I don't want to fck up my phone!

Actually...if my phone fck$ up then i will trade with another Leo or Tmous from a friend of mine that sells/trades phones! So no worries about me! :rolleyes:

Also i read somewhere in Xda that task 2a MTTy commands can Brick your phone? CE, Radio, SPL, OS are deleted from phone..Is it true?
no ....and here's what get after running task 2a:

Cmd>task 2a
Format ALL start
backup SPL OK
backup MISC configuration OK
SPL start start block=497, total block of CE=3599
erase_page - error bad status: 0xB791E960
ERASE block 1618 FAIL !!!
Write 0xFF start page=0x7C40, total page=0x383C0
restore SPL OK
restore MISC configuratoin OK
restore MFG configuratoin OK
Format ALL end
 
  • Like
Reactions: arkatis

arkatis

Senior Member
Dec 24, 2008
1,071
415
0
Cyprus-Nicosia
Thanks for the info. As i can see the SPL can be backed up and you have an error block there which fails to delete it! Hmmm...
So the "doomsday" of HD2 will arrive in the nearest future?? I do not have this problem yet and i am flashing a new Rom every 1-2/3 days. Maybe i have bad sectors already but my phone is acting cool atm!
 

Rick_1995

Inactive Recognized Developer
Sep 3, 2009
1,118
3,016
0
Santa Clara
Good posts and informative i must say!
Crying.............:(
So i will flash back to WinMo and will Never look for Android anymore! :eek: :confused: I don't want to fck up my phone!

Actually...if my phone fck$ up then i will trade with another Leo or Tmous from a friend of mine that sells/trades phones! So no worries about me! :rolleyes:

Also i read somewhere in Xda that task 2a MTTy commands can Brick your phone? CE, Radio, SPL, OS are deleted from phone..Is it true?
As i mentioned in my post above, it formats EVERYTHING except SPL. so you can still enter the bootloader but the device will be void of Radio, Splash, OS and any other thing stored on NAND thereof.

It is suggested to flash an official ROM through sdcard after doing task2a to restore the splash, radio, Partition layout etc..
 
  • Like
Reactions: arkatis

Jimmersd

Senior Member
Jan 10, 2011
102
5
0
I suspect that there are 2 possible reasons for this: Hardware failure due to heat or over use (overflashing). ROMs and to greater extent Ram and SSDs do degrade over time and are subject to loss of data. This is inherit to the device. Modern memory devices have enabled a TRIM feature and are much better at housekeeping but it is still an issue.

Software failure due to incorrect or malicious programming. Could it possibly be an issue having to do with low level permissions on the sectors? I can't think of a better way to hide a virus and permanently infect a device than to rope off a section of ROM.
 

arkatis

Senior Member
Dec 24, 2008
1,071
415
0
Cyprus-Nicosia
Ok some Sense Roms can Heat my HD2 really easy. Some others more light Roms aren't. So you can go to a more lighter Rom such as the Rom i have in my signature which is the smallest e.t.c. For me this Rom doesn't Heat up my phone because it doesn't use all that Resources like Sense Roms e.t.c
MY OPINION!

Now for the NAND flashing....I think it make sense to have some bad sectors due to 1000 flashing times. It's like an SD card, if it has bad sectors then your phone/PC says that the sd card has a problem and need to be fixed (Bad sectors)
On the other hand; NAND acts like crazy so you have SODs, WSDOs, reboots whatever. This is due to the unlimited flashing we are doing to the NAND thus the Bad sectors.


It's like Flashing a Custom Tuning Program on your Cars chip.(NAND), Professional Tuners says that they can only flash it about 10 times because after 10 times your Chip will fried. That's why you Buy a custom Tuned Chip for some cars like Japanese!
MY EXPERIENCE AS A STREETRACER :D

That's my 10 cents.:cool:
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone