# Formatting vs zero-filling



## Dreieck (Feb 17, 2017)

Hello

I'd like to have a question to a hdd whizz. I can often read that zero-filling is good for slow and bad sectors (not physical bad sectors that can not be repaired). *I can't understand why zero-filling is better than just formatting when it comes to dealing with bad sectors. *

My chain of thoughts:
After formatting OS sees a disk/partition as free space, free to use. If there were some bad sectors before, logical problems, new data will be written to that space/disk/partition because that space is blank for OS. So why zero-filling would be better when it comes to dealing with bad sectors? Why is this better than just formatting?

Thx


----------



## FordGT90Concept (Feb 17, 2017)

Bad sectors are unusable so they can't be written to.  Whatever data is there is what remains when the sectors were marked bad.

I think you're actually talking about three things here:
-Quick Format: writes a new file system to the drive.  All data that isn't overwritten still exists but can't easily be accessed.
-Full Format: Writes a new file system to the drive and also attempts to access all sectors on the drive to verify they're good.  Data generally doesn't survive this process but could.
-Erase: ignores the file system and writes data to all sectors for the purpose of destroying existing data.  If the drive is to be used again, it needs to be formatted.

If you want to destroy data and mark bad sectors, do an erase then full format.

In relation to bad sectors, quick and full format "deal with" them the same.  The difference is in whether all bad sectors are found before the drive is put in service or if they are found while the drive is in service.


----------



## r9 (Feb 17, 2017)

Bad sector is just part of the disk that lost the magnetic properties to store data.
Every platter drive has spare dedicated space for relocating bad sectors.
Every time hdd S.M.A.R.T detects bad sector, marks the sector and relocates it to the spare.
As long there is free spare space this bad sectors not gonna be  an issue and they can't be detected with application.
Real bad sectors appear after the spare space is used up.
What apps like hdd regenerator do is re-check the marked sectors for the sectors that might be still used, that are still usable or were falsely marked.
Also they try multiple to wright 0/1 multiple times and check if it can store it.
What I've done in the past is if the bad sectors are on the beginning of the disk I would partition the disk in a way that I leave that space as unpartitioned.
I would not use that drive for storing important data.
My advice to you is once they start appearing its time to back up and move on.



Dreieck said:


> Hello
> 
> I'd like to have a question to a hdd whizz. I can often read that zero-filling is good for slow and bad sectors (not physical bad sectors that can not be repaired). *I can't understand why zero-filling is better than just formatting when it comes to dealing with bad sectors. *
> 
> ...


----------



## Dreieck (Feb 17, 2017)

Thanks for additional info. But what I am curious about is: 
*1.* Does it make sense to do zerofilling when there are bad sectors or slow sectors (>500ms) on disk? 



r9 said:


> Every time hdd S.M.A.R.T detects bad sector, marks the sector and relocates it to the spare.


OK; but it is possible that there are bad sectors not yet detected by SMART system.
*2.* What does software like _mhdd_ or _hdd regenerator_ do when they find a bad sector during scanning. What is the procedure?


----------



## FordGT90Concept (Feb 17, 2017)

1. Yes if the purpose is erasing it.  No otherwise.  Erasing software will find bad sectors in the process of erasing and notify the user.  The user can ignore those sectors or, the best solution, is to stop the erase and physically shred the drive.

2. They mark the file system (e.g. NTFS) to not use those sectors.


----------



## Dreieck (Feb 17, 2017)

Ad2. but scanning for bad sectors is also possible when there is no file system (parition not formated / no partition tabe etc.).


----------



## FordGT90Concept (Feb 17, 2017)

In which case, it is doing what @r9 said and marking the sectors bad in the device itself.


----------



## r9 (Feb 17, 2017)

Dreieck said:


> Thanks for additional info. But what I am curious about is:
> *1.* Does it make sense to do zerofilling when there are bad sectors or slow sectors (>500ms) on disk?
> 
> I don't think that will help.
> ...



I would assume there is error correction when reading data once it goes above set threshold it get marked as bad and relocated.

Apps like hdd regenerator do what smart does but trying to recover some of the sectors that are not as bad, and its not depended on the hdd have file system or not.
Apps like check disk mark the bad sectors in the partition table. So if you scan and "repair" and then format the drive the bad sectors will became available again.
To prolong the life 
1. scan and repair with hdd regenerator.
2. leave the affected area as unpartitioned space.


----------



## Dreieck (Feb 17, 2017)

r9 said:


> Apps like check disk mark the bad sectors in the partition table. So if you scan and "repair" and then format the drive the bad sectors will became available again.



Sorry for keeping asking, but formatting does not affect partition table. So if the information about bad sectors _chkdsk_ keeps in partition table formatting will not affect them (will not affect info on where bad sectors are). Right?


----------



## r9 (Feb 18, 2017)

Dreieck said:


> Sorry for keeping asking, but formatting does not affect partition table. So if the information about bad sectors _chkdsk_ keeps in partition table formatting will not affect them (will not affect info on where bad sectors are). Right?


Formatting re-wrights the partition table so the bad sectors will not be marked as bad.
So the data that gets saved on that space will get corrupt.


----------



## Static~Charge (Feb 18, 2017)

r9 said:


> Formatting re-wrights the partition table so the bad sectors will not be marked as bad.
> So the data that gets saved on that space will get corrupt.



Uh, no. If a bad sector has already been locked-out by the drive, then formatting the drive will not put that sector back into use. The drive will not let the file system access known bad sectors.

If a bad sector has not been locked out by the drive, then formatting the drive may not detect it. That would leave it in use and could result in corrupted data.

The idea behind zero-filling the sectors is two fold. First, it overwrites any data in the sectors. Second, if a sector is bad but not already locked out, then attempting to write zeros to it should bring the bad sector to the drive's attention, and it will be locked out then.


----------



## xorbe (Feb 18, 2017)

If the HDD knows about a bad sector, when it is written again, it is remapped.  Quick formatting doesn't write all the sectors.  The sectors are not "locked out", they are remapped, until the remap table is full, then the drive "fails".


----------



## r9 (Feb 18, 2017)

Static~Charge said:


> Uh, no. If a bad sector has already been locked-out by the drive, then formatting the drive will not put that sector back into use. The drive will not let the file system access known bad sectors.
> 
> If a bad sector has not been locked out by the drive, then formatting the drive may not detect it. That would leave it in use and could result in corrupted data.
> 
> The idea behind zero-filling the sectors is two fold. First, it overwrites any data in the sectors. Second, if a sector is bad but not already locked out, then attempting to write zeros to it should bring the bad sector to the drive's attention, and it will be locked out then.



I was referring to sectors that being mapped as bad by the apps like chkdsk not the drive it self.
I already said that drive mapped bad sectors can't be detected by diagnostic app.
You can read the SMART status but thats different.


----------



## r9 (Feb 18, 2017)

xorbe said:


> If the HDD knows about a bad sector, when it is written again, it is remapped.  Quick formatting doesn't write all the sectors.  The sectors are not "locked out", they are remapped, until the remap table is full, then the drive "fails".



I will quite myself on this one.


r9 said:


> Bad sector is just part of the disk that lost the magnetic properties to store data.
> Every time hdd S.M.A.R.T detects bad sector, marks the sector and relocates it to the spare.
> As long there is free spare space this bad sectors not gonna be  an issue and they can't be detected with application.
> Real bad sectors appear after the spare space is used up.


----------



## xorbe (Feb 20, 2017)

r9 said:


> I will quite myself on this one ... Every time hdd S.M.A.R.T detects bad sector, marks the sector and relocates it to the spare.



That relocation happens when the sector is written, afaik.


----------



## NviGate Systems (Feb 22, 2017)

The SATA specification only allows a sector to be re-mapped once the drive is told to write data to a sector. The reason for this is that if valuable information is held in that sector, there is still a chance ECC can recover the data.

There are utilities which read the data, then write it to a different sector, then force writing data to the bad sector, making the controller disable that bad spot.

If you have a drive that is slow with weak sectors (bad sectors that are pending re-map) then a full format (not quick format) will force the drive to remap those sectors because by writing to the drive, you in essence telling the drive: "I am writing to this area so I obviously no longer need whatever data is there", in which case the drive marks the area(s) as bad and never uses them again.

I've seen drives with pending sectors (anywhere from 6 to 32) after a full format to have thousands of pending sectors. So my best advice is to backup all data, do a full format of the disk then look at the SMART values again. If it remapped those sectors and no further sectors were found bad, then it likely was just an area that went bad. If suddenly more sectors start going pending, that tells you the drive is on it's way out.


----------

