ReadOnly iSCSI disk with Virtualbox?

John jwd at FreeBSD.org
Mon Feb 18 03:35:19 UTC 2013


Hi Folks,

   I've been using VB with iSCSI disks hosted on a FreeBSD system
using istgt for a while with no problems. The system hosting
VB is fbsd9.1.

   Recently I wanted to use a single zvol and export it to 100+
VB systems in ReadOnly mode. The OS on the way up recognizes the
hd is R/O and mounts a tmpfs filesystem for those areas that need
it. My thoughts on enforcing the ReadOnly disk:

1. Attach the iSCSI drive with "--mtype readonly"
2. Export the zvol with the istgt option "ReadOnly Yes"

   Unfortunately, neither of the above work. #1 fails to attach
the disk to the VM:

   VBoxManage storageattach $vmname --storagectl "SATA Controller"                  \
                                    --type      hdd                                 \
                                    --port      $devport --device 0                 \
                                    --medium    iscsi                               \
                                    --server    $ip                                 \
                                    --tport     $port                               \
                                    --target    $iqn                                \
                                    --mtype     shareable                           \
                                    --initiator $initiator

VBoxManage: error: Cannot change type for medium '192.168.22.231|iqn.2012-02.com.example:jwd1:1' to 'Readonly' since it is a hard disk
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Medium, interface IMedium, callee nsISupports
VBoxManage: error: Context: "COMSETTER(Type)(mediumType)" at line 678 of file VBoxManageStorageController.cpp
VBoxManage: error: Failed to set the medium type


   The #2 option also fails:

The attach of the hard drive succeeds, the failure occurs when the
virtual machine is started:

VBoxHeadless --startvm jwd1
...
Error: failed to start machine. Error message: VD: error VERR_VD_IMAGE_READ_ONLY opening image file '172.21.22.231|iqn.2012-02.com.sas.unx:jwd1:1' (VERR_VD_IMAGE_READ_ONLY).
Failed to open image '172.21.22.231|iqn.2012-02.com.sas.unx:jwd1:1' in read-write mode rc=VERR_VD_IMAGE_READ_ONLY (VERR_VD_IMAGE_READ_ONLY).
Failed to attach driver below us! Image is read-only. (VERR_VD_IMAGE_READ_ONLY).
AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY)


   Has anyone else tried doing this and/or have a different of
approaching the problem? Or, do I need to start patching code?

   Any thoughts are appreciated.

Thanks,
John




More information about the freebsd-virtualization mailing list