Does linux 'dd' copy boot blocks?

Posted by: TigerJimmy

Does linux 'dd' copy boot blocks? - 25/01/2005 21:43

Hey you guys,

If I use dd with disk devices like:

dd if=/dev/hda of=/dev/hdb

this will copy the boot blocks and everything, right?

Thanks,

Jim
Posted by: tman

Re: Does linux 'dd' copy boot blocks? - 25/01/2005 21:56

It will copy everything. The new drive must be equal or greater size however.
Posted by: mlord

Re: Does linux 'dd' copy boot blocks? - 25/01/2005 23:21

Yup.

But so would a simpler "cp /dev/hda /dev/hdb" or a "cat /dev/hda >/dev/hdb".

Cheers
Posted by: TigerJimmy

Re: Does linux 'dd' copy boot blocks? - 25/01/2005 23:36

Really? Cool. Why is it simpler, though? Which is fastest?

Thanks,

Jim
Posted by: mlord

Re: Does linux 'dd' copy boot blocks? - 26/01/2005 00:24

I think they're all comparable in speed, since Linux is so good at optimizing streaming disk read/write operations.

"cat" is probably the slowest of the three, due to pipe buffering defaults. But cp and dd should be equal with default parameters. One might be able to tweak out a slightly faster time with dd using an appropriate bs=nnn parameter.

Cheers
Posted by: TigerJimmy

Re: Does linux 'dd' copy boot blocks? - 26/01/2005 04:45

Cool. Thanks you guys.

Mark, a while back you mentioned you increased the disk throughput on your little biscuit-tin server by tweaking, mostly a custom kernel. Did the custom kernel have weird IO stuff in it, or was it a kernel with all of the unneeded stuff stripped out? Just curious how that performance increase was achieved.

Thanks again you guys. I'm off to make a current backup of my mp3 collection.

Jim
Posted by: mlord

Re: Does linux 'dd' copy boot blocks? - 26/01/2005 21:59

I think I merely fixed an efficiency bug in the IDE driver (placed there after I passed it on to others). My 80GB drive understands LBA48 commands, which have nearly double the setup overhead (microseconds) of the older LBA28 commands. The IDE driver, by default, tries to use LBA48 exclusively whenever a drive claims to support it.. EVEN WHEN NOT NEEDED!!!

Duh.. So I just hacked it to not do LBA48 when not needed, which is nearly 100% of the time on my 80GB drive (all of which falls into the LBA28 addressible space).

A small win, not much difference, but it saves some CPU horsepower for other things, and removes 3-5 microseconds from each disk I/O operation.

Cheers
Posted by: schofiel

Re: Does linux 'dd' copy boot blocks? - 26/01/2005 22:24

Listen!

The sound of a true craftsman in action...
Posted by: TigerJimmy

Re: Does linux 'dd' copy boot blocks? - 27/01/2005 03:15

No kidding. I am not worthy...

Thanks again, Mark.