Write reallocator

grarpamp grarpamp at gmail.com
Sun May 22 06:19:01 UTC 2011


>>see if it will reallocate marginal reads when written to.
>>Because the data is still semi valuable, I want to
>>read and write back every block of the disk.
>>Any tools that will do this?
>
> Recoverdisk ?

This is interesting, yet man does not indicate rewriting capabilities,
only copying off to other media. dd will throw error block indexes.
recoverdisk will automagically attempt rereading them, sizing
down the bs. It's not clear to me what the zero blocksize in '-b 0'
means, since you can't read anything less than the native size.

I think recoverdisk could have another useful mode to take a list of
error sectors '-e elist' (whether from dd noerror or a first pass of itself),
and then loop read those into numbered files, instead of copying the
whole 3TB worth of disk. With an option to zero pad after n number of
read attempts. Those could then be layed back onto disk by hand.

In the past, I've noticed some disks will cough up the sector in
question depending on the covering bs size used, don't know why.

dd reads a block before writing it (presumably up to some blocksize
limitation), so we still have this old trick. If it's a file, and
after all the full
bs sized records, the last block is shorter than the bs, it will need to
be handled separately. If it's a device, it's ok as it throws a short write
EOD. There is no safety net obviously.

# dd if=/dev/urandom of=r bs=1m count=50
50+0 records in
50+0 records out
52428800 bytes transferred in 2.552598 secs (20539388 bytes/sec)
# ls -isl r
5  51248 -rw-r--r--  1 0 0  52428800 May 22 01:19 r
# md5 r
MD5 (r) = 92b48057a6af390fa337523c10b757bc

# dd if=r of=r conv=notrunc,noerror,sync bs=512
102400+0 records in
102400+0 records out
52428800 bytes transferred in 1.388739 secs (37752807 bytes/sec)
# dd if=r of=r conv=notrunc,noerror,sync bs=1m
50+0 records in
50+0 records out
52428800 bytes transferred in 0.636191 secs (82410485 bytes/sec)
# dd if=r of=r conv=notrunc,noerror,sync bs=50m
1+0 records in
1+0 records out
52428800 bytes transferred in 0.905330 secs (57911263 bytes/sec)

# ls -isl r
5  51248 -rw-r--r--  1 0 0  52428800 May 22 01:20 r
# md5 r
MD5 (r) = 92b48057a6af390fa337523c10b757bc


More information about the freebsd-fs mailing list