At first I will show you, how to do a really simple iSCSI configuration. This is without any authentication. Thus everybody can connect to the iSCSI targets on the system. But this is sufficient for a test. And itīs this is better for having a quick success.
Environment
For this example, i will use my both demo VMs again:
10.211.55.200 theoden
10.211.55.201 gandalf
Both systems runs with Solaris Express Build 84 for x86, but you can to the same with Solaris Update 4 for SPARC and x86 as well.
In our example, theoden is the server with the iSCSI target. gandalf is the server, which wants to use the the LUN via iSCSI on theoden, thus gandalf is the server with the initiator.
Prerequisites
At first, we login to theoden and assume root privileges. Okay, to test iSCSI we need some storage volumes to play around. There is a nice way to create a playground with ZFS. You can use files as devices. But at first we have to create this files
# mkdir /zfstest
# cd /zfstest
# mkfile 128m test1
# mkfile 128m test2
# mkfile 128m test3
# mkfile 128m test4
Okay, now we stripe those four files in a zpool:
# zpool create testpool /zfstest/test1 /zfstest/test2 /zfstest/test3 /zfstest/test4
Now we make a short check for the zpool
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
testpool 492M 97K 492M 0% ONLINE -
Configuring the iSCSI Target
We stay at server theoden. Okay, now we have to configure an iSCSI target. We create an emulated volume within the zfspool:
# zfs create -V 200m testpool/zfsvolume
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
testpool 200M 260M 18K /testpool
testpool/zfsvolume 200M 460M 16K -
The emulated volume has the size of 200M.Okay, itīs really easy to enable the iSCSI target. At first we have to enable the iSCSI Target service:
# svcadm enable iscsitgt
Now we share the volume via iSCSI
# zfs set shareiscsi=on testpool/zfsvolume
Thatīs all on the target
Configuring the iSCSI initiator
Okay, now we have configure the initiator. We have to login on
gandalf and assume root privileges as well. At first we have to activate the initiator via SMF:
# svcadm enable iscsi_initiator
After this we configure the initiator and tell the initiator to discover devices on our iSCSI target.
# iscsiadm modify initiator-node -A gandalf
# iscsiadm add discovery-address 10.211.55.200
# iscsiadm modify discovery -t enable
Using the iSCSI device
Okay, now tell Solaris to scan for iSCSI devices.
# devfsadm -c iscsi
The
-c iscsi limits the scan to iSCSI devices. With the format command we look for the available disks in the system:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0
/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0
1. c1d0
/pci@0,0/pci-ide@1f,1/ide@1/cmdk@0,0
2. c2t0100001C42E9F21A00002A0047E39E34d0
/scsi_vhci/disk@g0100001c42e9f21a00002a0047e39e34
Specify disk (enter its number): ^C
Okay, there is new device with a really long name. We can use this device for a zfs pool:
# zpool create zfsviaiscsi c2t0100001C42E9F21A00002A0047E39E34d0
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfsviaiscsi 187M 480K 187M 0% ONLINE -
#
As you see, we have created a zfs filesystem via iSCSI on an emulated volume on a zpool on a remote system.
I wrote about iSCSI quite often in the last time. But how can you use it in Solaris. I wrote a short introduction about the usage of the iSCSI implementation of Solaris:Introduction Basic iSCSI Bidirectional authenticated iSCSI Alternative backing stor
Tracked: Mar 22, 12:33
Tracked: Apr 15, 14:02