[sf-lug] use dd to copy the mbr

Rick Moen rick at linuxmafia.com
Mon Nov 19 21:35:32 PST 2007


Quoting jim stockford (jim at well.com):

> 
> from
> http://searchenterpriselinux.techtarget.com/tip/ 
> 0,289483,sid39_gci1244256,00.html
> 
> # dd if=/boot/mbr_backup of=/dev/sda bs=446 count=1
> # # their example above
> 
> # # or, copy from the primary master to primary slave:
> # dd if=/dev/hda of=/dev/hdb bs=446 count=1
> 
> note the bs=446 rather than bs=512 lets you copy the
> bootstrap loader code without copying the partition table
> (if you use bs=512 you copy the partition table from the
> source and overwrite that of the target).

Well, it might still be an utterly excellent idea to make a backup copy
_of_ the partition table:

# dd if=/dev/hda of=MyMachineHostnameSectorZero-2007-11-19 

In olden days, when we still had floppies, you'd then do this:

# mcopy MyMachineHostnameSectorZero-2007-11-19 a:

These days, I guess you'd burn it to a CDR, or scp it across the LAN to
a second machine for safekeeping.

If you ever lost either the partition table or the MBR, you could 
dd the applicable fraction of MyMachineHostnameSectorZero-2007-11-19 
back to /dev/hda.

(Hard drive sector zero is 512 bytes long:  446 bytes of initial 
boot program area, 16 bytes of partition table comprising 4 entries of
16 bytes each, 2 bytes left over used by almost nothing except NT Disk
Administrator, which puts "disk signatures" there.)

I frankly cannot fathom why people think the inital 446 bytes' contents
are so valuable.  It's dead-easy to rebuild from a Linux maintenance CD 
whatever you had there.  I'd have though possessing a reference copy of 
the partition table would be more valuable.






More information about the sf-lug mailing list