When you do: dd if=somefile of=/dev/sdX bs=1024 count =10 with a magnetic Hard Disk, and if the disk has say R/W multiple sector transfer: Max = 16 one can estimate that 16 * 512 = 8192 so setting a block size of bs=8192 would be nice, because dd would output 8192 byte chunks that would go straight to the disk buffer with minimal command overhead.

However what happens when you use dd with a USB stick? Will a write of 512 bytes result in multiple clusters/blocks much larger than 512bytes, getting erased or does the Linux USB driver handle this through cleverness? Will it write out 512 bytes by erasing 4096 bytes and then write out the next 512 bytes by nuking another 4096 bytes, ad infinitum?

  • I doubt that USB would format what has been formatted and still clean regardless of the single IO transfer size. Otherwise the lifetime of USB disks would not be long enough and performance would not be at rates we observe
    – Serge
    Nov 17 '15 at 11:32
  • 1
    You should this interesting article on flash drive architecture from LWN 2011.
    – meuh
    Nov 17 '15 at 15:42
  • great stuff, one thing he doesn't mention is caching on USB sticks. There has to be a cache equal to at least 4MB (from the article) - how else would he avoid write amplification, in which case what if the user were to suddenly pull out the drive?
    – user56718
    Nov 17 '15 at 16:06

As dd creates an exact image of the original source, the bs option won't affect the layout of the destination.

As for writing, dd by default uses cache/buffers, so the point is moot of giving it only 512 bytes. Nevertheless I do prefer to give it a bigger buffer, always multiple of 1024.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy