2

I want to remove grub from one of my disks to make sure I don't accidently boot from it. But I want to remove only the boot loader, the data needs to stay intact.

Edit: I of course don't want to remove Linux, only clear a bootloader from the previously primary disk.

3

Create backup of first 446b on your disk (this is not all MBR - it has 512b), so when your disk is /dev/sda:

:~# dd if=/dev/sda of=/data/disk.img bs=446 count=1

And next remove (only erase bootloader without disk table):

:~# dd if=/dev/zero of=/dev/sda bs=446 count=1

If you revert:

:~# dd if=/data/disk.img of=/dev/sda bs=446 count=1
  • 1
    Note: since Windows 2000, Microsoft uses octets 441-446 for a 32-bit disk signature followed by 2 octets of zeroes. So, it might be better to still backup the full 446 octets, but only overwrite the first 440. Actually, it would probably be enough to just overwrite the first octet, after all, all you need to achieve is that the boot loader code is no longer valid x86 machine code. – Jörg W Mittag Oct 29 '16 at 11:12
  • Thanks, I did as @JörgWMittag proposed and overwrote only the first 440b, but it worked as expected. – Jakob Lenfers Oct 29 '16 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.