VirtualBox How To Add iSCSI Storage using VBoxManage

#to show all
VBoxManage list vms

#show ONLY running vms

VBoxManage list runningvms


VBoxManage storageattach test --storagectl "SATA" --port 0 --device 0 --type hdd --medium iscsi --server 192.168.1.91 --target "iqn.2018-12.local.abcrandom.target:sdb" --initiator "iqn.1982-01.ca.bla.tld:abc123" --tport 3260 --lun 1
iSCSI disk created. UUID: 3bbdd942-f3b0-4bc9-8f22-b0118f6f11ec

--server = the IP address of the iSCSI target server

--target = the target on the iSCSI srever

--initiator = your initiator name (eg. the equivalent of /etc/iscsi/initiator.iscsi)

--lun 1 (or whatever LUN number

Troubleshooting

If the disk creates successfully but VBox says it is inacessible it means you have probably specified something wrong in the flags above.  Eg. a typo in your target, initiator, forgetting your LUN

UUID Already Exists

VBoxManage storageattach test --storagectl "SATA" --port 0 --device 0 --type hdd --medium iscsi --server 192.168.1.91 --target "iqn.1982-01.ca.bla.tld:abc123"
VBoxManage: error: Cannot register the hard disk '192.168.1.91|iqn.1982-01.ca.bla.tld:abc123' {16b201f8-da53-499c-86ec-753a8b940e58} because a hard disk '192.168.1.91|iqn.1982-01.ca.bla.tld:abc123' with UUID {8cd2dd6e-9b69-488c-81f6-22fa96da0a2f} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "CreateMedium(Bstr("iSCSI").raw(), bstrISCSIMedium.raw(), AccessMode_ReadWrite, DeviceType_HardDisk, pMedium2Mount.asOutParam())" at line 608 of file VBoxManageStorageController.cpp

#list all hdds

 

vboxmanage list hdds

UUID:           8cd2dd6e-9b69-488c-81f6-22fa96da0a2f
Parent UUID:    base
State:          inaccessible
Type:           normal (base)
Location:       192.168.1.91|iqn.1982-01.ca.bla.tld:abc123
Storage format: iSCSI
Capacity:       0 MBytes
Encryption:     disabled



#let's delete it

vboxmanage closemedium disk 8cd2dd6e-9b69-488c-81f6-22fa96da0a2f --delete

#uh oh iSCSI disks can't be deleted this way

vboxmanage closemedium disk 8cd2dd6e-9b69-488c-81f6-22fa96da0a2f --delete
VBoxManage: error: Medium format 'iSCSI' does not support storage deletion
VBoxManage: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "DeleteStorage(pProgress.asOutParam())" at line 1603 of file VBoxManageDisk.cpp
VBoxManage: error: Failed to delete medium. Error code Unknown Status -2135228407 (0x80bb0009)

Sometimes just using closemedium before works:


vboxmanage closemedium disk 8cd2dd6e-9b69-488c-81f6-22fa96da0a2f

Either way after the above you should be able to retry to connect your iSCSI disk


Tags:

virtualbox, iscsi, vboxmanage, vms, runningvms, storageattach, storagectl, quot, sata, hdd, medium, server, iqn, abcrandom, sdb, initiator, ca, bla, tld, abc, tport, lun, disk, uuid, bbdd, bc, ec, ip, srever, eg, equivalent, etc,

Latest Articles

  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide
  • Abusive IP ranges blacklist