Delete bad sectors. Bad sectors. What is it, what does it eat and how to get rid of them

1. A bit of history

Bad sectors (from the English. - Bad, unfit) are on any hard drives. No matter how carefully their disks were made, on each of them there are several places, the recording or reading of which is accompanied by errors. In addition, there are simply buggy surface areas that can eventually develop into defects, which is unacceptable for the user. Therefore, each drive after manufacturing at the factory undergoes rigorous testing, during which bad sectors are identified. They are marked as unusable and entered in a special table - defect list .

The very first screws had a defect sheet in the form of a paper sticker, into which the addresses of unstable sections were entered at the factory. These devices, which are a slightly modified copy of a conventional floppy drive, could work only under their physical parameters: the number of tracks, sectors and heads indicated in their passport exactly coincided with their real number. By purchasing such a device, the user read the sticker and entered the addresses of the killed sites in the FAT. Thereafter operating system  ceased to notice these defects, just like she does not notice the bad blocks on floppy disks, if they were removed by scandisk "ohm. Probably, in those days, the term" bad block "appeared: the block was called cluster - minimum unit of logical disk space. At the physical level, a cluster consists of several sectors, and if one sector is damaged, the OS declares the entire cluster unusable. No other methods for concealing defects existed at that time. And when there were ways to hide certain sectors, people did not come up with new concepts, and still continue to use the word “block” successfully.

It took quite a while before manufacturers thought of a very interesting thing: if the user still marks bad blocks as unnecessary, they reasoned, then why not mark them right at the factory? But how to do this if there is no file system on the screw and it is not known which one will be? That's when they came up with a tricky thing called "Translator": they began to write a special table on pancakes, in which it was noted which sectors should be hidden from the user and which should be left to him. The translator has become a kind of intermediate link connecting the physical system of “disk-heads” with the drive interface. It was assumed that when turned on, the screw will first read its internal tables, hiding the defect addresses marked in them, and only then will allow itself BIOS, OS and application programs. And so that the user does not accidentally overwrite the translator during operation, it was placed in a special area of \u200b\u200bthe disk that is inaccessible to conventional programs. Only the screw controller could access it. This event made a real revolution in the hard drive industry, and marked the emergence of a new generation of drives - with a service area. In order for all the screws of the same model, but with a different number of defects, to have the same capacity, spare tracks were left on each of them - a reserve specially provided for leveling the capacity of the same type of drives to the standard declared value. It began to be placed at the end of the disk, near its center, and it was also inaccessible to the user. When leaving the factory, such hard drives did not have more than one visible bad sector. If new defects appeared during operation, the user could make low-level formatting a universal utility from the BIOS of the motherboard and try to hide them. Sometimes, as on floppy disks, this succeeded. But if the "evil spirits" were physical, then this did not help: adding new defects to the table and rewriting the translator without special programs was impossible. Therefore, the bad blocks on many old screws (until 1995) had to be hidden in the same, outdated way - through FAT. Only Seagate, Maxtor and Western Digital have released utilities for hiding defects with replacing them from the reserve (they still lie on some ftp and are called sgatfmt4.exe, mformat2.exe and wddiag.exe, respectively).

Time passed and the screws changed even more. In an effort to increase the recording density, the developers began to use various non-standard tricks: they began to apply to the plates servo tagsdesigned to more accurately hit the heads on the tracks. The technology of zone-section recording (ZBR), the meaning of which was a different number of sectors on the external and internal tracks, appeared. The head drive has changed - instead of a stepper motor, a positioner in the form of a moving coil began to be used. And the heads and discs themselves have changed so much that each company has developed its own low-level format structure, sharpened only for their technology. This made it impossible to use universal low-level formatting utilities due to the fact that the translator of such screws learned to hide the physical format of drives, translating it into a virtual one. The number of cylinders, sectors, and heads written on the screw body ceased to correspond to its true values, and attempts to format such a screw with old utilities, as a rule, failed: its controller rejected the standard 50A ATA command, or simply simulated formatting, filling the screw with zeros. This has been specifically left for compatibility with older programs. For the same reason, the Low-Level Format procedure was excluded from the BIOS of modern motherboard. And in order to make such screws truly low-level formatting, it was necessary to bypass the translator, gaining direct access to physical tracks and heads. To do this, they began to use a technological utility that launches a special microcode recorded in the ROM of the drive. The call command for this microcode is unique to each screw model, and refers to   technology teams which are not disclosed by the company. Often such formatting could not be done through the standard IDE interface: many screw models of the 90s - Conner, Teac, etc., as well as all modern Seagate models, require a separate connector to be connected to the terminal via the COM port. As for technological utilities, they were never widely distributed and were not available to the ordinary user. For widespread use, dope programs were written that perform pseudo-formatting through the interface: filling the disk with zeros to clear it of information. This can be seen even from the names of these utilities, which can be found on the websites of hard manufacturers: wdclear, fjerase, zerofill, etc. Naturally, there are no technological teams in these programs, and therefore they can be applied to any hard drives. Such utilities are often useful in helping to get rid of certain types of BADs, which we will talk about a bit later.

Why did manufacturers act so cruelly, depriving us of the opportunity to do the correct low-level formatting, and hide defects ourselves? There is still no consensus on this question, but the official answer of most companies is something like this: “it is such a complicated and dangerous operation that you cannot allow an ordinary user to do it, otherwise many screws will simply be killed. Therefore, low-level formatting can only be done at the factory, or in a branded service center. ”

Let's try to figure out if this is really so. And at the same time, let's consider what real low-level formatting of modern hard drives is, can we do it ourselves, and most importantly - do we need it?

2. Preparing the hard drive at the factory

Before hiding bad "s in the factory, it is very important to identify everything, even very small defects, as well as unstable areas that can turn into bad" s over time. Indeed, if this happens during operation, the user may lose an important file, and the reputation of the company that released such an “unfinished" drive will be damaged. Therefore, testing hard drives before hiding defects takes a very long time, at least several hours, and is performed in technological mode. This is done to eliminate the time delays that inevitably occur during the operation of the translator, sending data through the cache and interface logic. Therefore, at the factory, the surface is scanned only by physical parameters. Usually this is not done by an external program, but by a special module in the ROM of the screw, which works without the participation of an interface. The end result of such testing is getting a defect list - an electronic list of unusable areas of disk space. It is entered into the service area of \u200b\u200bthe screw and stored there for the entire life of the drive.

Modern hard drives have two main defect lists: one is filled at the factory in the manufacture of the drive and is called P-list (primary), and the second is called G-list (from the word - growing), and replenished during operation of the screw, when new defects appear . In addition, some screws (in particular, Quantum Fireball of the ST and TM series) also have a servo-defect sheet (servo marks applied to winchester plates also sometimes have errors), and many modern models also contain a list of temporary (pending) defects. In it, the controller enters sectors that are “suspicious” from its point of view, for example, those that were not read the first time, or with errors.

After receiving the defect list, proceed to hide the defects. There are several ways to hide them, each of which has its own characteristics. Theoretically, you can simply reassign the addresses of the damaged sectors to the reserve and take them from there, but this will cause a screw performance loss, since each time it detects a sector marked as unusable, it will be forced to move the heads to a reserve area, which can be located far from the defect. If there will be a lot of reassigned sectors - the performance of the drive will drop very much, since most of the time it will be spent on useless jerking of the heads. Moreover, the speed of screws with a different number of defects will vary greatly, which of course is unacceptable in mass production. This method of hiding defects is called "Substitution method"  or remap(from English: remap - restructuring a sector map).

Due to the numerous drawbacks inherent in remap, this method is never used in the industrial production of screws, but they use a different algorithm: after identifying all the defects, the addresses of all serviceable sectors are rewritten again so that their numbers go in order. Bad sectors are simply ignored and are not involved in further work. The reserve area also remains continuous and part of it joins the end of the work area - to equalize the volume. This method of hiding badges is more difficult to implement than a remap, but the result is worth the effort expended on it - for any number of bad sectors, the drive does not slow down. This second main type of concealment of defects is called “Sector skipping method”. (There are other algorithms for factory concealment of defects, for example, by eliminating the whole track, or using the spare sector on each track, but they have drawbacks and therefore are practically not used in modern drives).

The process of address translation with the omission of defects is called "internal formatting". Internal - because the whole process takes place completely inside the screw, at physical addresses and without the participation of an interface. At this time, the screw is under control of the firmware integrated in its ROM, which analyzes the defect list and controls the formatting. External commands cannot interrupt it. Upon completion of formatting, the firmware automatically recounts the translator (or creates it again), and the screw becomes ready for use. After that, he, without a single bad block, arrives from the factory to the buyer.

3. New technologies

Now it’s clear why proprietary utilities do not perform any operations related to direct access to the service area. After all, hiding defects by formatting is an almost complete repair cycle, based on external parameters and associated with a clear understanding of each step. And enough to do something wrong to ditch the drive. We give a simple example: the user decided to make a “real” low-level formatting by starting the ROM subroutine in technological mode. The process usually lasts 10-60 minutes, but then there is a power failure or a banal hang - and the screw remains without a translator, because just does not have time to recreate it. This means that such a device will be unsuitable for further work - it will simply not be seen by either the OS or the BIOS. It’s even scary to imagine how many drives can be killed this way, out of simple curiosity or by mistake. Especially if these utilities fall into the hands of dummies, launching everything on their computers and pressing RESET instead. Of course, the disk does not deteriorate irrevocably, and by restarting the formatting you can bring it back to life. But the thinking of most users is designed in such a way that when faced with problems (a corpse not defined in the BIOS instead of a screw), many panic, blaming the manufacturers for everything. And they do not need extra hemorrhoids, of course - it is much more important to make the screw work out the warranty period. Therefore, several years ago, they began to lay the possibility of “repairing” bad sections on their own drives — doing a remap. As mentioned earlier, the remap did not find application in the factory preparation of drives, but it turned out to be a very successful solution for hiding defects in domestic conditions. The advantages of remapping over internal formatting are the lack of transferring the screw to technological mode, speed of operation and safety for the drive. In addition, in many cases, a remap can be done without demolition of the file system, and without the associated destruction of data. This technology is called automatic defect reassignment, and the process itself is reassign. Thus, remap and reassign are basically the same thing, although the term reassign is usually applied to a single sector, and remap to the entire disk.

The remap works as follows: if an error occurs while trying to access the sector, the “smart” controller understands that this sector is faulty and marks it on the fly as BAD. His address is immediately entered in the defects table (G-list). For many screws, this happens so quickly that the user does not even notice the detection of a defect and its concealment. During operation, the screw constantly compares the current sector addresses with the addresses from the table and does not access the defective sectors. Instead, it moves the heads to the backup area and reads the sector from there. Unfortunately, due to the time spent on long positioning, such sectors will look like small dips in the reading chart. The same thing will happen when recording. Therefore, Quantum engineers went even further and almost eliminated the main drawback of the remap, embodying their ideas in many models of the Fireball series: these drives have one spare sector on each track, the remap occurs in this sector, and there are practically no delays.

If an error occurs during normal operation of the OS, automatic remap is extremely rare. This is due to the fact that, on most hards, reassign only works when recording. And many operating systems check the sector for integrity before writing, and when it detects an error, it refuses to write to it. Therefore, in most cases, to perform a remap, the screw needs to be “asked” to do this - to force a low-level rewrite of the sector, bypassing the standard OS and BIOS functions. This is done by a program that can access the screw directly through the ports of the IDE controller. If an error occurs during such a recording, the controller will automatically replace this sector from the reserve, and the BAD will disappear.

The work of most utilities of the so-called "low-level formatting" from manufacturers is based on this principle. All of them, if desired, can be used for screws of other companies (if such programs refuse to work with other people's hard drives - this is done for marketing reasons. For example, Fujitsu suffers from such greed). And of course, remap functions are present in many universal and free programs, the features of which we will consider a little later. In the meantime, some more theory :)

The most common myth among users is the assertion that each screw needs its own, “special” program to hide defects, as well as the fact that remap is a low-level formatting. This is actually not the case. Remap is just a form of recording information using standard tools, and in most cases, any remap utilities can be applied to any screws. Remaps are not done by external programs, but by the screw controller. Only he decides to reassign defective sectors. “Alien” programs cannot spoil the drive either, since technological teams are not used in them, but in normal mode  the screw will never allow you to do anything with you except standard read-write operations. The only difference between proprietary utilities is the number of write / read / verification attempts for different screws. In order for the controller to "believe" that there is a BAD to be hidden in the sector, some hards need only one cycle, and others - several.

4. Again about S.M.A.R.T.

Almost all hard drives released after the 95th year have a system of operational monitoring of their condition - S.M.A.R.T. (Self Monitoring And Reporting Technology). This technology allows you to evaluate at any time such important parameters of the drive as the number of hours worked, the number of errors that occurred during reading / writing, and much more. The first hard drives equipped with this system (for example WD AC21200) had a very imperfect SMART of four to six attributes. But soon the SMART-II standard was developed, and from the moment it appeared in most drives, such a feature as internal diagnostics and self-monitoring appeared. This function is based on a series of stand-alone internal tests that can be run by standard ATA commands, and is intended for in-depth monitoring of the state of drive mechanics, disk surfaces, and many other parameters. After performing the tests, the drive without fail updates the readings in all SMART attributes in accordance with its current state. Testing time can vary from a few seconds (Quantum) to 54 minutes (Fujitsu MPG). You can activate SMART tests, for example, with the MHDD program (console command “smart test”). After starting the tests, “strange” phenomena are possible, very similar to those that occur during the operation of the defragmenter: continuous burning of the HDD indicator and the sound of intense movement of the heads. This is normal: a screw scans the surface for defects. You just need to wait a while until the self-test ends and the screw calms down.

More recently, the SMART-III specification has appeared, in which there is not only the function of detecting surface defects, but also the possibility of restoring them on the fly and many other innovations. One of its varieties is the Data Lifeguard system used in the new Western Digital drives. Its essence is as follows: if no calls are made to the screw, it starts scanning the surface on its own, revealing unstable sectors, and when it is detected, transfers data to the backup area. After which he makes a reassign. Thus, the data is saved even before a real BAD appears on this site. Unlike SMART monitoring, Data Lifeguard cannot be disabled by external commands and works continuously. Therefore, the "visible" BAD-blocks on modern Western Digital hard drives almost never appear.

To view the smart status of a hard drive, programs called smart monitors are used. One of them is part of the HddUtil complex for DOS and is called smartudm. You can download it here: www.sysinfolab.com/files/smartudm.zip. This program works with any hard drives and controllers. In addition, complete with this program is a detailed documentation with a description of all the attributes. There are SMART monitors for Windows 9x, for example, SiGuardian (http://www.siguardian.ru/) and SmartVision (www.acelab.ru/products/pc/utility.smart203.zip) are very popular, but they may not work on some systems. This is explained by the fact that the programs work with the screw directly, through the ports, and the bus mastering drivers of some chipsets prevent this. Windows XP owners should pay attention to the SmartWiew monitor www.upsystems.com.ua/ - the program works correctly in this system even on VIA chipsets.

There is some relationship between SMART attributes and surface state. Consider those that are directly related to bad blocks:

Reallocated sector count and Reallocated event count: number of reassigned sectors. These attributes show the number of sectors reassigned to the remap in the Grown defect list. For new screws, they must be equal to zero! If their value differs from zero, then this means that the screw was already in use, bads appeared on it, and a remap was made to it. And with Fujitsu screws, these attributes can spontaneously increase due to poor-quality power. Be careful when buying used!

Raw read error rate: number of read errors. Many hards (for example, Seagate and Fujitsu) are always above zero, but if the Value is within normal limits (green zone), there is nothing to fear. These are “soft” errors, successfully corrected by the drive electronics and not leading to data distortion. It is dangerous when this parameter drops sharply in a short time, turning into the yellow zone. This indicates serious problems in the drive, the possible appearance of bads in the near future, and that it is time to backup important data.

Current Pending Sector: this attribute reflects the contents of the “temporary” defect list present on all modern drives, i.e. current number of unstable sectors. The screw could not read these sectors the first time. The raw value field of this attribute shows the total number of sectors that the drive currently considers remap candidates. If in the future one of these sectors is read (or rewritten) successfully, then it will be excluded from the list of applicants. A constant value of this attribute above zero indicates a malfunction in the drive.

Uncorrectable Sector: shows the number of sectors in which errors could not be corrected with an ECC code. If its value is higher than zero, it means that it is time for the screw to remap: it is possible that during data recording the OS will run into this sector and as a result some important infa or system file  will be spoiled. However, for some screws, for example, for Fujitsu MPG, for some reason this attribute is not reset after the remap, therefore it is not necessary to trust its readings.

5. Types of defects and the reasons for their appearance

The time has come to figure it out, and why, in fact, there is such a nuisance as bads? In UPGRADE # 49 we reviewed only external causescontributing to their occurrence. And now it's time to look at the problem from a different perspective - from the side of the hard drive itself. To do this, consider the structure of the sector, as it is seen by the electronics of the screw "from the inside":

Fig. 1. Simplified structure hard sectors  drive.

As can be seen from Figure 1, everything is much more complicated than it might seem at first glance, even with the help of a disk editor. A sector consists of an identifier header and a data area. The beginning of the sector is marked with a special byte - an address marker (1). It serves to inform the controller that the sector is under the head. Then there are cells that contain a unique sector address in the CHS format (2) and its checksum to verify the integrity of the recorded address (3). 512 bytes of user data are placed in a separate field (4), to which several tens of bytes of redundant information are added when recording, designed to correct reading errors using the ECC code (5). Next to the data is placed 4 bytes of a cyclic data checksum (CRC), which serves to verify the integrity of user data, and messages to the error correction system when it is violated (6). For more reliable operation of the sector during rotation speed fluctuations, there are byte-spaces (7). Some winchesters have an additional byte after AM - in it the sector is marked as BAD.

As long as the format structure is not broken, the hard drive is working properly, clearly fulfilling its responsibilities - storing information. But it is worth interfering with evil forces - and depending on the type of destruction, they appear as BAD's of varying severity.

Defects can be divided into two large groups: physical and logical. Consider each of them in detail.

Physical defects

Surface defects. They occur during mechanical damage to the magnetic coating inside the sector space, for example, due to scratches caused by dust, aging pancakes or careless handling of the screw. Such a sector should be marked as unusable and excluded from circulation.

Servo errors. All modern drives use a system called a head (voice coil) to move the heads, which, unlike the stepper motor of old screws, does not have any movement discreteness. For accurate hit heads on the tracks in the screws, a feedback system is used, which are guided by special magnetic servos applied to the disk. Servo tags are available on each side of each drive. They are located evenly along all tracks, and strictly radially, like spokes in a wheel, forming a servo format. It does not belong to the lower level format and is not shown in the figure, but it is present in absolutely all modern hard drives, and plays a crucial role. According to servo marks, the engine rotational speed is stabilized and the head is held on a given track, regardless of external influences and thermal deformation of the elements.

However, during operation of the screw, some servo tags may be destroyed. If there are too many dead servo tags, at this point failures will occur when accessing the information track: the head, instead of occupying the position it needs and reading the data, will begin to shy from side to side. It will look like a bold and especially arrogant BAD, or even like a group of BAD's. Their presence is often accompanied by a clatter of heads, freezing of the drive and the inability to fix it with ordinary utilities. The elimination of such defects is possible only with special programs, by turning off defective tracks, and sometimes the entire disk surface. For these purposes, in some drives there is a servo-defect sheet that stores information about bad servo-tags. Unlike the P- and G-list, the servo-defect list is used not by the translator, but by the entire firmware The screw sectors are blocked even by physical parameters, which helps to avoid knocks and breakdowns when accessing them. The screw cannot restore the servo format on its own, it is done only at the factory.

Hardware Bad's. Occur due to malfunction of the mechanics or electronics of the drive. Such problems include: breakage of heads, displacement of disks or a bent shaft as a result of an impact, dusting of a pressure zone, as well as various glitches in the operation of electronics. Errors of this type are usually catastrophic and cannot be corrected programmatically.

Logical defects

These errors arise not because of surface damage, but because of violations of the logic of the sector. They can be divided into correctable and incorrigible. Logical defects have the same external manifestations as physical ones, and they can be distinguished only indirectly, according to the results of various tests.

Recoverablelogical defects (soft bads): appear if the sector checksum does not match the checksum of the data written to it. For example, due to interference or power failure during recording, when the screw has already written data to the sector, but did not manage to record the checksum (Fig. 1). A subsequent reading of such an “unfinished” sector will fail: the screw will first read the data field, then calculate its checksum and compare it with the recorded one. If they do not match, the drive controller will decide that an error has occurred and will make several attempts to re-read the sector. If this does not help (and it does not help, since the checksum is obviously wrong), then he will use the code redundancy to try to correct the error, and if this does not work out, the screw will give an error to the external device. On the part of the operating system, it will look like a BAD. Some screws had an increased tendency to form soft bads due to errors in the firmware — under certain conditions, checksums were not calculated correctly; in others, this was due to defects in the mechanics. For example, at IBM DTLA, the contact between the board and the Hermoblock was periodically broken, which led to the loss of power to the Hermoblock at the most inopportune time, including during recording.

The operating system or BIOS cannot fix a logical defect on their own, because before they write to the sector, they check it for integrity, run into an error and refuse to write. At the same time, the screw controller cannot correct this error either: it tries in vain to read this sector from the second, from the third attempt, and when this does not work out, it does its best to help itself, adjusting the reading channel and servo system on the go. At the same time, the very heartbreaking rattle is heard, so familiar to the owners of the poor "woodpeckers". This creak is not produced by “heads on the surface”, as many people are accustomed to think of, but just a positioner coil, due to the specific shape of the current flowing through it, and it is absolutely safe. The address of the unread sector falls into the temporary defect list, changing the value of the Current Pending Sector attribute in SMART, and is stored in it. Remap when reading does not occur.

And only forced low-level rewriting of this sector special program  Bypassing the BIOS automatically recalculates and overwrites the checksum, i.e. the bad disappears without a trace. You can rewrite it with a disk editor that can work with the screw directly through the ports, but they usually “rewrite” the entire disk, filling its sectors with zeros. Utilities that do this are freely distributed by hard manufacturers, and are often incorrectly called "low-level formatting programs." In fact, these are simple “nullifiers”, which does not stop them from getting rid of bad screws at all: with a successful recording, the soft bad disappears, and with a bad record, the bad is considered physical, and auto-repair occurs.

Fatal logical errors. These are errors of the internal format of the hard drive, leading to the same effect as surface defects. They occur during the destruction of sector headers, for example, due to the action of a strong magnetic field on the screw. But unlike physical defects, they can be corrected programmatically. And they are called incorrigible only because for their correction it is necessary to do the “correct” low-level formatting, which ordinary users  difficult due to the lack of specialized utilities. Therefore, in everyday life such a sector is disabled in the same way as the physical one - with the help of a remap. Now all large quantity  screws are produced using ID-less technology (sectors without headers), so soon this type of error will become irrelevant.

Adaptive Badges. Despite the fact that the screws are very accurate devices, their mass production inevitably leads to a scatter in the parameters of mechanics, radio components, magnetic coatings and heads. This did not bother the old drives, but for modern screws with their enormous recording density, even the smallest deviations in the dimensions of parts or in the amplitudes of the signals can lead to deterioration of the product’s properties, the appearance of errors, up to a complete loss of its performance. Therefore, all modern screws in the manufacture are individually tuned, during which such parameters of electrical signals are selected that make the device work better. This setting is performed by the ROM program during technological scanning of the surface. In this case, so-called adaptives are generated - variables that contain information about the features of a particular pressurized unit. Adaptives are stored on pancakes in the service area, and sometimes in Flash-memory on the controller board.

If during the operation of the screw the adaptives are destroyed (this can happen as a result of errors in the screw itself, static electricity or due to poor-quality power supply), the consequences can be unpredictable: from a banal heap of bads to the complete inoperability of the device, with a refusal to go on readiness for to the interface. “Adaptive” bads differ from ordinary ones in that they are “floating”: today they are, and tomorrow they can disappear and appear in a completely different place. Remapping such a screw is useless - ghost defects will appear again and again. And while the disk surface can be in perfect condition! Adaptive badges are treated with the selfscan run, an internal testing program similar to that used at the factory for the manufacture of screws. In this case, new adaptations are created and the screw returns to its normal state. This is done in the conditions of branded service centers.

Emerging defects

These are areas of the surface on which a pronounced defect has not yet formed, but problems with read speed are already noticeable. This is due to the fact that the sector is not read by the controller the first time, and the screw is forced to make several turns of the disk, trying to read it without errors. If you still succeed in reading the data, then the screw will not tell the operating system anything, and the error will go unnoticed until a real BAD block appears in this place. As a rule, it immediately becomes clear that it was at this point that a very important file was stored, in a single copy, and it was no longer possible to save it. Therefore, disks need to be tested periodically. This can be done with Scandisk or Norton Disk Doctor in surface testing mode, but better - special utilityworking independently of the file system and able to detect emerging BAD's by measuring the reading time of each sector.

The practice of working with sectors is described.

We launch our program and see the following window:

Select the "start process under windows" item in the "regeneration" menu. To start scanning bad sectors or bad blocks, we first need to "explain" to the program exactly what we want to do.

In the next window, we need to select the hard drive to scan. In our case, he is alone, select it and click on the inscription "start process".


We continue. In the next window we will be asked to indicate the option of scanning the disk. I advise you to immediately choose the first option "scan and repair" (scan and restore). Just enter the number “1” from the keyboard, as shown in the screenshot.




And in the last window, before scanning the bad sectors themselves, we are “asked” from which sector to start scanning? I advise you to leave the number "0". This will ensure full disk scanning.




Press the "Enter" key and run a scan on bad blocks. We will look at the whole process using an example of a disk that contains bad sectors. Pay attention to the screenshot below, on it we see the progress of scanning (white bar) and on it are the three bad sectors found by the program.




We will analyze this screenshot in more detail: at the top right, we see the elapsed time since the start of the scan of bad blocks and the time remaining until the process was completed. If bad sectors are detected on the disk, the program marks them with the English letter “B” and immediately tries to “cure” it. If she succeeds, then in place of the letter "B" appears the letter "R", which indicates the successful "restoration" of the bad block. In the lower left corner we see statistics on the scanned megabytes, as well as the number of found “B” and “cured” “R” bad sectors.

Upon completion of the scan, we will see this window:




Here, three bad sectors found by the program are indicated, and on the right are statistics already familiar to us, which says that all bad blocks found are eliminated.

Also take into account the fact that if bad sectors are detected, it is highly desirable (immediately or after a few days) to start the verification procedure again. The fact is that (with a serious disk defect) bad blocks can reappear and their number can only increase.




The following inscriptions on the screenshot above “tell” us exactly this: “4 new bad sectors appear” and “18 bad sectors appear” - these are bad areas that appeared on the hard disk and were detected during repeated scans. Such a disk can still be used quite successfully for some time as an additional one, and various (not very necessary) information and temporary files can be stored on it. But here's how reliable carrier  information or - system disk  it does not suit us definitely!

Actually, I described you the whole simple testing process :) We analyzed the very logic of what happens “behind the scenes” of the work of any program to restore bad sectors in the previous article, which is called "".

In addition to the above, I would like to mention another very useful function of the program “ HDD Regenerator". She can record her boot image  to the cd.

Why is this needed? Imagine a situation: you have problems with hard drive  (God forbid! :)) and because of this, the operating system simply does not load. How do we run our program so that it scans bad sectors of the hard drive? In this case, the function of creating a bootable version of the program comes to our aid.

Let's look at this opportunity. At the very beginning, after starting the program, in the "regeneration" menu, select "create bootable CD / DVD" (create a bootable CD or DVD disc).

In the next window, select our recording device installed in the system.




Press the “OK” button, insert blank disk  into the device and go to the last window immediately before burning the disc. Here we are offered to choose a recording speed. Select and click the "Burn CD" button (burn a CD).




After the recording we take ours (now boot disk) with the “HDD Regrenerator” program, insert it into the computer on which we want to check for bad sectors. We set the boot from the CD on it and see the menu in which the program shows us what it found hard disks  a computer.




As you can see, we have two of them. Select (for example) the second (enter the number "2" from the keyboard) and press "enter". Next we see the following window.




It has several options for scanning the hard drive for bad sectors:

  1. Scan, but do not fix found bad blocks
  2. Scan to correct these sectors
  3. View information about the program itself

Enter the number "2" from the keyboard (select the second option). We see such a window.




Here we indicate that we will scan immediately with the recovery of bad sectors. We press the number "1", then - "enter" and then the familiar testing process will start.

Also keep in mind the following point: poor quality power supply (failures caused) or the use of various adapters may be the reason that the recovery program will signal the detection of a large number of bad sectors.

There have been such cases in my practice. Hard sATA drive  was connected via the molex to sata adapter:




The diagnostic program found a lot of bad blocks on it, but as soon as we installed the corresponding one (which had Sata power connectors), the problem disappeared. So remember that all adapters are forced evil, and if you can do without them, get rid of them immediately!

That is all I wanted to tell you today about how to search and fix bad sectors on the disk. At the end of the article, as agreed, I give a link to the program itself "". Download, use.

In previous articles, we have repeatedly mentioned such a phenomenon as a failed (bad or bad) block, but so far we have not given an exact definition of what it is, what are the causes of their occurrence, how to deal with them and whether it is necessary. In this article, we will consider the first two questions and give you some time for your own thoughts and searches for solutions. Next time, we’ll talk about methods of dealing with them.

So, a bad block is usually understood as a specific part of the disk, normal operation with which is not guaranteed or impossible at all. These areas may contain various information, it can be user data or service information (otherwise called servo (obviously from Lat. servire or English serve - to serve), in this case it is fraught with consequences, the severity of which varies over a very wide range), although, of course, the best option there would be a lack of anything in this area (although it would probably not be necessary to encounter bads in such areas). The appearance of such sectors may be due to various reasons, in one case such sectors can be restored, in the other it is impossible, in one it is necessary to use some methods of treatment and reassignment to others. But first, dispel some fairly common myths.

Myth one: there are no bads on modern hard drives. This is not true, they happen. By and large, the technology is the same as years ago, only improved and finalized, but still not ideal (however, the ideal is unlikely to be created on the basis of magnetic recording technologies).

The second myth: for hard drives equipped with SMART this is not relevant (read there can not be bads). Not so either: relevant, no less than for hard drives without SMART (if any remain). The concept of a failed sector is close and familiar to her, this should have become clear from the relevant publications on this technology (links at the end). The fact is that most of the worries about such sectors previously assigned to the user, SMART took over. And it can often happen that the user does not know anything at all and does not know about the bads taking place on his screw, unless of course the situation is pathological. I heard from users that sometimes sellers justify their refusal to guarantee the exchange of hard drives, in which the bads "floated" out. The seller, of course, is wrong. SMART is not omnipotent, and no one has canceled bads yet.

In order to understand the bads and their varieties, let's delve into the method of storing information on the hard drive, just a little bit. We will clarify two points.

1. The unit of which the hard drive operates at a low level is the sector. In the physical space on the disk corresponding to the sector, not only data is written directly, but also service information - identification fields and checksum for it, data and checksum for them, error recovery code, etc. (not standardized and depends on the manufacturer and models). By the presence of identification fields, two types of records are distinguished - with and without identifier fields. The first is old and lost his position in favor of the latter. Later it will become clear why I celebrate this. It is also important that there are means to control errors (which, as we will see, can become their sources).

2. When working with old hard drives, it was necessary to register their physical parameters in the BIOS, which were indicated on the etiquette, and in order to unambiguously address the data block, it was necessary to indicate the cylinder number, sector number on the track, and head number. Such work with the disk was completely dependent on its physical parameters. It was not convenient, and tied the hands of developers in many matters. It needed a way out and it was found in address translation. The one that interests us - it was decided to address the data in the drive with one parameter, and assign the function of determining the actual physical address corresponding to this parameter to the hard disk controller. This afforded the endangered freedom and compatibility.

The actual physical data of the drive was already not important. It is only important that the number of logical blocks indicated by the BIOS does not exceed the actual one. The creation of such a translator is of great importance for the problems of bad sectors, too. And that's why. Handling Bad Sectors of Old hard drives  was not perfect, was carried out by means of the file system. The disk came with a sticker on which the addresses of defective blocks found by the manufacturer were indicated. The user manually entered this data into the FAT, and thus excluded the access to the operating system.

The plate manufacturing technology was imperfect then, and imperfect now. There are no methods to create an ideal surface that does not contain a single bad block, contrary to the common opinion that a hard drive is delivered from the factory without them. With the increase in the volume of disks, the number of bad sectors when leaving the factory increased, and it is clear that only until a certain moment the procedure for registering them in FAT could be performed manually, it was necessary to find a way to mark bads, even though it is not known which file system  will be used. The invention of the translator allowed to solve these problems. A special protected area was allocated on the hard drive, where the translator was recorded, in which the correspondence of each logical block of the continuous chain and the real physical address was established.

If you suddenly found on the surface bad block, then it was simply skipped, and the address of the next physical available block was assigned to this logical block. The translator was read from the disk when it was turned on. Its creation was carried out (and is being carried out) at the factory, and precisely because of this, and not from the fact that the manufacturer uses some kind of super technology, the new disks do not seem to contain bad blocks. The physical parameters turned out to be hidden (and they were too diverse, because the companies had their hands untied in the production of their own low-level formats, and the user did not care), defects were flagged at the factory, and universality increased. Good as in a fairy tale.

Now back to the bads and their varieties. Depending on the nature of the origin, all of them can be divided into two large groups: logical and physical.

Physical and logical defects

Surface defects can be associated with the gradual deterioration of the magnetic coating of the disks, the smallest dust particles leaked through the filter, the kinetic energy of which, dispersed inside the drive to tremendous speeds, is sufficient to damage the surface of the disks (however, most likely they will slide off the disk under the action of centrifugal forces and will be delayed by the internal filter, but they can catch it), the result of mechanical damage upon impact, in which small ones can break out of the surface e particles, which then in turn will also knock out other particles, and the process will go like an avalanche (such particles will also roll off the plates under the action of centrifugal forces, but much longer and harder, as they will be held by the forces of magnetic attraction. that a collision of a head hovering at a very low altitude will occur with them, which will cause its heating and performance degradation - signal distortions will occur, the result is reading errors), I heard (I have such statistics em) that smoking at the computer can do the same, since tobacco resins can penetrate the air filter of the hard drive (which have it), causing the heads to stick to the plates (damage to the surface and heads), simply settling on the surface, and thereby changing performance, etc.

Such sectors are unusable and should be excluded from circulation. Their restoration is not possible either at home or in the conditions of service centers. It would be good if they could at least recover information. The speed of the process of this type of surface destruction is individual. If the number of bads does not grow or grows very slightly, then you can seriously not be afraid (although backup  still worth it) if the growth is fast, then the disk will have to be replaced, and, moreover, be in a hurry. With this type of bad, you can reassign blocks to a reserve surface: it makes sense in the absence of progression. But this is not right now. This is if we talk about the data area. As already noted, official information is also stored on the plates. In use, it can also be destroyed. This can be much more painful than a normal user surface.

The fact is that servo information is actively used in the process of work: according to servo marks, the speed of rotation of the disks is stabilized, the head is kept above a given cylinder regardless of external influences. Minor destruction of servo information can go unnoticed. Serious damage to the servo format can render some part of the disk or the entire disk inaccessible. Since the drive program uses servoinformation and it is critical for ensuring normal functioning and, in general, due to its specificity, things are much more complicated with it. Some hard drives allow you to disable failed servo tracks. Restoring them is only possible at the factory using special expensive and complex equipment (we will estimate approximately the costs of such repairs of a non-warranty hard drive and understand that it would be right to call this kind of bads incorrigible).

Physical bads can also include bad sectors, the appearance of which is due to malfunctions of the electronic or mechanical part of the drive, for example, breakage of heads, serious mechanical damage as a result of an impact - jamming of the positioner coil or disks, displacement of disks. The actions here can be different and depend on the specific situation, if, for example, a breakage of the head (such bads appear because an attempt is made to access a surface that cannot be accessed (which does not mean that something is wrong with surface)), then, for example, it can often be turned off (or you can change it in the conditions of specialized service centers, only the cost of the operation makes you seriously think about its advisability (in most cases the answer is no), unless of course we are not talking about bhodimosti restore very valuable information (but that's another story)).

In general, this type of damage is catastrophic. Those. As you can see, physical problems are not treated, only some “softening” of their presence is possible. With logical bad sectors  The situation is simpler. Some of them are treatable. In most cases, due to write errors. The following categories can be distinguished:

1. The simplest case: file system errors. The sector is marked in the FAT as bad, but in fact it is not. Previously, some viruses used this technique when they needed to find a secluded place not accessible by simple means on a small volume of the hard drive. Now this technique is not relevant, since it is not difficult to hide a couple of megabytes (or even a couple of tens of megabytes) in the bowels of Windows. In addition, so someone could just make a joke on an unlucky user (such programs came across). And in general, the file system is a fragile thing, it is treated very easily and absolutely without consequences.

2. Incorrigible logical bads - typical for old hard drives using a record with identifier fields. If you have such a disk, then you may well encounter them. Due to the incorrect format of the physical address recorded for this sector, a checksum error for it, etc. Accordingly, it is impossible to appeal to him. In fact, they are recoverable, but at the factory. Since I already said that recording technology without identifier fields is now used, this variety can be considered irrelevant.

3. Correctable logical bads. Not so rare, especially on some types of drives, the type of bad blocks. The origin is mainly due to disk write errors. It is not possible to read from such a sector, since the ECC code usually does not correspond to the data in it, and recording is usually impossible, since a preliminary verification of the space to be written is carried out before recording, and since problems have already been detected with it, writing to this area is rejected. Those. it turns out the block cannot be used, although physically the surface occupied by it in perfect order. Defects of this kind can sometimes be caused by errors in the firmware of the hard drive, can be triggered software  or technical reasons (for example, a power outage and its fluctuation, leaving the head to an unacceptable height during recording, etc.). But if you manage to match the contents of the sector and its ECC code, then such blocks pass without a trace. Moreover, this procedure is not complicated, and the means for its implementation are widely available, and, in general, harmless.

4. The appearance of bad blocks of this type on hard drives is due to the peculiarities of the production technology: two absolutely identical devices never exist, some of their parameters will certainly differ. When preparing hard drives at the factory, a set of parameters is determined for each one that ensures the best functioning of this particular instance, the so-called adaptives. These parameters are saved, and if they are somehow mysteriously damaged, the result may be a complete disk inoperability, its unstable operation, or a large number of  bad sectors appearing and disappearing in one place or another. At home, nothing can be done about it, but everything can be set up at the factory or at a service center.

As you can see, only two types of logical bad blocks are really treated at home. If necessary, others can be replaced with backup ones, but not cured. Nothing can be done with the third at home. We will talk about how and what to do in the first two cases next time.

To be continued

HDAT2 is a service utility that allows you to identify and "cure" bad sectors hard drive  (they are badsectors). "Cure" - means to "replace" bad sectors with healthy ones from the backup area of \u200b\u200bthe hard drive.

hdat2: instruction

Press Enter.

Type in line hdat2and press Enter:


Bad Sector Test

Use the up and down arrows on the keyboard to select the drive that you are going to check for bad sectors (Bad sectors, among the “bads”) and press Enter:


Select Device test menu and press Enter: (this is you entering the device test menu)


If you want the program to find and try to “cure” (replace) the BAD sectors, select Detect and fix... (Suitable if the warranty on hDD  expired)

If you want the program to simply inform you about the presence or absence of BAD sectors, but not correct them, then select Detect bad sectors menu.

Important!   You will really need this option if you want to make sure there are "bads" and not heal them to submit a complaint to the seller. You need to leave the “bads” as they are, so that this serves as your argument when demanding a replacement hard drive.



If you have chosen to “treat” bad sectors, you will see the following menu. It is recommended to select the first item in it.



After pressing the Enter key, a disk test will start. It can last several hours, depending on its capacity and the method of "treatment" of "bad".

I will say this: in half the cases, bad sectors appear in the amount of 1-3 pieces and after “healing” with the HDAT2 program they do not make themselves felt. You continue to use the hard drive and everything is fine.
  If after healing the "bad" regularly and systematically new ones appear, this means that the disk is "crumbling". In this case, I recommend buying a replacement for him as soon as possible, otherwise sooner or later you will lose all the information.

Attention! If you run the program through " Detect Bad Sectors menu", And  the program found the BAD sectors, and you decided to cure them, you have to restart the program again through " Detect and fix bad sectors menu» > « Fix with Verify / Write / Verify»

Hard drive scan time

640 GB hard drive checked in approximately 1 hour 50 minutes

It takes about 6 hours to check a 2 TB hard drive