Other Unable to wipe out disk

stream

Member

Reaction score: 1
Messages: 29

Hi,

I had previously installed Freebsd 11 on ssd, and wanted to repurpose the disks for regular storage on a new build with 12
Unfortunately when I tried to create a pool using those ssd, I get an error saying "device busy" or "operation not permitted".

I've tried a number of things, but nothing works. This is very frustrating. Is there anything that can be done to clean the disk. In the past I've had success with dd command. But now, even that doesn't allow me to wipe the disk. Is there any way to FORCE wipe the disk and use it again. Appreciate your help.

Here are things I've tried:

gpart show

>>
0 ##### ada0 BSD (500G)
0 #### 1 freebsd-ufs (496G)
### #### 2 freebsd-swap (4G)

dd if=/dev/zero of=/dev/ada0 bs=512 count=3
>> dd: ... operation not permitted

dd if=/dev/urandom of=/dev/ada0 bs=512 count=3
>> dd: ... operation not permitted
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,292
Messages: 29,742

Don't boot from the disk you're trying to wipe. And make sure you're root.
 

Emrion

Active Member

Reaction score: 36
Messages: 183

If I recall correctly, you need first to delete all partitions with gpart delete then destroy the scheme with gpart destroy.

(And of course, you must not boot on it).

If you have trouble to set a zfs pool on it, then you will have to fill all the disk with zero.
 

roccobaroccoSC

Well-Known Member

Reaction score: 93
Messages: 413

Also, writing only to the first 1,5k of the disk does not wipe all metadata when using GPT. You should use gpart destroy instead.
With GPT metadata is written also at the end of the device.
 
OP
OP
S

stream

Member

Reaction score: 1
Messages: 29

Thank you for the quick responses.

SirDice I was always booting into the new (12.0-p3) disks and trying to delete the old disks (ada0 and ada1). But somehow just couldn't delete. The old and new both had ZFS mirrors. I think there are some hidden meta data that prevents ZFS from deleting. Nothing works, not even dd !!

So solved it by a rather hacky process:

1) Remove all new disks (say ada3, and ada4) , and stick in one old disk (say ada0) -- the one we are trying to clean up. Try Live-installing from USB stick a fresh FreeBSD install, but use legacy MBR partition and UFS. Important because if you use ZFS, you're back to square one.

2) Remove ada0, and repeat installation for ada1.

3) Now change BIOS boot sequence so UEFI is loaded first, and MBR last.
Now stick in all disks, so we should boot from new disks.

4) Now dd ... commands will work..

Now zpool pain create mirror /dev/ada0 /dev/ada1 works..
 
Top