Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 28 December 2014

ZFS as iscsi


ZFS AS iSCSI TARGET

Well,
This is very interesting that we can use our zfs system as iscsi server

I had just created a 100m zfs FS for iscsi testing

root@sol-test-1:>/# zfs create -V 100M zm1/scsivol2

root@sol-test-1:>/# zfs share zm1/scsivol2
cannot share 'zm1/scsivol2': 'shareiscsi' property not set
set 'shareiscsi' property or use iscsitadm(1M) to share this volume

root@sol-test-1:>/# zfs set shareiscsi=on zm1/scsivol2

root@sol-test-1:>/# iscsitadm list target
Target: zm1/scsivol1
    iSCSI Name: iqn.1986-03.com.sun:02:0cb119eb-b98c-65cf-ba18-e0c73e04f59b
    Connections: 1
Target: zm1/scsivol2
    iSCSI Name: iqn.1986-03.com.sun:02:bd7db28b-f6b6-c17c-ba98-856ee23e32b3
    Connections: 0

NOW ON OTHER SYSTEM,

root@sol-tst-2:>/# svcadm enable iscsitgt

root@sol-tst-2:>/# iscsiadm add static-config iqn.1986-03.com.sun:02:0cb119eb-b98c-65cf-ba18-e0c73e04f59b,192.168.234.133:3260

root@sol-tst-2:>/# iscsiadm add static-config iqn.1986-03.com.sun:02:bd7db28b-f6b6-c17c-ba98-856ee23e32b3,192.168.234.133:3260

root@sol-tst-2:>/# iscsiadm list static-config
Static Configuration Target: iqn.1986-03.com.sun:02:0cb119eb-b98c-65cf-ba18-e0c73e04f59b,192.168.234.133:3260
Static Configuration Target: iqn.1986-03.com.sun:02:bd7db28b-f6b6-c17c-ba98-856ee23e32b3,192.168.234.133:3260

root@sol-tst-2:>/# devfsadm

root@sol-tst-2:>/# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@0,0
       1. c1t1d0 <DEFAULT cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@1,0
       2. c1t2d0 <DEFAULT cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@2,0
       3. c1t3d0 <DEFAULT cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@3,0
       4. c2t600144F0549411B700000C295EB26000d0 <DEFAULT cyl 97 alt 2 hd 64 sec 32>
          /scsi_vhci/disk@g600144f0549411b700000c295eb26000
       5. c2t600144F05494136700000C295EB26000d0 <DEFAULT cyl 97 alt 2 hd 64 sec 32>
          /scsi_vhci/disk@g600144f05494136700000c295eb26000
Specify disk (enter its number):4

selecting c2t600144F0549411B700000C295EB26000d0
[disk formatted]


FORMAT MENU:
        disk       - select a disk

        [………….]

        !<cmd>     - execute <cmd>, then return
        quit
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
y
format> p


PARTITION MENU:
0           - change `0' partition

        [………………]

        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 96 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders      Size            Blocks
  0 unassigned    wm       0             0         (0/0/0)       0
  1 unassigned    wm       0             0         (0/0/0)       0
  2     backup    wu       0 - 95       96.00MB    (96/0/0) 196608
  3 unassigned    wm       0             0         (0/0/0)       0
  4 unassigned    wm       0             0         (0/0/0)       0
  5 unassigned    wm       0             0         (0/0/0)       0
  6 unassigned    wm       0             0         (0/0/0)       0
  7 unassigned    wm       0             0         (0/0/0)       0
  8       boot    wu       0 -  0        1.00MB    (1/0/0)    2048
  9 unassigned    wm       0             0         (0/0/0)       0


partition>

1 comment: