# Full Formatting HDD



## valsorym (Dec 11, 2011)

Hi all,
in the past I've worked with Windows Xp Os. There were two methods to format the "Fast" and "Full." 
The fast method - deconstructed only "inod" section. 
But full method - clear all HDD. First is verification (verification) of the surface storage, and only then will record the file system table. I know, this is High-level formatting process. 

Okay, I do not know why, but I have a problem with the file system. It is written here.
When I created the partitions HDD, I used the following method of formatting:

`# newfs -j /dev/gpt/f9root`
`# newfs -j /dev/gpt/f9var`
`# newfs -j /dev/gpt/f9tmp`
`...`
* I use GPT scheme, and /dev/gpt/f9root it is "/" slice, and ... okay, does not matter .

Formatting is very fast. So was created just a file table.

Now I want to repartition my HDD, but use the "Full" formating. My HDD is to find bad sectors and mark them. 
I can use the dd(1) utility to burn a disc with zeros. But she does not find bad sectors.

How to make a full formating HDD? What do you recommend?


----------



## valsorym (Dec 11, 2011)

Option 1. If bad sectors on my HDD is not - I can just burn it with zeros.
`dd if=/dev/zero /dev/ad0`

If the proposals are no more - perhaps I'll start. x(


----------



## wblock@ (Dec 11, 2011)

Writing zeros with dd(1) actually will find bad sectors, but the drive will remap them, possibly without a visible error.  Run `smartctl -a /dev/ada0` (from sysutils/smartmontools) before and after clearing the drive.

Or use smartctl instead of dd, it has a couple of surface test options.


----------



## valsorym (Dec 11, 2011)

wblock@ said:
			
		

> Writing zeros with dd(1) actually will find bad sectors, but the drive will remap them, possibly without a visible error.  Run smartctl -a /dev/ada0 (from sysutils/smartmontools) before and after clearing the drive.
> 
> Or use smartctl instead of dd, it has a couple of surface test options.



Thank you.

* But I have already started the dd(1). It looks like it's a long time.


----------



## wblock@ (Dec 11, 2011)

Be sure to use a buffer size of at least 64K with dd(1).  That will speed it up to as fast as the drive can go.  If you didn't give a buffer size option when starting it, stop it and start over.  The default buffer is 512 bytes, and that drive will still be testing days from now.


----------



## valsorym (Dec 11, 2011)

Oh, I just run
`dd if=/dev/zero of=/dev/ad0`

Thank you - I'll remember this.

P.S. Do not think that I did not read the handbook or man .UNIX is  new to me. And I have many questions (very many questions) that simply do not have time to remember everything.

My hard drive is 300 Gb. I wonder how much it will last? Maybe I can start all over again and use 64K buffer size?


----------



## wblock@ (Dec 11, 2011)

Stop that dd, it will take forever.  Run *smartctl -a* on the drive, save the results.  Then, use
`# dd if=/dev/zero of=/dev/ad0 bs=64k`

Larger buffer sizes will probably not make it go any faster.  I've found 1m buffers to be sometimes slower than 64k.

After it finishes, probably a couple of hours, run *smartctl -a* again and compare, particularly the reallocated sector count.


----------



## valsorym (Dec 11, 2011)

Yes, I'm already doing it. But since dd(1) has been launched smartctl -a does not yield any results.

```
smartctl -a -d sat /dev/ada0
...
ata0: error issuing ATA PACKET command
...
Device Model:           [No Information Found]
Serial Number:          [No Information Found]
Firmware Version:       [No Information Found]
...
```

If I just run 
`smartctl -a /dev/ada0`
I have result:

```
...
/dev/ada0: Unable to detect device type
Smartctl: please specify device type with the -d option
...
```

I read man

```
man smartctl
...
-d TYPE, --device=TYPE
...
sat - the device type is SCSI to ATA Translation (SAT) ...
...
```


I ran the dd(1) again.
`dd if=/dev/zero of=/dev/ada0 bs=64K`


----------



## wblock@ (Dec 11, 2011)

Is your drive ad0 or ada0?  Could also be that the BIOS is set to IDE mode.


----------



## valsorym (Dec 11, 2011)

wblock@ said:
			
		

> Is your drive ad0 or ada0?  Could also be that the BIOS is set to IDE mode.



My drive /dev/ada0! Oh, Yes you are right! Recently I installed Windows XP, and he did not see my HDD. I switched the this mode. You are right. Thank you!

Okey dd(1) is done!
It did not take so much time. About 1 hours. Now I checking that everything was zero.

```
# dd if=/dev/ada0 | hexdump -C
00000000   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |....................|
32833+0 records in
32333+0 records out
.....
```
All ok.

Now I check the BIOS and  run smartctl -a /dev/ada0


----------



## valsorym (Dec 11, 2011)

Oh, yes. In BIOS->Advanced->Sys. conf. ->SATA Mode choose be [IDE Mode], I rechoose in [ACHI Mode].

Okay. Now *smartctl -a -d sat /dev/ada0* it is worked!  Thanks! Very Big Thanks!

P.S. That's what it means to use Windows - forget even the BIOS looks like.

* Added after few of minutes.
That's interesting. Who created the device /dev/ad4? It's was not there before.


----------



## wblock@ (Dec 12, 2011)

It's the same hard drive, probably.  How drives show up depends on several things.  If the hardware supports it, load the AHCI module in /boot/loader.conf:

```
ahci_load="YES"
```

Then the drive will be ada0.  It also gives a little better performance.


----------



## valsorym (Dec 12, 2011)

Thanks! I understood you.

P.S. You saved my life again! I'll add you as a friend!


----------

