How To Backup MBR To an External Hard Drive in Linux

Posted on 137 views

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.

Backup MBR To an External Hard Drive in Linux

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.

Identify OS boot disk

$ lsblk
sr0     11:0    1  1.9G  0 rom
zram0  251:0    0  3.8G  0 disk [SWAP]
sda    252:0    0   60G  0 disk
├─sda1 252:1    0    1G  0 part /boot
└─sda2 252:2    0   59G  0 part /home

The command used for this purpose is the dd command.

sudo 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.

sudo 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.

Have you tried Mozilla and Opera on your Ubuntu, Kali or Debian Machine?

That’s all. Thanks for reading, hope it helps someone out there.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.