21

This is what I got while trying to format a partition in my pendrive:

Error deleting partition /dev/sdb1: Command-line parted --script "/dev/sdb" "rm 1"' exited with non-zero exit status 1: Warning: /dev/sdb contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT partition table?

Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted's rescue feature to recover partitions.

(udisks-error-quark, 0)
  • 1
    ok....wht hapnd is that i created a msdos using parted ..it solved my partition problem but when i tried to format my pendirve i got the following error.....Error synchronizing after initial wipe: Timed out waiting for object (udisks-error-quark, 0) – Harun Guna Dec 9 '13 at 15:42
10

Chances are your disk originally contained a GUID Partition Table (GPT), but you created a new Master Boot Record (MBR) partition table over that with a tool that doesn't understand GPT. Because GPT takes up more space than MBR, this means that there's leftover GPT data, and parted is becoming confused because of that.

If this analysis is correct, then the easiest solution is to run FixParts on the disk. FixParts will offer to remove the leftover GPT data, and thereafter you should be able to use the disk normally. (You don't need to do anything else in FixParts; just tell it to remove the GPT data when it asks you about this and then exit.)

There is a caveat, though: It's also possible that you had a GPT disk but that something accidentally wrote an MBR partition table to the disk. In this case, you probably want to recover the GPT, not wipe it out! If this is the case, the solution is to run gdisk on the disk. It will detect the problem and ask if you want to use the GPT or MBR data. Tell it to use the GPT data, check that it's correct by typing p and comparing the output to whatever you believe to be correct, and then type w to save the changes.

Both FixParts (fixparts) and gdisk are part of the gdisk package in Ubuntu. It's usually not installed by default, so you may have to install it by typing sudo apt-get install gdisk.

  • FixParts doesn't work on 14.04 – wranvaud Mar 1 '15 at 0:58
  • I just checked, and fixparts does work on Ubuntu 14.04. You haven't said what's not working, so it's hard for me to diagnose. My best guess is that you've got a GPT disk, which fixparts will refuse to touch because it's not designed to manage them. It could be you've run into some other problem, or even a fixparts bug, but without more information I really can't diagnose it, much less fix it. Please file a bug report with detailed information. – Rod Smith Mar 5 '15 at 18:59
  • Can you clarify what you mean by "run Fixparts"? When I run the command fixparts /dev/sdb I just get a prompt from which I must type a command. Is there a specific command for removing leftover GPT data? I didn't see any mention of this in the help. – Jon Bentley May 14 '15 at 16:01
  • Check the FixParts documentation, referenced in my answer, for details on how to use it. If you have problems after that, post a new question with details of what you did and what's not working. – Rod Smith May 14 '15 at 18:58
33

I ran into this problem with writing onto an old drive that had been written as a live linux disk.

Solution if you just want to erase the disk /dev/sdX:

sudo gdisk /dev/sdX
o  

(agree to delete partitions)

w  

(agree to write partition table)

And then you have a perfectly blank drive. All that remains is to create a partition if you want to use it.

Note: Gdisk is a disk partitioning tool, and it can erase your disk if not careful. It is designed to create, modify, and erase partitions.

  • this ansmer works for me . – user3687723 Jul 19 '15 at 21:23
  • This just helped me fix a broken thumb drive. – Soham Chowdhury Sep 11 '15 at 15:52
  • This is a great answer as it helped me saving a bricked USB stick of mine :) – NiKo Dec 29 '16 at 16:05

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.