Page 1 of 1
VirtualBox and iSCSI disks
Posted: 21. Feb 2011, 11:15
by dgmad
Hello,
I'm playing with VirtualBox 4.0.4 and iSCSI virtual disks. I'm using ZFS as the backend iscsi targets and this works ok. I was able to create a zpool and export it as an iscsi target and successfully install linux on the virtual drive from the virtual box guest os.
However, i would like to be able to copy vdi image into a ZFS pool device and vice versa.
I tried something like 'dd if=/dev/zvol/rdsk/rpool/debianvm of=/deb.vdi' and then try to boot the deb.vdi but virtualbox is not happy about the format. I also tried the reverse as well and get a 'PBR bad Sig'.
What is the correct procedure for copying vdi images into a ZFS pool device (or extract the image from a ZFS pool device into a vdi image) ? Is it a subset of the image which needs to be copied from the device ?
many thanks,
Thierry.
Re: VirtualBox and iSCSI disks
Posted: 21. Feb 2011, 14:46
by kebabbert
I dont know, but maybe this text could help? You put your zone on iSCSI, and then you fire up VirtualBox in the Zone, and install windows in Virtualbox?
http://blogs.sun.com/JeffV/entry/zoit_s ... s_on_iscsi
Re: VirtualBox and iSCSI disks
Posted: 21. Feb 2011, 21:55
by dgmad
I tried a few more things:
i was able to convert a linux disk image into a vdi disk file using
VBoxManage convertfromraw -format VDI sda.img squeeze.vdi
and successfully boot up the VM.
however, if i try to dd the above working squeeze.vdi into an iscsi device, the corresponding VM with the iscsi drive does not boot anymore.
Thierry.
Re: VirtualBox and iSCSI disks
Posted: 22. Feb 2011, 11:56
by mpack
A VDI file is a not a dumb dd style image dump. It's more like a map of the drive contents. If you want to dd the drive contents you either have to use "VBoxManage clonehd --format RAW", or dd directly from drive to drive inside a guest.
Re: VirtualBox and iSCSI disks
Posted: 22. Feb 2011, 14:52
by dgmad
Yes i've realised that the vdi format is a container and is bit different.
I have created a working vdi image but i can't figure out how to make it work ok with an iscsi target. I tried to upload the vdi file to the iscsi target device but can't boot afterwards. Does the iscsi LUN has to be of exactly the same size as the vdi file image ? The ZFS pool i use for the iscsi target has to be a multiple of the zfs pool block size so it is difficult to match the size of the vdi file. Is there a trick i can use with virtualbox to overcome this ? Is there some kind of a partition table in the vdi container ? Can the LUN size be larger than the vdi file size image ?
Thierry.
Re: VirtualBox and iSCSI disks
Posted: 22. Feb 2011, 15:52
by mpack
A VDI is a simulation of HDD hardware. VirtualBox knows nothing about partitions, filesystems ZFS, NTFS, etc - just like your physical drive hardware doesn't. Those are all software features.
What you are attempting to do seems strange to me - copying one self contained drive image (presumably including guest partition map), onto part of another filesystem, and I'd have thought - an incompatible file system at that, though I don't know enough about ZFS to be sure.
One thing's for sure: VDI is a high level file format intended to be used by VirtualBox and other apps that understand its structure. If the target doesn't support VDI specifically then you are wasting your time.
Re: VirtualBox and iSCSI disks
Posted: 22. Feb 2011, 16:19
by dgmad
I'm just using ZFS as a nice and easy way to provision block devices and export them as iscsi targets which can be consumed by the virtual box iscsi initiator. A pool in ZFS has a corresponding block device which can be exported an an iscsi target.
The setup works nicely when installing linux manually from scratch in the guest OS relying on an iscsi virtual drive. I'm actually seeing the following when doing fdisk on the iscsi block device:
Total disk size is 512 cylinders
Cylinder size is 4096 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Linux native 0 463 464 91
2 EXT-DOS 464 511 48 9
What i'm trying to do is to automate the populating of the content of these iscsi virtual drive using a pre-created vdi image file.
It does work with dd on the iscsi block device provided it is the linux VM i installed manually. If i try to do the same on a vdi image created with vboxmanage convertfromraw then i can't boot.
Thierry.
Re: VirtualBox and iSCSI disks
Posted: 22. Feb 2011, 23:35
by dgmad
actually 'VBoxManage clonehd' could do the job if it was supporting iscsi drives as an output...
Re: VirtualBox and iSCSI disks
Posted: 23. Feb 2011, 14:46
by dgmad
I can see the disk geometry is hardcoded in the vdi file. I'm wondering whether i need to edit the vdi file to reflect the disk geometry in the vdi file. I've not seen any internalcommands to change these values.
Re: VirtualBox and iSCSI disks
Posted: 23. Feb 2011, 14:59
by mpack
dgmad wrote:I can see the disk geometry is hardcoded in the vdi file
The disk geometry is dictated by the size of the virtual HDD. You should not be editing it unless you are enlarging the virtual drive. Some guest OS's do reflect aspects of the drive geometry in their internal data structures, e.g. Windows stores a head count in its volume boot sectors. However this a legacy feature which becomes irrelevant for drives >8GB (because the head count maxes out).
Re: VirtualBox and iSCSI disks
Posted: 23. Feb 2011, 22:45
by dgmad
i managed to do it. actually, the iscsi disk is just the raw guest image and not the raw vdi.