[ubuntu-us-in] hard drive tools* ssh ftp suggestions

Rob Ludwick rob at rcludw.no-ip.org
Sun May 4 04:35:03 BST 2008


On Fri, 2008-05-02 at 08:19 -0400, Simón Ruiz wrote:
> On Fri, May 2, 2008 at 12:15 AM, Rob Ludwick <rob at rcludw.no-ip.org>
> wrote:
> >  DD is, I believe un buffered reads, but sequentially.  So if it
> fails on
> >  one sector, it will fail on all sectors.

What I meant by that is that you get a short read.  In other words it
works and gives you data, until it can't and then it gives you an EOF.


> >  Normally in order to get any kind of performance through dd, one would
> >  adjust the bs parameter.  which in this case you can't because the way
> >  you're reading it.
> 
> So, ummm, how does the bs parameter affect performance?

dd reads one block from the input file and then writes it to the output
file.

The block size in dd is arbitrary.  You're reading a block size of 4096,
but technically the harddrive block size is something more like 512.

Because of that you can try reading  with a bs=1024k.   When you get an
error, you will get a short read.  In other words you will get a read as
many bytes up until the error.  The trick will be that you adjust the
skip parameter to start reading at the 512 byte block boundary after the
one that received the error.

Even a bs of 64k is faster, because the drive can queue up a bunch of
reads sequentially, one block after the next.  64k blocks vs 4k blocks
results in 16 times less seeks.

Of course a neat trick in python is to use popen2() and use dd without
an "of" paramter.  dd sends the data to standard out, which in python
through popen2() becomes a file.  (Yay!)  You know how many bytes you
get because you you can count them and you would get an EOF before you
were done reading blocksize.  At this point you would adjust your dd
parameters to start at the next 512 byte block on the drive.  And then
you can just use python to interleave the 4k blocks.  

If you get an error, you just pretend you read a 512 byte block of
zeros.

--R








> >  --R
> 
> --S
> 





More information about the Ubuntu-us-in mailing list