ctld : LUN creation warning: error opening

Hello:


I want use ctld(8) to share a ZVOL as iSCSI target :

Code:
root@test:~ # cat /etc/ctl.conf 
portal-group pg0 {
    discovery-auth-group no-authentication
    listen 0.0.0.0
}
target iqn.2017-10.vhost:test {
    auth-group no-authentication
    portal-group pg0
    lun 0 {
        path /dev/zvol/pool/vol01
    }
}

I mount this target in Windows and format the whole disk to one NTFS partition and put some files on it, so far so good.


But after reboot :

Code:
ctld: LUN creation warning: error opening /dev/zvol/pool/vol01: 2

So I check :

Code:
root@test:/dev/zvol/pool # ll
total 0
crw-r-----  1 root  operator  0x6e Nov 21 16:27 vol01
crw-r-----  1 root  operator  0x6f Nov 21 16:27 vol01p1

root@test:/dev/zvol/pool # gdisk vol01
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk vol01: 4294967296 sectors, 2.0 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): CCA9B29E-BC36-43A5-B3B3-4175B109307D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 4294967262
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      4294965247   2.0 TiB     0700  Basic data partition

Command (? for help):

And if I use gdisk delete all partition and restart ctld(8), everything back to normal, but loop from step 1 .


What happen? The problem is in ZFS or ctld(8)?
 
How did you create the ZVOL?


Code:
zpool create pool raidz2 ada1 ada2 ada3 ada4
zfs create -V 1T pool/vol01

And now I try again with ESXi , Butstill go wrong and total same error message,Feels like once create and format the partition , ctld go wrong .
 
Set the volmode to "dev" to prevent geom trying to locally access the volume, thus preventing ctld from locking it. This also seems to be the culprit for some guests on zvols randomly freezing during disk I/O. I've never had any issues server-side though, but as this leads to a multitude of hairy problems with windows guests, make sure to set this property correctly.

On a storage server where volumes are never/rarely accessed locally, it may be wise to set vfs.zfs.vol.mode=2 in /boot/loader.conf. This sets the default behaviour of the system, so properties on all zvols can be left untouched. If zvols are backed up or send/received to other systems, setting the property directly may be the better choice.
 
Back
Top