# zpool create <pool> drives fails



## ServerStorm (Aug 20, 2010)

Hi 

When I attempt to create a zfs pool I get "permission denied".

If I try a simple 
	
	



```
zpool create mypool ad10
```
 I get 
	
	



```
cannot create 'mypool': permission denied
```

The same is true if I try something like the following: 
	
	



```
zpool create mypool raidz ad4 ad6 ad8
```

I initially formatted these drives (ad4, ad6, ad8, and ad10) as UFS and then tried to issue the create pool.

I can see all the drives:
	
	



```
atacontrol list
ATA channel 0:
    Master:  ad0 <SAMSUNG HM160HC/LQ100-10> ATA/ATAPI revision 8
    Slave:  acd0 <CD-224E-R/1.CA> ATA/ATAPI revision 5
ATA channel 1:
    Master:      no device present
    Slave:       no device present
ATA channel 2:
    Master:  ad4 <WDC WD20EARS-00MVWB0/50.0AB50> SATA revision 2.x
    Slave:       no device present
ATA channel 3:
    Master:  ad6 <WDC WD20EARS-00MVWB0/50.0AB50> SATA revision 2.x
    Slave:       no device present
ATA channel 4:
    Master:  ad8 <WDC WD20EARS-00MVWB0/50.0AB50> SATA revision 2.x
    Slave:       no device present
ATA channel 5:
    Master: ad10 <WDC WD20EARS-00MVWB0/50.0AB50> SATA revision 2.x
    Slave:       no device present
```

When looking at fstab I see only one of these devices, which could be part of the problem although I do not know enough about how zpool works to know if it needs or automatically create an entry in fstab?
	
	



```
cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0s1a             /       ufs     rw              1       1
```

ad0 is where the O.S. is located.


Given this information do you see why 'zpool create mypool ad10' shows permission denied? Is this a File System permission issue or something else? Please help if you can.

Regards,
Steve


----------



## phoenix (Aug 20, 2010)

First, are you root?

Second, because you have partitioned/formatted the disks already, you may need to disable the safety features of GEOM:  `# sysctl -w kern.geom.debugflags=17`

After that, you can try the zpool create commands.


----------



## ServerStorm (Aug 20, 2010)

Hi phoenix,



> `# sysctl -w kern.geom.debugflags=17`


 Thank you! this did make the difference. I was able to create the pool without any issues:

```
zpool create MainRepo raidz ad4 ad6 ad8
```


```
zpool list
NAME       SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
MainRepo  5.46T   150K  5.46T     0%  ONLINE  -
```

Can you recommend a good resource that I could use to read more about the permissions/security structures of zfs? 

Thanks again,
Steve


----------



## ServerStorm (Aug 20, 2010)

Hi 

I restarted my Server and tested if I could still create a pool and upon restart and I need to redo the:

```
sysctl -w kern.geom.debugflags=17
```
 then it would again allow creation of a pool. Is there a way to permanently set this kernel geometry debug flag?

Regards,
Steve


----------



## DutchDaemon (Aug 20, 2010)

sysctl.conf(5) (do note the BUGS comment).

Side note: sysctl's -w is deprecated. You can change a sysctl without it.


----------



## phoenix (Aug 20, 2010)

Note:  you only need to set this flag when modifying drives that GEOM knows about (ie have been partitioned, or formatted, or labelled).  For working with new drives, or with drives where you have manually zeroed out the first and last MB of the disk, this sysctl is not needed.

IOW, you really don't want to set this in /etc/sysctl.conf.


----------



## gkontos (Aug 20, 2010)

Just a quick advice. It is always a good idea to start by labeling your disks before you add them to a pool. The reason for this is that it makes disk management easier in case of a disk replacement. I would start by completely destroying any existing partitions:

```
gpart destroy ad4 (ad6, ad8)
```
Then I would label my disks:

```
glabel label -v disk1 /dev/ad4
glabel label -v disk2 /dev/ad6
glabel label -v disk3 /dev/ad8
```
After that I would create the pool:

```
zpool create tank raidz1 label/disk1 label/dik2 label/disk3
```
That would give me something like the following:

```
pool: tank
 state: ONLINE
 scrub: scrub completed after 1h46m with 0 errors on Tue Aug 17 03:21:46 2010
config:

	NAME              STATE     READ WRITE CKSUM
	tank              ONLINE       0     0     0
	  raidz1          ONLINE       0     0     0
	    label/zdisk1  ONLINE       0     0     0
	    label/zdisk2  ONLINE       0     0     0
	    label/zdisk3  ONLINE       0     0     0

errors: No known data errors
```

George


----------



## ServerStorm (Aug 25, 2010)

Thanks for the link DutchDaemon it was informative.



			
				DutchDaemon said:
			
		

> sysctl.conf(5) (do note the BUGS comment).
> 
> Side note: sysctl's -w is deprecated. You can change a sysctl without it.


----------



## ServerStorm (Aug 25, 2010)

Phoenix,
Being new to this, the tip of when or when not to use w is helpful.



			
				phoenix said:
			
		

> Note:  you only need to set this flag when modifying drives that GEOM knows about (ie have been partitioned, or formatted, or labelled).  For working with new drives, or with drives where you have manually zeroed out the first and last MB of the disk, this sysctl is not needed.
> 
> IOW, you really don't want to set this in /etc/sysctl.conf.



Thank you.
Steve


----------



## ServerStorm (Aug 25, 2010)

Hi George,

Thanks for the details and advice. 



			
				gkontos said:
			
		

> Just a quick advice. It is always a good idea to start by labeling your disks before you add them to a pool. The reason for this is that it makes disk management easier in case of a disk replacement. I would start by completely destroying any existing partitions:...



I did destroy my partitions and used your recommendation. It works much better, so thanks!

Regards,
Steve


----------

