How to destroy existing disk partitions

6,755

Solution 1

sysctl kern.geom.debugflags=16

This solve it for me. If some one can explain for future reader how and why this work I delete my answer and accept your answer.

Solution 2

Do you have any securelevel set? Because a securelevel inhibits EVEN the root from writing onto disks!!! It does not look to me like a broken disk, because with a broken disk you would get a storm of I/O errors over several monitor pages at least. He there just says that he can not do it because he has no permission to do that. If you are root, it might be securelevel, or some type of mandatory access control. And your title does not fit into the question you posed then. Destroying partitions along with the label is done by gpart destroy -F ada0.

Share:
6,755
Sir l33tname
Author by

Sir l33tname

OS: win10, Fedora 26 (4.19.6-300.fc29.x86_64), FreeBSD 12 Music: Hardstyle, Punk Rock

Updated on September 18, 2022

Comments

  • Sir l33tname
    Sir l33tname over 1 year

    I added some disks to my system, which were in use before. I tried to create them:

    $ gpart create -s GPT ada0
    gpart: geom 'ada0': Operation not permitted
    $ gpart show ada0
    gpart: No such geom: ada0.
    

    Is there a way to find out, why this happening?

    Update:

    It's probably a broken disk. I this with other disks and everything work as expected.

    • dchirikov
      dchirikov almost 10 years
      Try sudo gpart
    • Sir l33tname
      Sir l33tname almost 10 years
      @dchirikov god point but I'm root on my system
    • dchirikov
      dchirikov almost 10 years
      $ sign shows you are not. If you not change PS1 of course. :) anyway it's just comment, not the answer.
    • slm
      slm almost 10 years
      Double check that this is the correct device label: sudo sfdisk -xl.
  • urza.cc
    urza.cc almost 5 years
    Thanks for this! I dont know what it does but it solved my problem, after spending few hours googling. I needed to format disks in FreeNAS, which refused to create new zfs pool from disks that were previously used in NAS4Free with GELI enctyption. This is the only command that allowed me to format them with gpart create -s gpt /dev/ada0 etc..