The Linux DD command allows you to read and write directly to block devices. If you are playing around with boot loaders, dual booting, etc, its a good idea to take a copy of your master boot record just in case things go astray and you need to restore it.
To backup the master boot record (MBR):
$ sudo dd if=/dev/sda of=boot.bin bs=512 count=1
/dev/sda is the device of the hard drive you want to take the backup from.
boot.bin is the file that will get created, containing the backup. Keep this in a safe place.
To restore the MBR backup back to the hard drive:
$ sudo dd if=boot.bin of=/dev/sda bs=512 count=1
Note: Don’t mix up the ‘if=’ (input file) and ‘of=’ (output file) options, as you may overwrite your MBR accidentally.