# fdisk class not found?



## fluca1978 (Jul 4, 2012)

Hi all,
adding a new disk to one of my boxes I did the following:


```
# dd if=/dev/zero of=/dev/ad4 bs=8192
# fdisk -BI ad4
# disklabel -w /dev/ad4s1
# newfs /dev/ad4s1a
```

The only thing is that fdisk claimed about _class not found_ but did the job anyway. I haven't found an explanation for this, any clue?


----------



## wblock@ (Jul 4, 2012)

I know I've seen it do that, but don't recall why, and I'm pretty sure it does not matter.

For the future:
Erasing a whole disk before use is not required.  If you want to do that with dd(1), a buffer size of 64k makes it go faster.
Plan on switching to gpart(8), which does everything fdisk(8) and bsdlabel(8) can do but a lot more also.
If the hard drive controller supports it, switching to AHCI gives a performance improvement, something like 10-20%.  Probably need FreeBSD 8 or 9 for that.
Using softupdates (-U) with newfs(8) can help performance also.


----------



## fluca1978 (Jul 5, 2012)

wblock@ said:
			
		

> I know I've seen it do that, but don't recall why, and I'm pretty sure it does not matter.



I dig a little into the sources and found that the error comes from geom_ctl.c and in particular:


```
static void                                                                                
g_ctl_req(void *arg, int flag __unused)                                                    
{                                                                                          
        struct g_class *mp;                                                                
        struct gctl_req *req;                                                              
        char const *verb;                                                                  
                                                                                           
        g_topology_assert();                                                               
        req = arg;                                                                         
        mp = gctl_get_class(req, "class");                                                 
        if (mp == NULL) {                                                                  
                gctl_error(req, "Class not found");                                        
                return;                                                                    
        }
```

I suspect, since the disk is not yet initialized, that geom is assuming a partition table is there and therefore it can be used as a provider while it is not. But this is just a guess.



			
				wblock@ said:
			
		

> For the future:
> Erasing a whole disk before use is not required.  If you want to do that with dd(1), a buffer size of 64k makes it go faster.



Yeah, I know, I was trying to see if erasing the disk was making the error disappear!



			
				wblock@ said:
			
		

> Plan on switching to gpart(8), which does everything fdisk(8) and bsdlabel(8) can do but a lot more also.
> If the hard drive controller supports it, switching to AHCI gives a performance improvement, something like 10-20%.  Probably need FreeBSD 8 or 9 for that.
> Using softupdates (-U) with newfs(8) can help performance also.



Thanks for the suggestion!


----------

