Gpart File Exists Error on FreeBSD 1


Tried to manually setup my disks in order to install root FreeBSD on a ZFS mirror, but following the how-to’s available, I couldn’t get pass the first command.

gpart create -s gpt ad0
geom 'ad0': File exists

 

I tried deleting the partitions/slices, even doing a “dd of=/dev/null” on my drives.  But I keep getting this file exists error, which is totally less-than-helpful.  Google didn’t give me much help either, but it did lead me to other info which helped.

So… delete the partitions:

gpart delete -i 2 ad0
gpart delete -i 1 ad0

 

In the above, I only had 2 partitions, so you may need to add a line for “-i 3” if you had a third, fourth, etc.  Also, in my case I was setting up a mirror on ZFS, so I repeated all these for both drives. (ad0 and ad2, for my system)

After that, there was a ONE EXTRA thing that was needed before the “gpart create” command would work.  You need to “destroy” it!

gpart destroy ad0

I was finally able to runt he gpart create normally after that. If you had drives setup previously from another system, this was how I removed any partition info on them.

These are the sites I used as reference.

http://forums.freebsd.org/showthread.php?t=9777

http://www.b0rken.org/freebsd/zfs.html

http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror