get rid of master boot record
I have old hard drive that had Ubuntu on it. Now I have a new machine which came with Windows 10, but it is what I would call a bootleg copy and can't be registered, so I have decided to return to Ubuntu 18.04. That is coming along well. I have 2 new hard drives and have formatted my old hard drive and want to use it for storage but it still is master boot record and I can't get rid of that. It is still trying to boot from that and I have to turn it off when booting up. I haven't run into any info on just this problem. Formatting does no good. I am still stuck.
Warning! The following will erase your entire drive!
- Donwnload and burn gparted live
-
Go to
gparted
: In the upper right corner go to the correct disk
- Double-check you have the correct disk
- Go to the menu Device and choose Create Partition table
- Choose
gpt
- Cick OK on the warning
Done!
You now have a GPT drive instead of an MBR drive
Warning! This will completely wipe your entire disk!
The following command will effectively fill your drive with zeroes and the beginning of the drive will be erased. Then you can reformat as you prefer afterwards. Be very careful not to erase another drive! I would go as far as booting from a Live USB and physically disconnecting all other HDD/SDD drives.
sudo dd if=/dev/zero of=/dev/disk/by-id/{yourhdd} bs=1MB count=1
where:
-
bs=1MB
means blocks size is 1 megabyte -
count=1
instructsdd
to copy only one block
and the end effect will be to overwrite the fist 1MB of the disk this destroying the MBR sector
If you skip the bs and count parameters the command will run until it overwrites the whole disk or until you terminate it
You can also remove the boot code from the disk. This will leave your data intact:
sudo dd if=/dev/zero of=/dev/disk/by-id/ata-WHATEVERDISK bs=446 count=1
In the MBR, only the first 446 bytes yield the boot code, the partition table follows.
You can also switch to GPT with any tool you like. I recommend gdisk
.
Please note that you can have an MBR with boot code while using GPT. These methods are orthogonal.