# Cannot reformat RAID array : But can mount ro



## ghostcorps (Dec 9, 2010)

Hi Guys

 I recently had my RAID5/0 array (8x500g SATAII) corrupted after a blackout. I can not fsck or fsck_ffs it but I can still mount it Read-only so I have managed to back it up. Most worrying is that I can not seem to get it to reformat.

 Sysinstall via the LiveFS looks like it works, but the changes are never written once I exit out.

 I tried the fdisk method here but when I try to initialize at step 2 it I get this:


```
#fdisk -BI da2
******* Working on device /dev/da2 ******
fdisk: invalid fdisk partition table found
fdisk: Class not found
```

 I even tried deleting and recreating the array in the RAID controller BIOS, that looked like it worked as the partition was removed from /dev but after recreating the partition in sysinstall the previous corrupted fs was still intact! 

Google is not bringing up anything useful on these errors. Are there any more forceful methods I can try?


----------



## ghostcorps (Dec 10, 2010)

I'm glad I'm not the only person who is stumped here! 

I'm thinking of trying a live Linux flavour just to write zeros of something.. any ideas


----------



## ghostcorps (Dec 16, 2010)

I have tried Helix and the standard Debian Live CDs but neither have the hptrr drivers so I didn't get very far with those.

 I tried using the windows 7 install disk utilities to recreate the partition, but didn't continue the install after this, reasoning that windows repartitioning of the disk would have done something. Now the old partition is still visible, mountable ro only, and it shows that the old data is still there but when I browse to the disk there is nothing visible. At least something has changed but the disk is still unusable.

I'm not sure if I have posted in the wrong forum, if I have-can someone please send me to the right place. Or else make some kind of suggestion? 

Thanks


----------



## AndyUKG (Dec 16, 2010)

Without having an idea of why fdisk won't work etc, something else you could try instead is gpart...


----------



## ghostcorps (Dec 17, 2010)

Thanks

I will give that a go


----------



## ghostcorps (Dec 17, 2010)

I'm having some trouble figuring out what gpart wans me to do. This is what I have done so far:

First I deleted the partition da2p1:


```
#gpart delete -i 1 da2
```

Then Destroyed the Scheme:


```
#gpart destroy da2
```

Then created the scheme again:


```
# gpart create -s gpt da2
```

Up to here everything is sweet...

and gpart shows this:

```
#gpart show
=>        34  5859704765  da2  GPT  (2.7T)
          34  5859704765       - free -  (2.7T)
```


Now I am trying to create the partition and can not quite get it to work...


fdisk reports the geometry as:

```
364749/255/63
```



Using these numbers I have tried:


```
# gpart add -b 63 -s 5859692622 -t gpt -i 1 da2
```

But I get 'Invalid Argument' ... 


What is wrong with my arguments? It all seems to meet the requirements doesn't it?


----------



## AndyUKG (Dec 17, 2010)

I think your "-t" argument is invalid, valid types are shown in the gpart man page. I guess you are going to want freebsd or freebsd-ufs, check out the descriptions in the man page...


----------



## ghostcorps (Dec 19, 2010)

Thanks again Andy,

 Using 'freebsd' or 'freebsd-ufs' creats the partition but it doesn't mount:


```
# gpart create -s gpt da2
# gpart add -t freebsd da2
# gpart show

=>        34  5859704765  da2  GPT  (2.7T)
          34  5859704765    1  freebsd  (2.7T)
```




```
bsd# mount /dev/da2s1 /media
mount: /dev/da2s1 : Operation not permitted
```

Even with -t ufs 




 Thanks again for all your help.


----------



## AndyUKG (Dec 20, 2010)

ghostcorps said:
			
		

> Using 'freebsd' or 'freebsd-ufs' creats the partition but it doesn't mount:
> 
> 
> ```
> ...



You still need to format the partition  If you're sure you are done recovering data from the RAID then you need to "newfs" the partition you created with gpart.


----------



## ghostcorps (Dec 20, 2010)

AndyUKG said:
			
		

> You still need to format the partition  If you're sure you are done recovering data from the RAID then you need to "newfs" the partition you created with gpart.



I've tried that too... 



```
newfs -L media -U /dev/da2p1
newfs: /dev/da2p1: failed to open disk for writing
```

btw: I definitely have root.


----------



## graudeejs (Dec 20, 2010)

Hi 
Try formating it from single user mode, or even better from fixit cd/dvd 
If that doesn't work, then it's hardware problem


----------



## ghostcorps (Dec 21, 2010)

Hi again Killasmurf 

As I just posted in the other thread, Highpoint have advised me that their RAID management software isn't compatible with 8.1, so I figure the RAID5 array is not being initialised. I'll see how a JBOD goes, and if not I'll try fixit tonight, and get back to you, I have to go to work now.

Thanks for your persistence guys, I feel a bit better knowing it wasn't all to do with my incompetency's


----------



## ghostcorps (Dec 21, 2010)

I've ssh'd from work, but the JBOD was a no go either.

 I do have a workaround in mind (more of a f#&k around)... since I can still boot off my 7.0 install :stud I will use it to initialize the array then go back into 8.1 and see if I can then build the fs. If not... I guess I will have to downgrade to 8.0.  


 Results to follow tomorrow.


----------



## ghostcorps (Dec 22, 2010)

Finally!

 Thanks for all your help guys.

 In the end, I needed to boot into 7.0 to access the RAID management services to initialize the array, and then boot into the 8.1 Live cd to build the partition with gpart and the filesystem with newfs.

 Hopefully in a few months this won't be necessary, once highpoint update the software.


Thanks again


----------



## danbi (Dec 22, 2010)

Just curious, wouldn't the RAID BIOS  let you initialize the array? Or perhaps has an option for 'quick initialize' or such -- so to avoid relying on any OS tools that have to interact with the controller.


----------



## ghostcorps (Dec 23, 2010)

Hi Danbi

 That would make sense... and the RAID BIOS does have a 'background initialize' option, which I was using thinking that that was all that was needed to finalise the creation of an array. However, during the above adventure I reread the documentation and noted that it said that the array must be initialized within the RAID management software, the background initialization option in the BIOS simply sets it up so that the management software initializes the array upon the first boot. Without the compatible software, the initialization was never actually started.


----------

