Snapshot replaces iSCSI configuration

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Snapshot replaces iSCSI configuration

Post by Oddly Vague »

I can only find a high-level description of snapshot and not enough to determine if the issue I am seeing is expected behavior or a bug. I am VirtualBox 5.1.6r110634.

I created a VM using an iSCSI virtual disk on SATA(0, 0), installed OS, etc etc. Everything is working well at that point. I created a few snapshots before I noticed that the SATA(0, 0) is now pointing to the last snapshot vdi file and not the iSCSI disk.

Code: Select all

SATA (0, 0): /mnt/nfs/MyNAS/virtualbox/MyGuest/Snapshots/{4fb3025e-59d0-40a1-b920-1a625783e7d7}.vdi (UUID: 4fb3025e-59d0-40a1-b920-1a625783e7d7)
In addition to my confusion above, the snapshots listed for the VM do not match what is in the snapshot folder. My guess is the original snapshot is the iSCSI drive. The snapshot UUID currently mounted above does not exist in the snapshots list on the VM info, but it does match one in the snapshot folder.

showvminfo:

Code: Select all

Snapshots:
   Name: Initial OS Setup (UUID: 7210ea05-bb7b-4388-b02e-77a7247efb3f)
   Name: Plex Installed (UUID: 6da0e2a5-3dfc-41f0-af43-0e66948a482e) *

Code: Select all

ls -ls --block-size=M /mnt/nfs/MyNAS/virtualbox/MyGuest/Snapshots
total 568M
 24M -rw------- 1 nobody 4294967294  25M Sep 19 08:40 {4fb3025e-59d0-40a1-b920-1a625783e7d7}.vdi
545M -rw------- 1 nobody 4294967294 546M Sep 19 08:39 {671be557-6c24-4261-8469-bffcb4f29096}.vdi
Is the VM supposed to be reconfigured to run on the last snapshot?
If this is expected behavior, what should I have done to reconfigure the VM to point back to the iSCSI?
How do I fix it now since I did not reconfigure it back to the iSCSI immediately after the snapshot?

EDIT: I made the assumption that it makes a copy of the virtual disk and continues on with the current configuration.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Snapshot replaces iSCSI configuration

Post by mpack »

A snapshot is not a copy of a virtual disk, it's a differential increment. And yes, it is normal that the VDI mounted in the VM will be the latest state (the increment), not the oldest state.
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Re: Snapshot replaces iSCSI configuration

Post by Oddly Vague »

So, what you're saying is VirtualBox only supports iSCSI if the snapshot feature is not used?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Snapshot replaces iSCSI configuration

Post by socratis »

Oddly Vague wrote:EDIT: I made the assumption that it makes a copy of the virtual disk and continues on with the current configuration.
Read the following nice explanation about differencing disks and snapshots (which are based on the concept of differencing disks).
ChipMcK in a [url=https://forums.virtualbox.org/posting.php?mode=quote&f=1&p=276859#pr276859]recent post[/url] wrote:When a virtual disk is first created for a new virtual machine, it is considered as the base disk for the guest - data for the guest is read from and written to that disk image.

The differencing disk records changes sector-by-sector to the whole disk image, not changes to any file in the disk. VirtualBox does not know what file system is employed on the disk image and therefore can not access any individual file of/on the disk image; only the guest OS is aware of that information.

First SnapShot creates a differencing disk for read/write access while the base disk becomes read-only - as the guest modifies its data, the data is written to the differencing disk and the base disk is untouched.

Second SnapShot creates another, new, differencing disk for read/write access while the first differencing disk becomes read-only along with the base disk.

Subsequent SnapShots create additional differencing disks, with the preceding differencing disk joining the hierarchy (pecking order/chain) of read-only disks.

Keep in mind that access to/from the virtual disks is sector-by-sector, not file-by-file.

When the guest requests that a sector be read, the latest SnapShot is read first. If the sector is not found there (Sector-Not-Found is returned), the next SnapShot in the chain (youngest to oldest), until the base virtual disk is reached. Then the sector on/in the base virtual disk is either read or Sector-Not-Found is returned.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Re: Snapshot replaces iSCSI configuration

Post by Oddly Vague »

Thank you for the information.

I think a qualifying statement on the snapshot feature should be added that the original location of the vdi or iSCSI configuration will be replaced with a new vdi reference in the default snapshot folder. If I am digesting this information correctly, I would say that VirtualBox has limited support for iSCSI.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Snapshot replaces iSCSI configuration

Post by mpack »

Oddly Vague wrote:So, what you're saying is VirtualBox only supports iSCSI if the snapshot feature is not used?
No, I'm saying it's clear that you don't understand snapshots.

A snapshot is not a new disk, it's a alternate state of the same disk. The snapshot file contains only the sectors which are different relative to the previous state. A single glance at the snapshot VDI ought to tell you that it's way too small to be a copy.

The file reference in the controllers section merely tells the VM which state (along the entire snapshot timeline) is the one the VM is currently interested in.

Put another way: <base>+<snapshot1>+<snapshot2> is one disk stored as three separate files. Not three different disks. The selected file is a management curiosity important to the VirtualBox software but irrelevant to the guest, whether it uses the SCSI interface - or any other.


p.s. It's also a concern to me that you are delving into VBox file contents, which you should probably leave well alone.
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Re: Snapshot replaces iSCSI configuration

Post by Oddly Vague »

I'm new to this application and project, so I do not know the history for the decisions made. Do not take offense to me being direct in an attempt to better understanding of this product. One of the reasons why I chose iSCSI is to eliminate the overhead that comes with writing to a compressed file on a network shared folder. Is it true that if I use the snapshot feature, I will no longer have the benefit of a single iSCSI virtual disk since multiple compressed files are now also a part of the virtual disk?

Is there a way to take a snapshot (differential or otherwise) that is set aside and not a functioning part of the VM so that the VM will use the original configuration of the iSCSI?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Snapshot replaces iSCSI configuration

Post by socratis »

Oddly Vague wrote:Is there a way to take a snapshot (differential or otherwise) that is set aside and not a functioning part of the VM so that the VM will use the original configuration of the iSCSI?
If you feel the need to ask the question, then I'm afraid that you still don't grasp the basic way that snapshots work. Short answer: no.

What I believe you'd want to do is to make a copy of the whole VM structure and set it aside in case you want to revert later on. Read the "Moving a VM" article and interpret it as "Backing up a VM".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Re: Snapshot replaces iSCSI configuration

Post by Oddly Vague »

I believe I understand the mechanics of what is happening, but I do not understand the logic behind it yet. I do have a lot to learn in the realm of virtualization. Thank you for you assistance. I will read that documentation.
Oddly Vague
Posts: 12
Joined: 7. Sep 2016, 19:59

Re: Snapshot replaces iSCSI configuration

Post by Oddly Vague »

Thank you all for your assistance. I think I see some of my misunderstandings and mistakes now.

I think... one way of incorporating the iSCSI benefits would be to mount an iSCSI LUN on the host OS and change the VB to point to the iSCSI mount. A many:one of VMs to a LUN. As long as I have enough space on the LUN everything should work as it does on a local disk configuration.

I believe I also see an advantage of starting multiple VMs with a read-only LUN and future writes are in its own snapshot. Is that possible? If so, I'm not sure of all of the impacts (resizing one of the VMs for example). Would creating vanilla install and cloning a snapshot of that just be a better way?

Code: Select all

vboxmanage storageattach "MyGuest" --storagectl "SATA" --port 0 --device 0 --type hdd --medium iscsi --server 192.168.1.10 --target "iqn.2016-09.me.mydomain:MyNAS:MyHost-01" --lun 0 --tport 3260
Now that I understand what a snapshot is, I understand that a snapshot has no place to go on the LUN I configured above. The LUN was represented to the OS as a drive as large as the LUN configuration. I'm still making the assumption that the VM was writing to the LUN in a raw format (opposed to saving to a VDI file).

What I am having trouble with figuring out now is if VB does a one:one of VM to LUN and the snapshot is contained in attached LUN (other than via host mounting)? Does that even make sense? What is the primary goal of attaching a iSCSI LUN to a VM like the above storageattach command?

I do appreciate the education.
Post Reply