The Master Boot Record (MBR) is a crucial component that helps load operating systems on your computer. It occupies the initial 446 bytes of your boot disk. When installing a new operating system like Microsoft Windows, the MBR might be replaced or deleted, preventing access to your other installed operating systems.
To safeguard your MBR, it's crucial to create a backup, particularly before installing a new operating system. Linux allows you to back up the MBR using the dd command in the terminal.
Steps to backup Master Boot Record in Linux:
- Open your favorite terminal application.
- Identify available disks and choose the one containing the MBR you want to back up.
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 89M 1 loop /snap/core/7713 loop1 7:1 0 54.6M 1 loop /snap/lxd/11964 loop2 7:2 0 54.6M 1 loop /snap/lxd/11985 loop3 7:3 0 88.7M 1 loop /snap/core/7396 sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1M 0 part └─sda2 8:2 0 20G 0 part / sr0 11:0 1 748M 0 rom
- Use the dd command to create a backup of the MBR from the selected disk and save it to a file.
$ sudo dd if=/dev/sda of=/home/user/mbr.bak bs=446 count=1 [sudo] password for user: 1+0 records in 1+0 records out 446 bytes copied, 0.00140727 s, 317 kB/s
- Confirm that the MBR backup was successful.
$ strings /home/user/mbr.bak ZRr= `|f \|f1 GRUB Geom Hard Disk Read Error
The file is in binary format but you should be able to see some strings such as GRUB (if you're using GRUB as your bootloader) as hint that you've copied the right section of the disk.
- Save the backup on a separate storage device, such as a USB drive, for easy restoration if the MBR becomes corrupted in the future.
Comment anonymously. Login not required.