5 Virtual storage 5.4 Special image write modes For each virtual disk image supported by VirtualBox, you can determine separately how it should be affected by write operations from a virtual machine and snapshot operations. This applies to all of the aforementioned image formats (VDI, VMDK, VHD or HDD) and irrespective of whether an image is fixed-size or dynamically expanding. By default, images are in “normal” mode. To mark an existing image with one of the non- standard modes listed below, use VBoxManage modifyhd see chapter 8.21, VBoxManage modi- fyhd, page 123. Alternatively, use VBoxManage to attach the image to a VM and use the --mtype argument see chapter 8.16, VBoxManage storageattach, page 119. 1. With normal images (the default setting), there are no restrictions on how guests can read from and write to the disk. When you take a snapshot of your virtual machine as described in chapter 1.9, Snapshots, page 23, the state of such a “normal hard disk” will be recorded together with the snapshot, and when reverting to the snapshot, its state will be fully reset. (Technically, strictly speaking, the image file itself is not “reset”. Instead, when a snapshot is taken, VirtualBox “freezes” the image file and no longer writes to it. For the write oper- ations from the VM, a second, “differencing” image file is created which receives only the changes to the original image see the next section for details.) While you can attach the same “normal” image to more than one virtual machine, only one of these virtual machines attached to the same image file can be executed simultaneously, as otherwise there would be conflicts if several machines write to the same image file.6 2. By contrast, write-through hard disks are completely unaffected by snapshots: their state is not saved when a snapshot is taken, and not restored when a snapshot is restored. 3. Shareable hard disks are a variant of write-through hard disks. In principle they behave exactly the same, i.e. their state is not saved when a snapshot is taken, and not restored when a snapshot is restored. The difference only shows if you attach such disks to several VMs. Shareable VMs may be attached to several VMs which may run concurrently. This makes them suitable for use by cluster filesystems between VMs and similar applications which are explicitly prepared to access a disk concurrently. Only fixed size images can be used in this way, and dynamically growing images are rejected. Warning: This is an expert feature, and misuse can lead to data loss regular filesys- tems are not prepared to handle simultaneous changes by several parties. 4. Next, immutable images only remember write accesses temporarily while the virtual ma- chine is running all changes are lost when the virtual machine is powered on the next time. As a result, as opposed to “normal” images, the same immutable image can be used with several virtual machines without restrictions. Creating an immutable image makes little sense since it would be initially empty and lose its contents with every machine restart (unless you really want to have a disk that is always unformatted when the machine starts up). As a result, normally, you would first create a “normal” image and then, when you deem its contents useful, later mark it immutable. If you take a snapshot of a machine with immutable images, then on every machine power- up, those images are reset to the state of the last (current) snapshot (instead of the state of the original immutable image). 6This restriction is more lenient now than it was before VirtualBox 2.2. Previously, each “normal” disk image could only be attached to one single machine. Now it can be attached to more than one machine so long as only one of these machines is running. 76
Previous Page Next Page