Hello, I'm trying to configure a iSCSI target on a NetBSD 9.0. I have added a new disk in my NIS/NFS server that appears as /dev/rwd0.
legendre# fdisk /dev/wd0 Disk: /dev/wd0d NetBSD disklabel disk geometry: cylinders: 310101, heads: 16, sectors/track: 63 (1008 sectors/cylinder) total sectors: 312581808, bytes/sector: 512 BIOS disk geometry: cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder) total sectors: 312581808 Partitions aligned to 16065 sector boundaries, offset 63 Partition table: 0: NetBSD (sysid 169) start 63, size 312581745 (152628 MB, Cyls 0-19457/80/63) PBR is not bootable: All bytes are identical (0x00) 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> No active partition. Drive serial number: 1696063557 (0x6517e045) legendre# disklabel /dev/rwd0 # /dev/rwd0d: type: ESDI disk: wd0 label: fictitious flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 16 sectors/cylinder: 1008 cylinders: 310101 total sectors: 312581808 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 5 partitions: # size offset fstype [fsize bsize cpg/sgs] c: 312581745 63 unused 0 0 # (Cyl. 0*- 310100) d: 312581808 0 unused 0 0 # (Cyl. 0 - 310100) e: 65536000 63 swap # (Cyl. 0*- 65015*) legendre# I want to only export /dev/wd0e. Thus, I have written in /etc/iscsi/targets : # extent file or device start length extent0 /dev/rwd0e 0 32000MB # target flags storage netmask target0 rw extent0 192.168.10.103/32 and restarted iscsid : Starting iscsi_target. Reading configuration from `/etc/iscsi/targets' target0:rw:192.168.10.103/32 extent0:/dev/rwd0e:0:33554432000 DISK: 1 logical unit (65536000 blocks, 512 bytes/block), type iscsi fs DISK: LUN 0: 32000 MB disk storage for "target0" TARGET: iSCSI Qualified Name (IQN) is iqn.1994-04.org.netbsd.iscsi-target On client side (Linux debian) : iscsiadm --mode node --targetname iqn.1994-04.org.netbsd.iscsi-target:target0 --portal 192.168.10.128 --login and I obtain in dmesg : [11435.508280] scsi host6: iSCSI Initiator over TCP/IP [11435.517173] scsi 6:0:0:0: Direct-Access NetBSD NetBSD iSCSI 0 PQ: 0 ANSI: 3 [11435.517315] sd 6:0:0:0: Attached scsi generic sg1 type 0 [11435.517709] sd 6:0:0:0: [sdb] 65536000 512-byte logical blocks: (33.6 GB/31.3 GiB) [11435.517825] sd 6:0:0:0: [sdb] Write Protect is off [11435.517828] sd 6:0:0:0: [sdb] Mode Sense: 0e 00 00 08 [11435.518042] sd 6:0:0:0: [sdb] Incomplete mode parameter data [11435.518046] sd 6:0:0:0: [sdb] Assuming drive cache: write through [11435.722414] sd 6:0:0:0: [sdb] Attached SCSI disk But mkswap does't run as expected : root@hilbert:/etc/iscsi/nodes# mkswap /dev/sdb mkswap: /dev/sdb: warning: wiping old ext2 signature. Setting up swapspace version 1, size = 31,3 GiB (33554427904 bytes) no label, UUID=1573d8e2-4479-47fa-a1a2-b2398c8390c1 mkswap: write failed: Erreur d'entrée/sortie and fdisk returns : root@hilbert:/etc/iscsi/nodes# fdisk /dev/sdb Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sdb: 31,26 GiB, 33554432000 bytes, 65536000 sectors Disk model: NetBSD iSCSI Geometry: 16 heads, 63 sectors/track, 310101 cylinders Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: bsd Slice Start End Sectors Size Type Fsize Bsize Cpg c 63 312581807 312581745 149,1G unused 0 0 0 d 0 312581807 312581808 149,1G unused 0 0 0 e 63 65536062 65536000 31,3G swap 0 0 0 Partition table entries are not in disk order. Command (m for help): I don't understand why whole disk seems to be accessible and why /var/log/syslog contains : [11732.405047] connection4:0: Got CHECK_CONDITION but invalid data buffer size of 0 [11732.405060] sd 6:0:0:0: [sdb] tag#28 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [11732.405066] sd 6:0:0:0: [sdb] tag#28 CDB: Write(10) 2a 00 00 00 00 00 00 00 08 00 [11732.405069] print_req_error: I/O error, dev sdb, sector 0 [11732.405072] Buffer I/O error on dev sdb, logical block 0, lost async page write [11732.439371] connection4:0: Got CHECK_CONDITION but invalid data buffer size of 0 [11732.439382] sd 6:0:0:0: [sdb] tag#57 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK [11732.439387] sd 6:0:0:0: [sdb] tag#57 CDB: Write(10) 2a 00 00 00 00 00 00 00 08 00 [11732.439390] print_req_error: I/O error, dev sdb, sector 0 [11732.439393] Buffer I/O error on dev sdb, logical block 0, lost async page write Any idea ? Best regards, JKB