VirtualBox: How to work with ISCSI disks

root's picture

In below example, we are attaching an ISCSI disk to VM via VirtalBox.
Of course, you can also attach it directly from the VM if the OS supports it but this is not covered here.

How to add ISCI disk to a virtual machine in VirtualBOX:

vbox@core:~$ VBoxManage storageattach test --storagectl "SATA" --port 1 --type hdd --medium iscsi --server 192.168.69.5 --target "iqn.2014-07.ro.gz.sun:vbox-test-rootvg" --username USER --password PASS
iSCSI disk created. UUID: b30deer1-98sd-p2ue-gks6-289dwsld27sh

How to list ISCSI and other disks attached to a VM:

vbox@core:~$ vboxmanage showvminfo test | grep SATA
Storage Controller Name (0):            SATA
SATA (0, 0): /home/vbox/.VirtualBox/preprod/test/test.vdi (UUID: s9sspw8e-8we9-2nds-29832-98wlemwdjwe)
SATA (1, 0): 192.168.69.5|iqn.2014-07.ro.gz.sun:vbox-test-rootvg (UUID: b30deer1-98sd-p2ue-gks6-289dwsld27sh)

How to get information about ISCI disk in VirtualBox:

vbox@core:~$ vboxmanage showhdinfo b30deer1-98sd-p2ue-gks6-289dwsld27sh
UUID:           b30deer1-98sd-p2ue-gks6-289dwsld27sh
Parent UUID:    base
State:          locked write
Type:           normal (base)
Location:       192.168.69.5|iqn.2014-07.ro.gz.sun:vbox-test-rootvg
Storage format: iSCSI
Format variant: fixed default
Capacity:       20480 MBytes
Size on disk:   20480 MBytes
Property:       HostIPStack=
Property:       InitiatorName=
Property:       InitiatorSecret=USER
Property:       InitiatorUsername=PASS
Property:       LUN=
Property:       TargetAddress=192.168.69.5
Property:       TargetName=iqn.2014-07.ro.gz.sun:vbox-test-rootvg
Property:       TargetSecret=
Property:       TargetUsername=
Property:       Timeout=
Property:       WriteSplit=
In use by VMs:  test (UUID: 90s8dldhd-2872-8sd9-sid8-889sms00sod)

How to remove ISCSI disk from VirtualBox VM:

vbox@core:~$ vbm showvminfo test | grep -i ^SATA
SATA (0, 0): /home/vbox/.VirtualBox/preprod/test/test.vdi (UUID: s9sspw8e-8we9-2nds-29832-98wlemwdjwe)
SATA (1, 0): 192.168.69.5|iqn.2014-07.ro.gz.sun:vbox-test-rootvg (UUID: b30deer1-98sd-p2ue-gks6-289dwsld27sh)

vbox@core:~$ [color=green]VBoxManage storageattach test --storagectl SATA --port 1 --medium none[/color]

vbox@core:~$ vbm showvminfo test | grep -i ^SATA
SATA (0, 0): /home/vbox/.VirtualBox/preprod/test/test.vdi (UUID: s9sspw8e-8we9-2nds-29832-98wlemwdjwe)

How to remove ISCSI disk from VirtualBox itself:

vbox@core:~$ VBoxManage closemedium disk b30deer1-98sd-p2ue-gks6-289dwsld27sh
vbox@core:~$

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content