Want to create a Backup of MBR so that you can restore it in case it fails. If so, then this tutorial is for you. This will work on any Linux Distribution available in the Planet Earth.
First, let’s start by defining MBR.
What is MBR?
MBR stands for the master boot record. It is a very small program located in the first sector of the hard disk. MBR contains information about your hard disk partitions and loads the operating system. The Master Boot Record is usually 512 bytes in size.
If this file is damaged, you won’t be able to boot into your operating system hence it’s very important to have a backup. You can replace damaged one with you back up easily and get your OS back to life.
In this example, I’ll show you how to make a backup of your MBR and store it in /home directory. You can later copy MBR backup from your /home directory and save it in external hard drive or USB disk drive.
The command used for this purpose is the
dd if=/dev/sda of=~/mbr.txt count=1 bs=512
The above example assumes that your hard disk is /dev/sda . The options are:
count=1 : means that we are making one copy only.
bs=512: Means that the size of one copy is 512 bytes
if=/dev/sda : specify our hard drive
of=~/mbr.tx: Means we are copying to a file called mbr.txt in our /home directory ( tilde ~ means home dir)
The command is shown in the picture below.
If at any time you need to restore your MBR Backup. Execute the command below.
dd if=~/mbr.txt of=/dev/sda count=1 bs=512
See picture below
NOTE: Your hard disk will either be /dev/sda or /dev/hda.
Install VMware Workstation on your Linux Box Today or
Get Virtualbox Latest Running on Your Kali and Debian easily.
That’s all. Thanks for reading, hope it helps someone out there.