dd - bytes at a time
On Sat, Dec 19, 2009 at 10:15 AM, Neil Bothwick <email@example.com> wrote:
> On Sat, 19 Dec 2009 12:11:27 +0000, Stroller wrote:
>> > Incidentally, if you want to use dd, adding bs=4096 speeds it up quite
>> > significantly.
>> Thank you. I have always wondered what the optimal bs might be.
>> And why - could you possibly explain that, please?
>> Is bs=4096 best for all disk-based operations?
> Many filesystems are set up with 4K blocks, so matching this with dd is
> more efficient. The default is 512 byte blocks and anything larger
> than this is good, I sometimes use 40960 but that isn't significantly
> faster. I prefer to avoid using dd on hard disks altogether, it's just
> so damn slow for large amounts of data.
> Neil Bothwick
> You can't teach a new mouse old clicks.
My *completely uneducated* guess would be that, for a raw disk level
copy (on a normal spinning disk) or write a bs that is *at the least*
divisible into the drive's cache size, and at best *is* the drive's
cache size, would be best. For SSDs, if you have some strange reason
to need to use dd with one (I'd avoid it simply because a: you'll
never guarantee an overwrite of what's really there now and b: you'll
be put at least a small dent in the lifespan of the drive) the minimum
erase block size would be best, since that'd allow both a full erase
and a full write of a block, rather than risking 2 erases to get all
of one block written.
I do reiterate that this is all mere conjecture, and is based in my
likely flawed conceptual understanding of the drives.
Joshua M. Murphy