3

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.

7

Warning! The following will erase your entire drive!

  • Donwnload and burn gparted live
  • Go to gparted:

    gparted main screen

  • 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

6

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=of=/dev/sd{yourhdd} bs=1MB count=1

where:

  • bs=1MB means blocks size is 1 megabyte
  • count=1 instructs dd 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

  • 2
    Easier just telling it to do 512 bytes or 1 million bytes rather than aborting dd. See man dd or google the many examples on the internet. – WinEunuuchs2Unix Jul 12 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 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 at 23:08
  • dd (Disk Duplicator) is bad mouthed and called by many as Disk Destroyer. I wrote a wrapper script for it so that of=/dev/... can never be my hard drives or SSDs by accident: askubuntu.com/questions/867746/… 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 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 at 23:25
3

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.

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.