[plug] boot from stick

Ishwor Gurung ishwor.gurung at gmail.com
Wed Jan 13 17:05:12 WST 2010


2010/1/13 Daniel J. Axtens <danielax at gmail.com>:
>> It should have been-
>> $ dd if=/dev/sda of=/dev/sdb count=512 (only 512 bytes)
>
> That (probably) doesn't do what you think it does.

Yep you're right :)

> dd works in "blocks" of bytes, and usually, 1 block != 1 byte. Your
> command would have copied 512 blocks. For example, on my Mac, a block
> is 512 bytes by default so that command would have copied 512*512 =
> 262144 bytes = 256 KB (KiB? 256 lots of 1024 bytes, whatever we call
> that these days).

Oh the joy of excessive soda :)  I can't believe I wrote that!

KB is Kilo-byte and Kb is Kilo-bit, KiB is Kibi-bit anyhow just sayin'.. :)
1 kibibyte = 210 bytes = 1,024 bytes (from wikipedia)

> Consult the manual for dd to find the default blocksize on your system.
>
> I believe the canonical way of copying the first 512 bytes is:
> dd if=... of=... bs=512 count=1

Yes. Another PEBKAC. Gahhh...

> I'm fairly sure this significantly faster than bs=1 count=512, but I'm
> not going to venture an opinion on why.

bs=1 count=512 copies 1-byte block 512 times. bs=512 count=1 copies
512 bytes at one go. Thats why you see an increase in speed.
--
Regards
Ishwor Gurung
Key id:0xa98db35e
Key fingerprint:FBEF 0D69 6DE1 C72B A5A8  35FE 5A9B F3BB 4E5E 17B5



More information about the plug mailing list