5 Virtual storage
noticeable however since the tables with sector information are always kept in memory and can be looked up quickly.
Differencing images are used in the following situations:
1.Snapshots. When you create a snapshot, as explained in the previous section, VirtualBox “freezes” the images of the virtual machine and creates differencing images for each of them (to be precise: for those images which are not in “write- through” mode). From the point of view of the virtual machine, the virtual disks continue to operate before, but all write operations go into the differencing images. Each time you create another snapshot, more differencing images are created and attached forming a chain or tree.
If you now restore a snapshot – that is, if you want to go back to the exact machine state that was stored in the snapshot
a)VirtualBox copies the virtual machine settings that were copied into the snapshot back to the virtual machine. As a result, if you have made changes to the machine configuration since taking the snapshot, they are undone.
b)If the snapshot was taken while the machine was running, it contains a saved machine state, and that state is restored as well; after restoring the snapshot, the machine will then be in “Saved” state and resume execution from there when it is next started. Otherwise it will be in “Powered Off” state and do a full boot.
c)The differencing images holding all the write operations since the snapshot was taken are thrown away, and the original parent images are made active again. (If you restored the “root” snapshot, then this will be the root disk images; otherwise, some other differencing image descended from it.) This effectively restores the old machine state.
If you later delete a snapshot in order to free disk space, one of the differencing images becomes obsolete. In this case, the differencing images cannot simply be deleted. Instead, VirtualBox needs to look at each sector of the differencing im- age and needs to copy it back into the parent; this is called “merging” images and can be a potentially lengthy process, depending on how large the differencing image is.
2.Immutable images. When an image is switched to “immutable” mode, a dif- ferencing image is created as well. As with snapshots, the parent image then becomes
84