In this brief tutorial we will see a useful tip that allows us to backup the current system MBR (Master Boot Record) via the command line under Ubuntu (12.04/11.10 or older). The MBR resides typically in the first sector of a hard disk or any other data storage device which holds the partition table. If you want to make some modifications to your boot loader, usually known as the GRUB boot loader under Ubuntu, then making a copy of your MBR will be highly recommended so that you can restore it in case of unexpected troubles, especially when doing dual booting.
We will assume that your hard disk is /dev/sda. If it is not the case, then replace it with your own in the command given below. We will use the DD command line tool for copying the MBR. Open the terminal and run this command to backup the MBR:
sudo dd if=/dev/sda of=boot.bin bs=512 count=1
A "boot.bin" file will be created in the current terminal location. Move this file to any secure place on your disk or to your USB stick. Later, you can restore the MBR with this command:
sudo dd if=boot.bin of=/dev/sda bs=512 count=1