Hire me if you like: blake.irvin@gmail.com

Tuesday, October 09, 2007

Connecting Linux (CentOS 5) to Solaris ZFS with iSCSI

Here's the command sequence I used (Note: I got kernel panics in CentOS talking to Solaris Nevada build 74. Solaris 10U4 worked properly).

On Solaris first:

root# zfs create shareiscsi=on [poolname]/[fsname]

root# iscsitadm list target

root# Target: [poolname]/[fsname]
iSCSI Name: iqn.1986-03.com.sun:02:af641712-82f5-665b-e537-cc6a07186f62
Connections: 0


So now I know the iqn of my iSCSI target.

I install iscsi-initiator-utils with this command on my CentOS client (initiator):

root# yum install iscsi-initiator-utils

and start iSCSI services

root# /etc/init.d/iscsi start

I then discover the Solaris/ZFS iSCSI target with these commands and start a session to it:

root# iscsiadm -m discovery -t st -p 192.168.0.86
root# iscsiadm -m node -T iqn.1986-03.com.sun:02:af641712-82f5-665b-e537-cc6a07186f62 -p 192.168.0.86:3260 --login


Note that the iqn will be different depending on the system you set up the target on. '-m' means 'mode', '-T' means 'targetname', '-t st' means 'type sendtarget', '-p' means 'portal, and '--login' is the actual command to connect to the iSCSI target.

I then check the output of dmesg on the CentOS box to see the device path of the new iSCSI device:

scsi1 : iSCSI Initiator over TCP/IP
Vendor: SUN Model: SOLARIS Rev: 1
Type: Direct-Access ANSI SCSI revision: 05
SCSI device sdb: 2097152 512-byte hdwr sectors (1074 MB)
sdb: Write Protect is off
sdb: Mode Sense: 67 00 00 08
SCSI device sdb: drive cache: write through
SCSI device sdb: 2097152 512-byte hdwr sectors (1074 MB)
sdb: Write Protect is off
sdb: Mode Sense: 67 00 00 08
SCSI device sdb: drive cache: write through
sdb: unknown partition table
sd 1:0:0:0: Attached scsi disk sdb
sd 1:0:0:0: Attached scsi generic sg1 type 0


I can now use whatever disk formatting tool I like to format the iSCIS device (in this case /dev/sdb and partition it. I can then mount it and begin using it for storage.

No comments:

Archive