VirtualBox

source: vbox/trunk/doc/manual/en_US/dita/topics/hdimagewrites.dita@ 108921

Last change on this file since 108921 was 108921, checked in by vboxsync, 5 weeks ago

Docs: bugref:10705. The following commits from doc's team git repo has been applied:

6c76f3636576368d4a9963539c9d13348e208183 EFI only for Arm
85ce91f98ba4a229be6e435bea6678ca43f87b4d Changed topic IDs
81c094808cde6217550ab02b74c22d487d1a1746 Updated topic IDs and links to them
50717ec1eaea65d137bde7eb168b519a6b1d9966 Updated topic IDs
75466c5935ec603a2be966669f232bd088b3f287 Updated cloud intro
713b0c03d33098af0158ae0615a4f61370cabdef Updated comments

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 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="hdimagewrites">
4 <title>Special Image Write Modes</title>
5
6 <body>
7 <p>For each virtual disk image supported by <ph conkeyref="vbox-conkeyref-phrases/product-name"/>, you can determine
8 separately how it should be affected by write operations from a virtual machine and snapshot operations. This
9 applies to all of the aforementioned image formats (VDI, VMDK, VHD, or HDD) and irrespective of whether an image
10 is fixed-size or dynamically allocated. </p>
11 <p>By default, images are in <i>normal</i> mode. To mark an existing image with one of the nonstandard modes listed below, use <userinput>VBoxManage modifymedium</userinput>. See <xref href="../cli_topics/vboxmanage-modifymedium.dita"/>. Alternatively, use <userinput>VBoxManage storageattach</userinput> to attach the image to a VM and specify the <codeph>--mtype</codeph> argument. See <xref href="../cli_topics/vboxmanage-storageattach.dita"/>.</p>
12 <p>The available virtual disk image modes are as follows: </p>
13 <ul>
14 <li>
15 <p><b outputclass="bold">Normal images</b> have no
16 restrictions on how guests can read from and write to the
17 disk. This is the default image mode.
18 </p>
19 <p>When you take a snapshot of your virtual machine as described in <xref href="snapshots.dita"/>, the state of a normal hard disk is recorded together with the snapshot, and when reverting to the snapshot, its state will be fully reset. </p>
20 <p>The image file itself is not reset. Instead, when a snapshot is taken, <ph
21 conkeyref="vbox-conkeyref-phrases/product-name"/>
22 <i>freezes</i> the image file and no longer writes to it. For the write operations from the VM, a second,
23 <i>differencing</i> image file is created which receives only the changes to the original image. See <xref
24 href="diffimages.dita#diffimages"/>. </p>
25 <p>While you can attach the same normal image to more than one virtual machine, only one of these virtual
26 machines attached to the same image file can be executed simultaneously, as otherwise there would be conflicts
27 if several machines write to the same image file. </p>
28 </li>
29 <li>
30 <p><b outputclass="bold">Write-through hard disks</b> are
31 completely unaffected by snapshots. Their state is
32 <i>not</i> saved when a snapshot is taken, and
33 not restored when a snapshot is restored.
34 </p>
35 </li>
36 <li>
37 <p><b outputclass="bold">Shareable hard disks</b> are a
38 variant of write-through hard disks. In principle they behave
39 exactly the same. Their state is <i>not</i>
40 saved when a snapshot is taken, and not restored when a
41 snapshot is restored. The difference only shows if you attach
42 such disks to several VMs. Shareable disks may be attached to
43 several VMs which may run concurrently. This makes them
44 suitable for use by cluster filesystems between VMs and
45 similar applications which are explicitly prepared to access a
46 disk concurrently. Only fixed size images can be used in this
47 way, and dynamically allocated images are rejected.
48 </p>
49 <note type="caution">
50 <p>This is an expert feature, and misuse can lead to data loss, as regular filesystems are not prepared to
51 handle simultaneous changes by several parties. </p>
52 </note>
53 </li>
54 <li>
55 <p><b outputclass="bold">Immutable images</b> only
56 remember write accesses temporarily while the virtual machine
57 is running. All changes are lost when the virtual machine is
58 powered on the next time. As a result, as opposed to Normal
59 images, the same immutable image can be used with several
60 virtual machines without restrictions.
61 </p>
62 <p>Creating an immutable image makes little sense since it would be initially empty and lose its contents with
63 every machine restart. You would have a disk that is always unformatted when the machine starts up. Instead,
64 you can first create a normal image and then later mark it as immutable when you decide that the contents are
65 useful. </p>
66 <p>If you take a snapshot of a machine with immutable images, then on every machine power-up, those images are
67 reset to the state of the last (current) snapshot, instead of the state of the original immutable image. </p>
68 <note>
69 <p>As a special exception, immutable images are <i>not</i> reset if they are attached to a machine in a saved
70 state or whose last snapshot was taken while the machine was running. This is called an <i>online
71 snapshot</i>. As a result, if the machine's current snapshot is an online snapshot, its immutable images
72 behave exactly like the a normal image. To reenable the automatic resetting of such images, delete the
73 current snapshot of the machine. </p>
74 </note>
75 <p><ph conkeyref="vbox-conkeyref-phrases/product-name"/> never writes to an immutable image directly at all. All
76 write operations from the machine are directed to a differencing image. The next time the VM is powered on,
77 the differencing image is reset so that every time the VM starts, its immutable images have exactly the same
78 content. </p>
79 <p>The differencing image is only reset when the machine is powered on from within <ph
80 conkeyref="vbox-conkeyref-phrases/product-name"/>, not when you reboot by requesting a reboot from within
81 the machine. This is also why immutable images behave as described above when snapshots are also present,
82 which use differencing images as well. </p>
83 <p>If the automatic discarding of the differencing image on VM startup does not fit your needs, you can turn it off using the <codeph>autoreset</codeph> parameter of <userinput>VBoxManage modifymedium</userinput>. See <xref href="../cli_topics/vboxmanage-modifymedium.dita"/>.</p>
84 </li>
85 <li>
86 <p><b outputclass="bold">Multiattach mode images</b> can
87 be attached to more than one virtual machine at the same time,
88 even if these machines are running simultaneously. For each
89 virtual machine to which such an image is attached, a
90 differencing image is created. As a result, data that is
91 written to such a virtual disk by one machine is not seen by
92 the other machines to which the image is attached. Each
93 machine creates its own write history of the multiattach
94 image.
95 </p>
96 <p>Technically, a multiattach image behaves identically to an immutable image except the differencing image is
97 not reset every time the machine starts. </p>
98 <p>This mode is useful for sharing files which are almost never written, for instance picture galleries, where
99 every guest changes only a small amount of data and the majority of the disk content remains unchanged. The
100 modified blocks are stored in differencing images which remain relatively small and the shared content is
101 stored only once at the host. </p>
102 </li>
103 <li>
104 <p><b outputclass="bold">Read-only images</b> are used
105 automatically for CD/DVD images, since CDs/DVDs can never be
106 written to.
107 </p>
108 </li>
109 </ul>
110 <p>The following scenario illustrates the differences between the various image modes, with respect to snapshots. </p>
111 <p>Assume you have installed your guest OS in your VM, and you have taken a snapshot. Later, your VM is infected
112 with a virus and you would like to go back to the snapshot. With a normal hard disk image, you simply restore the
113 snapshot, and the earlier state of your hard disk image will be restored as well and your virus infection will be
114 undone. With an immutable hard disk, all it takes is to shut down and power on your VM, and the virus infection
115 will be discarded. With a write-through image however, you cannot easily undo the virus infection by means of
116 virtualization, but will have to disinfect your virtual machine like a real computer. </p>
117 <p>You might find write-through images useful if you want to preserve critical data irrespective of snapshots. As
118 you can attach more than one image to a VM, you may want to have one immutable image for the OS and one
119 write-through image for your data files. </p>
120 </body>
121
122</topic>
Note: See TracBrowser for help on using the repository browser.

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