Virtual Guru's Blog – Home of Virtualization Workshops

April 14, 2009

Using Solaris iSCSI target in VirtualBox iSCSI Initiator

Filed under: iscsi, opensolaris, virtualbox, Virtualization — natiku @ 7:00 am

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

;iSCSI target = Server side and iSCSI Initiator = Client side;

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
0. c4d0 <DEFAULT cyl 6077 alt 2 hd 255 sec 63>
1. c5d0 <drive type unknown>
2. c6d0 <drive type unknown>
3. c7d0 <drive type unknown>
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
zfspool  1.36T   192K  1.36T     0%  ONLINE  -
zpool status zfspool
pool: zfspool
state: ONLINE
scrub: none requested
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:
Alias: zfspool/15gb_iscsitarget_1
Connections: 0
ACL list:
TPGT list:
LUN information:
LUN: 0
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 netmask fffffe00 broadcast

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  -target -comment "First iSCSI 15GB target"

Now you can see in VirtualBox Virtual Disk Manager disk with name IQN name
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
----------  -----  -----  -----  -----  -----  -----


  1. […] Using Solaris iSCSI target in VirtualBox iSCSI Initiator […]

    Pingback by NAS storage server in OpenSolaris JeOS Prototype « Virtual Guru's Blog – Home of Virtualization Workshops — February 7, 2010 @ 5:38 pm

  2. […] Using Solaris iSCSI target in VirtualBox iSCSI Initiator […]

    Pingback by Mastering Sun VirtualBox « Virtual Guru's Blog – Home of Virtualization Workshops — February 7, 2010 @ 5:56 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: