Ok. Please don't judge me. I had no coffee yet when I did this...

I tried to format a new USB drive and the drive didn't mount and I didn't think straight... long story short, I did

parted -s /dev/sda1 mklabel gpt where sda is, of course, my main (boot) drive.

The output of that command was

Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on
/dev/sda1 have been written, but we have been unable to inform the kernel of the change,
probably because it/they are in use.  As a result, the old partition(s) will remain in use. 
You should reboot now before making further changes.

as of course the boot drive is in use.

parted-print (sda) is as follows:

root@file1:/home/elite/scripts/samba# parted -s /dev/sda print
Model: ATA WDC WDS500G2B0A (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  2150MB  2147MB  ext4
 3      2150MB  500GB   498GB

blkid output is as follows:

/dev/sda1: PARTUUID="beb5bce4-33f3-4632-bd06-54536f2a7882"

/dev/sda1: PTUUID="b5816fa7-16c3-4424-aff7-b13befada3b9"
 PTTYPE="gpt" PARTUUID="beb5bce4-33f3-4632-bd06-54536f2a7882"

As far as I can tell, I've (accidentally) created a new partition-table in a partition and now I'm afraid to reboot.

Question is: Do I need to do something at all or will the system boot if I leave it this way? If it will probably not boot, can I recover from this and if yes, then how? Thank you in advance.

  • You can use wipefs to get rid of msdos&gpt partition header on sda1 (careful not to wipe filesystem headers too, if not gone already). But the question is, what was on sda1 before...? Check parted /dev/sda print for this partition type and size, and blkid / fstab / mount if its mounted anywhere… Jun 15, 2023 at 6:29
  • Wow. That was fast. Thx. I added the parted -s /dev/sda print output to the question. FS was ext4 and it's been the grub-partition. Do you think it's save to proceed?
    – Gerald
    Jun 15, 2023 at 6:39

1 Answer 1


You inadvertently created a partition table inside the partition /dev/sda1 and this was your bios_grub partition. This will have removed/damaged grub's core image, so rebooting will likely result in grub not working. If you reboot anyway, you might end up in a very limited grub rescue> prompt.

The partition headers you created can be removed with wipefs, or by writing zeroes.

wipefs -a /dev/sda1
# alternatively (in this case since your partition is 1M large)
head -c 1M /dev/zero > /dev/sda1

Fixing grub should be a simple matter of re-running grub-install.

grub-install /dev/sda

If grub-install does not show any errors, it should be safe to reboot afterwards.

In some cases, grub-install requires additional options (e.g. for pre-loading additional modules into the core image); this depends on system configuration. If you're not using anything special, this most likely doesn't affect you. If you installed grub manually before, you'll just have to repeat the same steps.

  • Thank you very much. I will reboot at night and assume that this is done with. Your help is very much appreciated.
    – Gerald
    Jun 15, 2023 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .