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.
-
1If you have data you may want to keep: Converting to or from GPT - must have good backups. http://www.rodsbooks.com/gdisk/mbr2gpt.html – oldfred Jul 13 '19 at 03:42
-
The BIOS controls the boot order, so you can fix it from there. – RonJohn Jul 13 '19 at 15:40
-
Possible duplicate of How to format a USB flash drive? – WinEunuuchs2Unix Jul 13 '19 at 18:26
3 Answers
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 megabytecount=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

- 103

- 293
-
3Easier just telling it to do 512 bytes or 1 million bytes rather than aborting
dd
. Seeman dd
or google the many examples on the internet. – WinEunuuchs2Unix Jul 12 '19 at 22:55 -
it is cleaner and probably better practice. for me pressing ctrl+c is easier than calling man dd. If you write the whole drive you also verify you don't have non-relocatable bad sectors. – Dr Phil Jul 12 '19 at 22:58
-
anyway I added the other option, as it might be useful. And reading dd documentation is highly recommended as it uses completely different conventions from the rest of Linux commands, and it is a dangerous utility – Dr Phil Jul 12 '19 at 23:08
-
1
dd
(Disk Duplicator) is bad mouthed and called by many as Disk Destroyer. I wrote a wrapper script for it so thatof=/dev/...
can never be my hard drives or SSDs by accident: https://askubuntu.com/questions/867746/prevent-dd-from-destroying-ssd-or-hdd/867747#867747 Plus a little help screen for erasing MBR is there. Plus it shows you the real names for/dev/sda
,/dev/sdb
, etc. so you truly appreciate which witch is which. – WinEunuuchs2Unix Jul 12 '19 at 23:11 -
yeah finding which disk is which can be a PITA. I would call your wrapper script something else like safedd, so there is less confusion and it can be actually included in distros – Dr Phil Jul 12 '19 at 23:25
-
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

- 34,259
-
1I will add that you can get
gparted
on a live distro all by itself: https://gparted.org/livecd.php – TheHans255 Jul 13 '19 at 17:21 -
-
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.

- 226
- 2
- 10