Solved USB Drive with GPT corrupt or invalid

Two 128GB USB drives with exact same result on each one.

gpart destroy -F da0
gpart create -s GPT da0
gpart add -t freebsd-ufs da0
newfs -U da0
Here I get the typical scrolling of numbers, but then I get a warning
about the secondary GPT table is corrupt or invalid.
gpart confirms this:
gpart show da0
Code:
34 263061437 da0 GPT (125G) [CORRUPT]
34 263061437 da0 GPT  freebsd-ufs

I can mount the drive and read/write to it just fine.

It seems like the newfs(8) is running into the secondary GPT header but I could be wrong.

Anyone else seen this or might know what is going on?

Thanks,

Bill
 
Anyone else seen this or might know what is going on?
newfs -U da0 should be newfs -U da0s1 because you created a new GPT table with one partition with gpart add. When you run newfs -U da0 you destroy your GPT table, because you are creating a new filesystem over the entire disk which overwrites the beginning of the disk. Because newfs does not overwrite all of the disk (that would take far too long) the secondary GPT header still hangs around at the end of the disk, which results in the warning you get.
 
Correction, the newfs line should use da0p1

GPT uses partitions (p#) while MBR uses slices (s#).

To the OP: You created a GPT partition, and then formatted the entire disk (overtop of the partition table and everything) with a UFS filesystem. You need to specify the partition when you format it!

Code:
gpart destroy -F da0
gpart create -s GPT da0
gpart add -t freebsd-ufs da0
newfs -U da0[b]p1[/b]

You can see the partition table and names via gpart show da0
 
Back
Top