Local snapshots with iSCSI disks do not appear to work

This is for discussing general topics about how to use VirtualBox.
Post Reply
kveroneau
Posts: 15
Joined: 19. Jan 2014, 00:01

Local snapshots with iSCSI disks do not appear to work

Post by kveroneau »

I was recently on the IRC channel to bring up a potential bug with differential images on iSCSI remote disks.

To test, create an iSCSI target on your SAN/NAS or use tgt under Linux to share a LVM disk over iSCSI.

Create a VM, preferably with an OS which can be quickly tested to confirm write issues such as FreeDOS, then attach iSCSI using the following command:

Code: Select all

VBoxManage storageattach "FreeDOS" --storagectl "IDE" --port 0 --device 0 --type hdd --medium iscsi --server san.local --target "iqn.2018-01.veroneau.net:vm.freedos" --tport 3260 --lun 1 --mtype multiattach
Note, the --mtype being set to "multiattach", now start the VM. You will notice that it starts with no issues, and if no disk writes are needed, you should be at the typical DOS prompt. Run a text editor and try to create a file. In my case I used MS-DOS Edit. Write something random, and hit "Alt-F-S". You should now notice in the status bar "Saving...", and the hard disk indicator in VirtualBox remains a constant "Amber". You can still use the various menus and such within the VirtualBox window, but if you try and close the window, the process will hang and will need to be force quit.

If you search the machine's usual snapshot directory, you will see a fresh 2.0M differential VDI image sitting there with nothing written to it. The VirtualBox log for the VM does not say anything helpful about it having trouble to write to the snapshot as it should be expected.

The idea behind doing this, is to have a central repository of disk images shared through iSCSI on a SAN, and various workstations can use these disk images over the network, but their specific changes are stored locally on their workstation in the VirtualBox snapshot directory.

I am planning on testing a VBox snapshot while using a read-write iSCSI disk on the SAN to see if any snapshot support is even working for iSCSI disks. I will update this post with those results shortly, as that will be a workaround, but if a snapshot isn't made before booting the VM, then it compromises the original iSCSI disk image.

Update as promised: I made the iSCSI disk read-write, and created a snapshot before booting the VM within the VBox GUI, and it also hung when I attempted to write to the disk. Just as a test, I deleted the snapshot from the GUI, and booted it back up, and tried to write a file with no snapshot and it wrote back to the iSCSI disk with no issues. So snapshotting with iSCSI backed disks is not currently working.
Last edited by socratis on 31. Aug 2018, 07:31, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
kveroneau
Posts: 15
Joined: 19. Jan 2014, 00:01

Re: Local snapshots with iSCSI disks do not appear to work

Post by kveroneau »

Okay, so disk image snapshots work when using RAW block devices, such as /dev/sd? or say /dev/nbd0 as I used in my test.

Code: Select all

VBoxManage internalcommands createrawvmdk -filename FreeDOS.vmdk -rawdisk /dev/nbd0
If you create a snapshot on a VM which has this RAW VMDK created, everything works as expected. A snapshot image is placed into the Virtual Machine's Snapshot directory on the host, and the remote disk is not written to as a result. This means, that iSCSI does not support snapshots, which is either a bug or for some reason this is working as intended. Can someone from the development team please provide a formal response to this? I have no issue using nbd for my purposes, however it requires much more work as I need to call the nbd-client during boot-up of the host machine to ensure that the nbd block devices are all created before a VM can be started. Using the VirtualBox native iSCSI support just sounds more supported than say using a raw VMDK wrapping an nbd block device.
Post Reply