/!\ Look for Update 2 down there, the question is half-answered now /!\
I sometimes completely wipe my hard drives (not SSDs); being what they are, dd
and badblocks -w
do wipe everything blindly.
The thing is, they are also writing hard drives' spare sectors, which is bad since they are all brand new.
So if something do happen during the erasure process (power loss, write errors, etc), that would kill a very useful sector... for nothing.
So the question is: How to avoid dd
or badblocks
erasing hard drives' spare sectors?
Assumptions:
dd
is known to blindly erase everything that goes through it.badblocks
is known to be able to access unmapped blocks.
Update 1:
dd
definitely can't access spare sectors if they didn't replaced a faulty sector (obviously).
This is due to how dd
was designed (comment by Kamil Maciorowski):
The logical sector numbers available to
dd
are mapped to numbered
physical sectors and the corresponding numbers are initially equal.
Spare physical sectors initially have no logical numbers assigned, so
dd cannot reach them.
Update 2:
Being mostly a sysadmin -and not being a "close to low-level" coder (C)-, can someone take a look at badblocks
' code and tell if it does access spare sectors?
To be more precise, does badblocks
also take into account spare sectors inside its block reading/writing?
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/tree/misc/badblocks.c
On another side/way to get the answer; I also know that Theodore Ts'o, the badblocks
' maintainer, has an account here on .
If he reads this update 2, is it possible to have a direct answer about that?
No comments:
Post a Comment