Hacker News new | ask | show | jobs
by SeldomSoup 3850 days ago
> If you want to erase a drive fast then use the following command (where sdXXX is the device to erase):

    dd if=/dev/zero of=/dev/sdXXX bs=1048576
Question: is there a disadvantage to using a higher blocksize? Is the read/write speed of the device the only real limit?
1 comments

> is there a disadvantage to using a higher blocksize?

Maybe, depending on the details. Imagine reading 4 GB from one disk then writing it all to another, all at 1 MB/sec. If your block size is 4 GB, It'll take 4000 seconds to read, then another 4000 seconds to write... and will also use 4 GB of memory.

If your block size is 1 MB instead, then the system has the opportunity to run things in parallel, so it'll take 4001 seconds, because every read beyond the first happens at the same time as a write.

And if your block size is 1 byte, then in theory the transfer would take almost exactly 4000 seconds... except that now the system is running in circles ferrying a single byte at a time, so your throughput drops to something much less than 1 MB/sec.

In practice, a 1 MB block size works fine on modern systems, and there's not much to be gained by fine-tuning.