Using Solaris iSCSI target in VirtualBox iSCSI Initiator
Úterý IV 14, 2009
Once I don't have space on my notebook, so I try iSCSI support in non commercial version of VirtualBox. I connect my workstation and notebook with 1gbit Ethernet Crosovr cable and I use OpenSolaris on my workstation as iSCSI server and VirtualBox in Windows consume it as iSCSI client. It works quite well , it was stable and speedy.
This entry is part of Mastering Sun VirtualBox Workshop
<b>iSCSI target = Server side and iSCSI Initiator = Client side</b>
Creating iSCSI server side (target) on OpenSolaris
I use a server OpenSolaris based Storage Server with 3x 500GB data drives and 2GB of RAM
1. Find disks and be sure the they use same geometry
echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c4d0 <DEFAULT cyl 6077 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@e/ide@0/cmdk@0,0
1. c5d0 <drive type unknown>
/pci@0,0/pci-ide@e/ide@1/cmdk@0,0
2. c6d0 <drive type unknown>
/pci@0,0/pci-ide@f/ide@0/cmdk@0,0
3. c7d0 <drive type unknown>
/pci@0,0/pci-ide@f/ide@1/cmdk@0,0
Specify disk (enter its number): Specify disk
2. Create ZFS pool with 3 x 500GB drives
zpool create -f zfspool raidz c5d0 c6d0 c7d0
zpool list zfspool
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 1.36T 192K 1.36T 0% ONLINE -
zpool status zfspool
pool: zfspool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
c5d0 ONLINE 0 0 0
c6d0 ONLINE 0 0 0
c7d0 ONLINE 0 0 0
errors: No known data errors
3. Create ZFS Volume sized 15GB
zfs create -s -V 15gb -o shareiscsi=on zfspool/15gb_iscsitarget_1
4. Check if needed OpenSolaris services are installed and online
svcs -a | grep -i iscsi disabled 11:25:39 svc:/network/iscsi_initiator:default online 13:36:55 svc:/system/iscsitgt:default
5. Get iSCSI target IQN name
iscsitadm list target -v
iscsitadm list target -v
Target: zfspool/15gb_iscsitarget_1
iSCSI Name: iqn.1986-03.com.sun:02:df689c93-59e2-c99d-ff0e-9bb3a41db1d9
Alias: zfspool/15gb_iscsitarget_1
Connections: 0
ACL list:
TPGT list:
LUN information:
LUN: 0
GUID: 0
VID: SUN
PID: SOLARIS
Type: disk
Size: 15G
Backing store: /dev/zvol/rdsk/zfspool/15gb_iscsitarget_1
Status: online
6. Get ZFS variable on target
zfs get all zfspool/15gb_iscsitarget_1 NAME PROPERTY VALUE SOURCE zfspool/15gb_iscsitarget_1 type volume - zfspool/15gb_iscsitarget_1 creation Tue Jul 29 16:33 2008 - zfspool/15gb_iscsitarget_1 used 21.3K - zfspool/15gb_iscsitarget_1 available 913G - zfspool/15gb_iscsitarget_1 referenced 21.3K - zfspool/15gb_iscsitarget_1 compressratio 1.00x - zfspool/15gb_iscsitarget_1 reservation none default zfspool/15gb_iscsitarget_1 volsize 15G - zfspool/15gb_iscsitarget_1 volblocksize 8K - zfspool/15gb_iscsitarget_1 checksum on default zfspool/15gb_iscsitarget_1 compression off default zfspool/15gb_iscsitarget_1 readonly off default zfspool/15gb_iscsitarget_1 shareiscsi on local zfspool/15gb_iscsitarget_1 copies 1 default zfspool/15gb_iscsitarget_1 refreservation none default
7. Get IP addredd of iSCSI target
ifconfig -a | grep inet
inet 129.157.19.237 netmask fffffe00 broadcast 129.157.19.255
Unsing iSCSI server side (target) in VirtualBox
You need to use a binary , not open source version of VirtualBox
1. Add iSCSI target with build in VirtualBox iSCSI Initiator
VBoxManage addiscsidisk -server 129.157.19.237 -target iqn.1986-03.com.sun:02:df689c93-59e2-c99d-ff0e-9bb3a41db1d9 -comment "First iSCSI 15GB target"
Now you can see in VirtualBox Virtual Disk Manager disk with name IQN name
"iqn.1986-03.com.sun:02:df689c93-59e2-c99d-ff0e-9bb3a41db1d9",
but I didn't find there how to see there user friendly comment.
2. Now use attached disk for VM creation and OS install
3. You can monitor ZFs usage and performance with iostat command
zpool iostat -v 3 1000
capacity operations bandwidth
pool used avail read write read write
zfspool 3.79G 1.36T 3 42 25.1K 332K
raidz1 3.79G 1.36T 3 42 25.1K 332K
c5d0 - - 0 1 8.39K 166K
c6d0 - - 0 1 8.62K 166K
c7d0 - - 0 1 8.18K 166K
---------- ----- ----- ----- ----- ----- -----
zfspool 3.88G 1.36T 1.38K 0 11.1M 0
raidz1 3.88G 1.36T 1.38K 0 11.1M 0
c5d0 - - 329 0 3.87M 0
c6d0 - - 390 0 3.87M 0
c7d0 - - 350 0 3.33M 0
---------- ----- ----- ----- ----- ----- -----










