VirtualBox

source: vbox/trunk/doc/manual/en_US/dita/topics/diffimages.dita@ 105482

Last change on this file since 105482 was 105335, checked in by vboxsync, 7 months ago

FE/Qt: bugref:10705. Merging r6149 from doc team's repo.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
2<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
3<topic xml:lang="en-us" id="diffimages">
4 <title>Differencing Images</title>
5
6 <body>
7 <p>The previous section mentioned differencing images and how they are used with snapshots, immutable images, and
8 multiple disk attachments. This section describes in more detail how differencing images work. </p>
9 <p>A differencing image is a special disk image that only holds the differences to another image. A differencing
10 image by itself is useless, it must always refer to another image. The differencing image is then typically
11 referred to as a <i>child</i>, which holds the differences to its <i>parent</i>. </p>
12 <p>When a differencing image is active, it receives all write operations from the virtual machine instead of its
13 parent. The differencing image only contains the sectors of the virtual hard disk that have changed since the
14 differencing image was created. When the machine reads a sector from such a virtual hard disk, it looks into the
15 differencing image first. If the sector is present, it is returned from there. If not, <ph
16 conkeyref="vbox-conkeyref-phrases/product-name"/> looks into the parent. In other words, the parent becomes
17 <i>read-only</i>. It is never written to again, but it is read from if a sector has not changed. </p>
18 <p>Differencing images can be chained. If another differencing image is created for a virtual disk that already has
19 a differencing image, then it becomes a <i>grandchild</i> of the original parent. The first differencing image
20 then becomes read-only as well, and write operations only go to the second-level differencing image. When reading
21 from the virtual disk, <ph conkeyref="vbox-conkeyref-phrases/product-name"/> needs to look into the second
22 differencing image first, then into the first if the sector was not found, and then into the original image. </p>
23 <p>There can be an unlimited number of differencing images, and each image can have more than one child. As a
24 result, the differencing images can form a complex tree with parents, siblings, and children, depending on how
25 complex your machine configuration is. Write operations always go to the one <i>active</i> differencing image that
26 is attached to the machine, and for read operations, <ph conkeyref="vbox-conkeyref-phrases/product-name"/> may
27 need to look up all the parents in the chain until the sector in question is found. You can view such a tree in
28 the Virtual Media Manager. </p>
29 <fig id="fig-diff-images">
30 <title>Differencing Images, Shown in Virtual Media Manager</title>
31 <xref href="images/virtual-disk-manager-2.png" format="png" platform="htmlhelp">
32 <image href="images/virtual-disk-manager-2.png" width="12cm" placement="break">
33 <alt>Differencing Images, Shown in Virtual Media Manager</alt>
34 </image>
35 </xref>
36 <image platform="ohc" href="images/virtual-disk-manager-2.png" width="12cm" placement="break">
37 <alt>Differencing Images, Shown in Virtual Media Manager</alt>
38 </image>
39 </fig>
40 <p>In all of these situations, from the point of view of the virtual machine, the virtual hard disk behaves like any
41 other disk. While the virtual machine is running, there is a slight runtime I/O overhead because <ph
42 conkeyref="vbox-conkeyref-phrases/product-name"/> might need to look up sectors several times. This is not
43 noticeable however since the tables with sector information are always kept in memory and can be looked up
44 quickly. </p>
45 <p>Differencing images are used in the following situations: </p>
46 <ul>
47 <li>
48 <p><b outputclass="bold">Snapshots.</b> When you create a
49 snapshot, as explained in the previous section, <ph conkeyref="vbox-conkeyref-phrases/product-name"/>
50 <i>freezes</i> the images attached to the
51 virtual machine and creates differencing images for each image
52 that is not in <i>write-through</i> mode. From
53 the point of view of the virtual machine, the virtual disks
54 continue to operate before, but all write operations go into
55 the differencing images. Each time you create another
56 snapshot, for each hard disk attachment, another differencing
57 image is created and attached, forming a chain or tree.
58 </p>
59 <p>In the above screenshot, you see that the original disk image is now attached to a snapshot, representing the
60 state of the disk when the snapshot was taken. </p>
61 <p>If you <i>restore</i> a snapshot, and want to go back to the exact machine state that was stored in the
62 snapshot, the following happens: </p>
63 <ul>
64 <li>
65 <p><ph conkeyref="vbox-conkeyref-phrases/product-name"/> copies the virtual machine settings that were
66 copied into the snapshot back to the virtual machine. As a result, if you have made changes to the machine
67 configuration since taking the snapshot, they are undone. </p>
68 </li>
69 <li>
70 <p>If the snapshot was taken while the machine was running, it contains a saved machine state, and that
71 state is restored as well. After restoring the snapshot, the machine will then be in Saved state and
72 resume execution from there when it is next started. Otherwise the machine will be in Powered Off state
73 and do a full boot. </p>
74 </li>
75 <li>
76 <p>For each disk image attached to the machine, the differencing image holding all the write operations
77 since the current snapshot was taken is thrown away, and the original parent image is made active again.
78 If you restored the root snapshot, then this will be the root disk image for each attachment. Otherwise,
79 some other differencing image descended from it. This effectively restores the old machine state. </p>
80 </li>
81 </ul>
82 <p>If you later <i>delete</i> a snapshot in order to free disk space, for each disk attachment, one of the
83 differencing images becomes obsolete. In this case, the differencing image of the disk attachment cannot
84 simply be deleted. Instead, <ph conkeyref="vbox-conkeyref-phrases/product-name"/> needs to look at each sector
85 of the differencing image and needs to copy it back into its parent. This is called "merging" images and can
86 be a potentially lengthy process, depending on how large the differencing image is. It can also temporarily
87 need a considerable amount of extra disk space, before the differencing image obsoleted by the merge operation
88 is deleted. </p>
89 </li>
90 <li>
91 <p><b outputclass="bold">Immutable images.</b> When an
92 image is switched to immutable mode, a differencing image is
93 created as well. As with snapshots, the parent image then
94 becomes read-only, and the differencing image receives all the
95 write operations. Every time the virtual machine is started,
96 all the immutable images which are attached to it have their
97 respective differencing image thrown away, effectively
98 resetting the virtual machine's virtual disk with every
99 restart.
100 </p>
101 </li>
102 </ul>
103 </body>
104
105</topic>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette