VirtualBox

source: vbox/trunk/doc/manual/en_US/user_Storage.xml@ 98110

Last change on this file since 98110 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 73.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright (C) 2006-2023 Oracle and/or its affiliates.
4
5 This file is part of VirtualBox base platform packages, as
6 available from https://www.virtualbox.org.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation, in version 3 of the
11 License.
12
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <https://www.gnu.org/licenses>.
20
21 SPDX-License-Identifier: GPL-3.0-only
22-->
23<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
24"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
25<!ENTITY % all.entities SYSTEM "all-entities.ent">
26%all.entities;
27]>
28<chapter id="storage">
29
30 <title>Virtual Storage</title>
31
32 <para>
33 As the virtual machine will most probably expect to see a hard disk
34 built into its virtual computer, &product-name; must be able to
35 present real storage to the guest as a virtual hard disk. There are
36 presently three methods by which to achieve this:
37 </para>
38
39 <itemizedlist>
40
41 <listitem>
42 <para>
43 &product-name; can use large image files on a real hard disk and
44 present them to a guest as a virtual hard disk. This is the most
45 common method, described in <xref linkend="vdidetails" />.
46 </para>
47 </listitem>
48
49 <listitem>
50 <para>
51 iSCSI storage servers can be attached to &product-name;. This is
52 described in <xref linkend="storage-iscsi" />.
53 </para>
54 </listitem>
55
56 <listitem>
57 <para>
58 You can allow a virtual machine to access one of your host disks
59 directly. This is an advanced feature, described in
60 <xref linkend="rawdisk" />.
61 </para>
62 </listitem>
63
64 </itemizedlist>
65
66 <para>
67 Each such virtual storage device, such as an image file, iSCSI
68 target, or physical hard disk, needs to be connected to the virtual
69 hard disk controller that &product-name; presents to a virtual
70 machine. This is explained in the next section.
71 </para>
72
73 <sect1 id="harddiskcontrollers">
74
75 <title>Hard Disk Controllers</title>
76
77 <para>
78 In a computing device, hard disks and CD/DVD drives are connected
79 to a device called a hard disk controller, which drives hard disk
80 operation and data transfers. &product-name; can emulate the most
81 common types of hard disk controllers typically found in computing
82 devices: IDE, SATA (AHCI), SCSI, SAS, USB-based, NVMe and
83 virtio-scsi mass storage devices.
84 </para>
85
86 <itemizedlist>
87
88 <listitem>
89 <para>
90 <emphasis role="bold">IDE (ATA)</emphasis> controllers are a
91 backwards-compatible yet very advanced extension of the disk
92 controller in the IBM PC/AT (1984). Initially, this interface
93 worked only with hard disks, but was later extended to also
94 support CD-ROM drives and other types of removable media. In
95 physical PCs, this standard uses flat ribbon parallel cables
96 with 40 or 80 wires. Each such cable can connect two devices,
97 called device 0 and device 1, to a controller. Typical PCs had
98 two connectors for such cables. As a result, support for up to
99 four IDE devices was most common: primary device 0, primary
100 device 1, secondary device 0, and secondary device 1.
101 </para>
102
103 <para>
104 In &product-name;, each virtual machine may have one IDE
105 controller enabled, which gives you up to four virtual storage
106 devices that you can attach to the machine. By default, one of
107 these virtual storage devices, device 0 on the secondary
108 channel, is preconfigured to be the virtual machine's virtual
109 CD/DVD drive. However, you can change the default setting.
110 </para>
111
112 <para>
113 Even if your guest OS has no support for SCSI or SATA devices,
114 it should always be able to see an IDE controller.
115 </para>
116
117 <para>
118 You can also select which exact type of IDE controller
119 hardware &product-name; should present to the virtual machine:
120 PIIX3, PIIX4, or ICH6. This makes no difference in terms of
121 performance, but if you import a virtual machine from another
122 virtualization product, the OS in that machine may expect a
123 particular controller type and crash if it is not found.
124 </para>
125
126 <para>
127 After you have created a new virtual machine with the
128 <emphasis role="bold">New Virtual Machine</emphasis> wizard in
129 &vbox-mgr;, you will typically see one IDE controller in the
130 machine's <emphasis role="bold">Storage</emphasis> settings.
131 The virtual CD/DVD drive will be attached to one of the four
132 ports of this controller.
133 </para>
134 </listitem>
135
136 <listitem>
137 <para>
138 <emphasis role="bold">Serial ATA (SATA)</emphasis> is a more
139 recent standard than IDE. Compared to IDE, it supports both
140 much higher speeds and more devices per controller. Also, with
141 physical hardware, devices can be added and removed while the
142 system is running. The standard interface for SATA controllers
143 is called Advanced Host Controller Interface (AHCI).
144 </para>
145
146 <para>
147 Like a real SATA controller, &product-name;'s virtual SATA
148 controller operates faster and also consumes fewer CPU
149 resources than the virtual IDE controller. Also, this enables
150 you to connect up to 30 virtual hard disks to one machine
151 instead of just three, when compared to the &product-name; IDE
152 controller with a DVD drive attached.
153 </para>
154
155 <para>
156 For this reason, depending on the selected guest OS,
157 &product-name; uses SATA as the default for newly created
158 virtual machines. One virtual SATA controller is created by
159 default, and the default disk that is created with a new VM is
160 attached to this controller.
161 </para>
162
163 <warning>
164 <para>
165 The entire SATA controller and the virtual disks attached to
166 it, including those in IDE compatibility mode, will not be
167 seen by OSes that do not have device support for AHCI. In
168 particular, <emphasis>there is no support for AHCI in
169 Windows versions before Windows Vista</emphasis>. Legacy
170 Windows versions such as Windows XP, even with SP3
171 installed, will not see such disks unless you install
172 additional drivers. It is possible to switch from IDE to
173 SATA after installation by installing the SATA drivers and
174 changing the controller type in the VM
175 <emphasis role="bold">Settings</emphasis> window.
176 </para>
177
178 <para>
179 &product-name; recommends the Intel Matrix Storage drivers,
180 which can be downloaded from
181 <ulink url="http://downloadcenter.intel.com/Product_Filter.aspx?ProductID=2101" />.
182 </para>
183 </warning>
184
185 <para>
186 To add a SATA controller to a machine for which it has not
187 been enabled by default, either because it was created by an
188 earlier version of &product-name;, or because SATA is not
189 supported by default by the selected guest OS, do the
190 following. Go to the <emphasis role="bold">Storage</emphasis>
191 page of the machine's
192 <emphasis role="bold">Settings</emphasis> window, click
193 <emphasis role="bold">Add Controller</emphasis> under the
194 Storage Tree box and then select <emphasis role="bold">Add
195 SATA Controller</emphasis>. The new controller appears as a
196 separate PCI device in the virtual machine, and you can add
197 virtual disks to it.
198 </para>
199
200 <para>
201 To change the IDE compatibility mode settings for the SATA
202 controller, see <xref linkend="vboxmanage-storagectl" />.
203 </para>
204 </listitem>
205
206 <listitem>
207 <para>
208 <emphasis role="bold">SCSI</emphasis> is another established
209 industry standard, standing for Small Computer System
210 Interface. SCSI is as a generic interface for data transfer
211 between all kinds of devices, including storage devices. SCSI
212 is still used for connecting some hard disks and tape devices,
213 but it has mostly been displaced in commodity hardware. It is
214 still in common use in high-performance workstations and
215 servers.
216 </para>
217
218 <para>
219 Primarily for compatibility with other virtualization
220 software, &product-name; optionally supports LSI Logic and
221 BusLogic SCSI controllers, to each of which up to fifteen
222 virtual hard disks can be attached.
223 </para>
224
225 <para>
226 To enable a SCSI controller, on the
227 <emphasis role="bold">Storage</emphasis> page of a virtual
228 machine's <emphasis role="bold">Settings</emphasis> window,
229 click <emphasis role="bold">Add Controller</emphasis> under
230 the Storage Tree box and then select <emphasis role="bold">Add
231 SCSI Controller</emphasis>. The new controller appears as a
232 separate PCI device in the virtual machine.
233 </para>
234
235 <warning>
236 <para>
237 As with the other controller types, a SCSI controller will
238 only be seen by OSes with device support for it. Windows
239 2003 and later ships with drivers for the LSI Logic
240 controller, while Windows NT 4.0 and Windows 2000 ships with
241 drivers for the BusLogic controller. Windows XP ships with
242 drivers for neither.
243 </para>
244 </warning>
245 </listitem>
246
247 <listitem>
248 <para>
249 <emphasis role="bold">Serial Attached SCSI (SAS)</emphasis> is
250 another bus standard which uses the SCSI command set. As
251 opposed to SCSI physical devices, serial cables are used
252 instead of parallel cables. This simplifies physical device
253 connections. In some ways, therefore, SAS is to SCSI what SATA
254 is to IDE: it enables more reliable and faster connections.
255 </para>
256
257 <para>
258 To support high-end guests which require SAS controllers,
259 &product-name; emulates a LSI Logic SAS controller, which can
260 be enabled much the same way as a SCSI controller. At this
261 time, up to 255 devices can be connected to the SAS
262 controller.
263 </para>
264
265 <warning>
266 <para>
267 As with SATA, the SAS controller will only be seen by OSes
268 with device support for it. In particular, <emphasis>there
269 is no support for SAS in Windows before Windows
270 Vista</emphasis>. So Windows XP, even SP3, will not see such
271 disks unless you install additional drivers.
272 </para>
273 </warning>
274 </listitem>
275
276 <listitem>
277 <para>
278 The <emphasis role="bold">USB mass storage device
279 class</emphasis> is a standard to connect external storage
280 devices like hard disks or flash drives to a host through USB.
281 All major OSes support these devices and ship generic drivers
282 making third-party drivers superfluous. In particular, legacy
283 OSes without support for SATA controllers may benefit from USB
284 mass storage devices.
285 </para>
286
287 <para>
288 The virtual USB storage controller offered by &product-name;
289 works differently to the other storage controller types. While
290 most storage controllers appear as a single PCI device to the
291 guest with multiple disks attached to it, the USB-based
292 storage controller does not appear as virtual storage
293 controller. Each disk attached to the controller appears as a
294 dedicated USB device to the guest.
295 </para>
296
297 <warning>
298 <para>
299 Booting from drives attached using USB is only supported
300 when EFI is used as the BIOS lacks USB support.
301 </para>
302 </warning>
303 </listitem>
304
305 <listitem>
306 <para>
307 <emphasis role="bold">Non volatile memory express
308 (NVMe)</emphasis> is a standard for connecting non volatile
309 memory (NVM) directly over PCI Express to lift the bandwidth
310 limitation of the previously used SATA protocol for
311 solid-state devices. Unlike other standards the command set is
312 very simple in order to achieve maximum throughput and is not
313 compatible with ATA or SCSI. OSes need to support NVMe devices
314 to make use of them. For example, Windows 8.1 added native
315 NVMe support. For Windows 7, native support was added with an
316 update.
317 </para>
318
319 <para>
320 The NVMe controller is part of the extension pack.
321 </para>
322
323 <warning>
324 <para>
325 Booting from drives attached using NVMe is only supported
326 when EFI is used as the BIOS lacks the appropriate driver.
327 </para>
328 </warning>
329 </listitem>
330
331 <listitem>
332 <para>
333 <emphasis role="bold">Virtual I/O Device SCSI</emphasis> is a
334 standard to connect virtual storage devices like hard disks or
335 optical drives to a VM. Recent Linux and Windows versions
336 support these devices, but Windows needs additional drivers.
337 Currently virtio-scsi controller support is experimental.
338 </para>
339
340 <warning>
341 <para>
342 The virtio-scsi controller will only be seen by OSes with
343 device support for it. In particular, <emphasis>there is no
344 built-in support in Windows</emphasis>. So Windows will not
345 see such disks unless you install additional drivers.
346 </para>
347 </warning>
348 </listitem>
349
350 </itemizedlist>
351
352 <para>
353 In summary, &product-name; gives you the following categories of
354 virtual storage slots:
355 </para>
356
357 <itemizedlist>
358
359 <listitem>
360 <para>
361 Four slots attached to the traditional IDE controller, which
362 are always present. One of these is typically a virtual CD/DVD
363 drive.
364 </para>
365 </listitem>
366
367 <listitem>
368 <para>
369 30 slots attached to the SATA controller, if enabled and
370 supported by the guest OS.
371 </para>
372 </listitem>
373
374 <listitem>
375 <para>
376 15 slots attached to the SCSI controller, if enabled and
377 supported by the guest OS.
378 </para>
379 </listitem>
380
381 <listitem>
382 <para>
383 Up to 255 slots attached to the SAS controller, if enabled and
384 supported by the guest OS.
385 </para>
386 </listitem>
387
388 <listitem>
389 <para>
390 Eight slots attached to the virtual USB controller, if enabled
391 and supported by the guest OS.
392 </para>
393 </listitem>
394
395 <listitem>
396 <para>
397 Up to 255 slots attached to the NVMe controller, if enabled
398 and supported by the guest OS.
399 </para>
400 </listitem>
401
402 <listitem>
403 <para>
404 Up to 256 slots attached to the virtio-scsi controller, if
405 enabled and supported by the guest OS.
406 </para>
407 </listitem>
408
409 </itemizedlist>
410
411 <para>
412 Given this large choice of storage controllers, you may not know
413 which one to choose. In general, you should avoid IDE unless it is
414 the only controller supported by your guest. Whether you use SATA,
415 SCSI, or SAS does not make any real difference. The variety of
416 controllers is only supplied by &product-name; for compatibility
417 with existing hardware and other hypervisors.
418 </para>
419
420 </sect1>
421
422 <sect1 id="vdidetails">
423
424 <title>Disk Image Files (VDI, VMDK, VHD, HDD)</title>
425
426 <para>
427 Disk image files reside on the host system and are seen by the
428 guest systems as hard disks of a certain geometry. When a guest OS
429 reads from or writes to a hard disk, &product-name; redirects the
430 request to the image file.
431 </para>
432
433 <para>
434 Like a physical disk, a virtual disk has a size, or capacity,
435 which must be specified when the image file is created. As opposed
436 to a physical disk however, &product-name; enables you to expand
437 an image file after creation, even if it has data already. See
438 <xref linkend="vboxmanage-modifymedium" />.
439 </para>
440
441 <para>
442 &product-name; supports the following types of disk image files:
443 </para>
444
445 <itemizedlist>
446
447 <listitem>
448 <para>
449 <emphasis role="bold">VDI.</emphasis> Normally, &product-name;
450 uses its own container format for guest hard disks. This is
451 called a Virtual Disk Image (VDI) file. This format is used
452 when you create a new virtual machine with a new disk.
453 </para>
454 </listitem>
455
456 <listitem>
457 <para>
458 <emphasis role="bold">VMDK.</emphasis> &product-name; also
459 fully supports the popular and open VMDK container format that
460 is used by many other virtualization products, such as VMware.
461 </para>
462 </listitem>
463
464 <listitem>
465 <para>
466 <emphasis role="bold">VHD.</emphasis> &product-name; also
467 fully supports the VHD format used by Microsoft.
468 </para>
469 </listitem>
470
471 <listitem>
472 <para>
473 <emphasis role="bold">HDD.</emphasis> Image files of Parallels
474 version 2 (HDD format) are also supported.
475 </para>
476
477 <para>
478 Due to lack of documentation of the format, newer versions
479 such as 3 and 4 are not supported. You can however convert
480 such image files to version 2 format using tools provided by
481 Parallels.
482 </para>
483 </listitem>
484
485 </itemizedlist>
486
487 <para>
488 Irrespective of the disk capacity and format, as mentioned in
489 <xref linkend="create-vm-wizard" />, there are two options for
490 creating a disk image: fixed-size or dynamically allocated.
491 </para>
492
493 <itemizedlist>
494
495 <listitem>
496 <para>
497 <emphasis role="bold">Fixed-size.</emphasis> If you create a
498 fixed-size image, an image file will be created on your host
499 system which has roughly the same size as the virtual disk's
500 capacity. So, for a 10 GB disk, you will have a 10 GB file.
501 Note that the creation of a fixed-size image can take a long
502 time depending on the size of the image and the write
503 performance of your hard disk.
504 </para>
505 </listitem>
506
507 <listitem>
508 <para>
509 <emphasis role="bold">Dynamically allocated.</emphasis> For
510 more flexible storage management, use a dynamically allocated
511 image. This will initially be very small and not occupy any
512 space for unused virtual disk sectors, but will grow every
513 time a disk sector is written to for the first time, until the
514 drive reaches the maximum capacity chosen when the drive was
515 created. While this format takes less space initially, the
516 fact that &product-name; needs to expand the image file
517 consumes additional computing resources, so until the disk
518 file size has stabilized, write operations may be slower than
519 with fixed size disks. However, after a time the rate of
520 growth will slow and the average penalty for write operations
521 will be negligible.
522 </para>
523 </listitem>
524
525 </itemizedlist>
526
527 </sect1>
528
529 <sect1 id="virtual-media-manager">
530
531 <title>The Virtual Media Manager</title>
532
533 <para>
534 &product-name; keeps track of all the hard disk, CD/DVD-ROM, and
535 floppy disk images which are in use by virtual machines. These are
536 often referred to as <emphasis>known media</emphasis> and come
537 from two sources:
538 </para>
539
540 <itemizedlist>
541
542 <listitem>
543 <para>
544 All media currently attached to virtual machines.
545 </para>
546 </listitem>
547
548 <listitem>
549 <para>
550 Registered media, for compatibility with legacy &product-name;
551 versions.
552 </para>
553 </listitem>
554
555 </itemizedlist>
556
557 <para>
558 The known media can be viewed and changed using the
559 <emphasis role="bold">Virtual Media Manager</emphasis> tool, which
560 you access by clicking <emphasis role="bold">Media</emphasis> on
561 the global <emphasis role="bold">Tools</emphasis> menu in
562 &vbox-mgr;.
563 </para>
564
565 <figure id="fig-virtual-media-manager">
566 <title>The Virtual Media Manager, Showing Hard Disk Images</title>
567 <mediaobject>
568 <imageobject>
569 <imagedata align="center" fileref="images/virtual-disk-manager.png"
570 width="12cm" />
571 </imageobject>
572 </mediaobject>
573 </figure>
574
575 <para>
576 The known media are conveniently grouped in separate tabs for the
577 supported formats. These formats are:
578 </para>
579
580 <itemizedlist>
581
582 <listitem>
583 <para>
584 Hard disk images, either in &product-name;'s own Virtual Disk
585 Image (VDI) format, or in the third-party formats listed in
586 <xref linkend="vdidetails"/>.
587 </para>
588 </listitem>
589
590 <listitem>
591 <para>
592 CD/DVD images in standard ISO format.
593 </para>
594 </listitem>
595
596 <listitem>
597 <para>
598 Floppy images in standard RAW format.
599 </para>
600 </listitem>
601
602 </itemizedlist>
603
604 <para>
605 For each image, the Virtual Media Manager shows you the full path
606 of the image file and other information, such as the virtual
607 machine the image is currently attached to.
608 </para>
609
610 <para>
611 The Virtual Media Manager enables you to do the following:
612 </para>
613
614 <itemizedlist>
615
616 <listitem>
617 <para>
618 <emphasis role="bold">Add</emphasis> an image to the known
619 media.
620 </para>
621 </listitem>
622
623 <listitem>
624 <para>
625 <emphasis role="bold">Create</emphasis> a new disk image.
626 </para>
627
628 <itemizedlist>
629
630 <listitem>
631 <para>
632 For hard disks, the <emphasis role="bold">Create Virtual
633 Hard Disk</emphasis> wizard is shown. See
634 <xref linkend="create-virtual-hard-disk-image"/>.
635 </para>
636 </listitem>
637
638 <listitem>
639 <para>
640 For optical disks, the <emphasis role="bold">VISO
641 Creator</emphasis> tool is shown. See
642 <xref linkend="create-optical-disk-image"/>.
643 </para>
644 </listitem>
645
646 <listitem>
647 <para>
648 For floppy disks, the <emphasis role="bold">Floppy Disk
649 Creator</emphasis> tool is shown. See
650 <xref linkend="create-floppy-disk-image"/>.
651 </para>
652 </listitem>
653
654 </itemizedlist>
655 </listitem>
656
657 <listitem>
658 <para>
659 <emphasis role="bold">Copy</emphasis> an image to create
660 another one.
661 </para>
662
663 <para>
664 For virtual hard disks, you can specify one of the following
665 target types: VDI, VHD, or VMDK.
666 </para>
667 </listitem>
668
669 <listitem>
670 <para>
671 <emphasis role="bold">Move</emphasis> an image to another
672 location.
673 </para>
674
675 <para>
676 A file dialog prompts you for the new image file location.
677 </para>
678
679 <para>
680 When you use the Virtual Media Manager to move a disk image,
681 &product-name; updates all related configuration files
682 automatically.
683 </para>
684
685 <note>
686 <para>
687 Always use the Virtual Media Manager or the
688 <command>VBoxManage modifymedium</command> command to move a
689 disk image.
690 </para>
691
692 <para>
693 If you use a file management feature of the host OS to move
694 a disk image to a new location, run the <command>VBoxManage
695 modifymedium</command> <option>--setlocation</option>
696 command to configure the new path of the disk image on the
697 host file system. This command updates the &product-name;
698 configuration automatically.
699 </para>
700 </note>
701 </listitem>
702
703 <listitem>
704 <para>
705 <emphasis role="bold">Remove</emphasis> an image from the
706 known media. You can optionally delete the image file when
707 removing the image.
708 </para>
709 </listitem>
710
711 <listitem>
712 <para>
713 <emphasis role="bold">Release</emphasis> an image to detach it
714 from a VM. This action only applies if the image is currently
715 attached to a VM as a virtual hard disk.
716 </para>
717 </listitem>
718
719 <listitem>
720 <para>
721 <emphasis role="bold">Clear</emphasis> all inaccessible disk
722 images from the list. The disk images are released from the
723 VMs they are attached to and removed from the known media.
724 </para>
725
726 <note>
727 <para>
728 This option is for optical disks and floppy disks only.
729 </para>
730 </note>
731 </listitem>
732
733 <listitem>
734 <para>
735 <emphasis role="bold">Search</emphasis> for an image by name
736 or UUID.
737 </para>
738 </listitem>
739
740 <listitem>
741 <para>
742 View and edit the <emphasis role="bold">Properties</emphasis>
743 of a disk image.
744 </para>
745
746 <para>
747 Available properties include the following:
748 </para>
749
750 <itemizedlist>
751
752 <listitem>
753 <para>
754 <emphasis role="bold">Type:</emphasis> Specifies the
755 snapshot behavior of the disk. See
756 <xref linkend="hdimagewrites"/>.
757 </para>
758 </listitem>
759
760 <listitem>
761 <para>
762 <emphasis role="bold">Location:</emphasis> Specifies the
763 location of the disk image file on the host system. You
764 can use a file dialog to browse for the disk image
765 location.
766 </para>
767 </listitem>
768
769 <listitem>
770 <para>
771 <emphasis role="bold">Description:</emphasis> Specifies a
772 short description of the disk image.
773 </para>
774 </listitem>
775
776 <listitem>
777 <para>
778 <emphasis role="bold">Size:</emphasis> Specifies the size
779 of the disk image. You can use the slider to increase or
780 decrease the disk image size.
781 </para>
782 </listitem>
783
784 <listitem>
785 <para>
786 <emphasis role="bold">Information:</emphasis> Specifies
787 detailed information about the disk image.
788 </para>
789 </listitem>
790
791 </itemizedlist>
792 </listitem>
793
794 <listitem>
795 <para>
796 <emphasis role="bold">Refresh</emphasis> the property values
797 of the selected disk image.
798 </para>
799 </listitem>
800
801 </itemizedlist>
802
803 <para>
804 To perform these actions, highlight the medium in the Virtual
805 Media Manager and then do one of the following:
806 </para>
807
808 <itemizedlist>
809
810 <listitem>
811 <para>
812 Click an icon in the Virtual Media Manager toolbar.
813 </para>
814 </listitem>
815
816 <listitem>
817 <para>
818 Right-click the medium and select an option.
819 </para>
820 </listitem>
821
822 </itemizedlist>
823
824 <para>
825 Use the <emphasis role="bold">Storage</emphasis> page in a VM's
826 <emphasis role="bold">Settings</emphasis> window to create a new
827 disk image. By default, disk images are stored in the VM's folder.
828 </para>
829
830 <para>
831 You can copy hard disk image files to other host systems and then
832 import them in to VMs from the host system. However, some Windows
833 guest OSes may require that you configure the new VM in a similar
834 way to the old one.
835 </para>
836
837 <note>
838 <para>
839 Do not simply make copies of virtual disk images. If you import
840 such a second copy into a VM, &product-name; issues an error
841 because &product-name; assigns a universally unique identifier
842 (UUID) to each disk image to ensure that it is only used one
843 time. See <xref linkend="cloningvdis" />. Also, if you want to
844 copy a VM to another system, use the &product-name; import and
845 export features. See <xref linkend="ovf" />.
846 </para>
847 </note>
848
849 <sect2 id="create-virtual-hard-disk-image">
850
851 <title>Creating a Virtual Hard Disk Image</title>
852
853 <para>
854 Use the <emphasis role="bold">Create Virtual Hard
855 Disk</emphasis> wizard to create a hard disk image.
856 </para>
857
858 <orderedlist>
859
860 <listitem>
861 <para>
862 Display the <emphasis role="bold">Hard Disks</emphasis> tab
863 in Virtual Media Manager and click
864 <emphasis role="bold">Create</emphasis>.
865 </para>
866
867 <para>
868 The <emphasis role="bold">Create Virtual Hard
869 Disk</emphasis> wizard is shown.
870 </para>
871
872 <figure id="fig-virtual-hard-disk-wizard">
873 <title>Create Virtual Hard Disk Wizard</title>
874 <mediaobject>
875 <imageobject>
876 <imagedata align="center" fileref="images/virtual-hard-disk-wizard.png"
877 width="12cm" />
878 </imageobject>
879 </mediaobject>
880 </figure>
881 </listitem>
882
883 <listitem>
884 <para>
885 On the <emphasis role="bold">Virtual Hard Disk File
886 Type</emphasis> page, select a file type for the new virtual
887 hard disk image.
888 </para>
889
890 <para>
891 Click <emphasis role="bold">Next</emphasis>.
892 </para>
893 </listitem>
894
895 <listitem>
896 <para>
897 On the <emphasis role="bold">Storage on Physical Hard
898 Disk</emphasis> page, select whether the size of the virtual
899 hard disk file is dynamically allocated or is of fixed size.
900 </para>
901
902 <para>
903 Click <emphasis role="bold">Next</emphasis>.
904 </para>
905 </listitem>
906
907 <listitem>
908 <para>
909 On the <emphasis role="bold">File Location and
910 Size</emphasis> page, configure the location of the virtual
911 hard disk file and use the slider to set the size limit for
912 the virtual hard disk.
913 </para>
914
915 <para>
916 Click <emphasis role="bold">Finish</emphasis> to create the
917 virtual hard disk file.
918 </para>
919
920 <para>
921 The virtual hard disk image is created in the specified
922 location and added to the <emphasis role="bold">Hard
923 Disks</emphasis> tab in Virtual Media Manager.
924 </para>
925 </listitem>
926
927 </orderedlist>
928
929 </sect2>
930
931 <sect2 id="create-optical-disk-image">
932
933 <title>Creating a Virtual Optical Disk Image</title>
934
935 <para>
936 Use the <emphasis role="bold">VISO Creator</emphasis> tool to
937 create a virtual optical disk image. This enables you to create
938 a virtual ISO from selected files on the host.
939 </para>
940
941 <orderedlist>
942
943 <listitem>
944 <para>
945 Display the <emphasis role="bold">Optical Disks</emphasis>
946 tab in Virtual Media Manager and click
947 <emphasis role="bold">Create</emphasis>.
948 </para>
949
950 <para>
951 The <emphasis role="bold">VISO Creator</emphasis> tool is
952 shown.
953 </para>
954 </listitem>
955
956 <listitem>
957 <para>
958 Create the virtual ISO file.
959 </para>
960
961 <orderedlist>
962
963 <listitem>
964 <para>
965 Configure the name of the ISO file.
966 </para>
967
968 <para>
969 Click <emphasis role="bold">Configuration</emphasis> and
970 enter a name in the <emphasis role="bold">Viso
971 Name</emphasis> field.
972 </para>
973 </listitem>
974
975 <listitem>
976 <para>
977 Add files to your virtual ISO.
978 </para>
979
980 <para>
981 In the <emphasis role="bold">Host File System</emphasis>
982 pane, select files to copy from the host system to the
983 virtual ISO.
984 </para>
985
986 <para>
987 Click <emphasis role="bold">Add Items To
988 VISO</emphasis>. The files are displayed in the
989 <emphasis role="bold">VISO Content</emphasis> pane.
990 </para>
991
992 <para>
993 The following file operations are also available:
994 </para>
995
996 <itemizedlist>
997
998 <listitem>
999 <para>
1000 To create folders on the virtual ISO, click
1001 <emphasis role="bold">Create New
1002 Directory</emphasis>.
1003 </para>
1004 </listitem>
1005
1006 <listitem>
1007 <para>
1008 To remove files from the virtual ISO, select files
1009 in the <emphasis role="bold">VISO Content</emphasis>
1010 pane and click <emphasis role="bold">Remove Items
1011 From VISO</emphasis>.
1012 </para>
1013 </listitem>
1014
1015 <listitem>
1016 <para>
1017 To remove <emphasis>all</emphasis> files from the
1018 virtual ISO, click <emphasis role="bold">Reset the
1019 VISO Content</emphasis>.
1020 </para>
1021 </listitem>
1022
1023 </itemizedlist>
1024 </listitem>
1025
1026 </orderedlist>
1027 </listitem>
1028
1029 <listitem>
1030 <para>
1031 Create the virtual ISO image.
1032 </para>
1033
1034 <para>
1035 Click <emphasis role="bold">Create</emphasis>.
1036 </para>
1037
1038 <para>
1039 A virtual ISO file with the specified name and content is
1040 created.
1041 </para>
1042 </listitem>
1043
1044 </orderedlist>
1045
1046 </sect2>
1047
1048 <sect2 id="create-floppy-disk-image">
1049
1050 <title>Creating a Virtual Floppy Disk Image</title>
1051
1052 <para>
1053 Use the <emphasis role="bold">Floppy Disk Creator</emphasis>
1054 tool to create a floppy disk image.
1055 </para>
1056
1057 <orderedlist>
1058
1059 <listitem>
1060 <para>
1061 Display the <emphasis role="bold">Floppy Disks</emphasis>
1062 tab in Virtual Media Manager and click
1063 <emphasis role="bold">Create</emphasis>.
1064 </para>
1065
1066 <para>
1067 The <emphasis role="bold">Floppy Disk Creator</emphasis>
1068 tool is shown.
1069 </para>
1070 </listitem>
1071
1072 <listitem>
1073 <para>
1074 Configure the following settings:
1075 </para>
1076
1077 <itemizedlist>
1078
1079 <listitem>
1080 <para>
1081 <emphasis role="bold">File Path:</emphasis> The name and
1082 location of the floppy disk image.
1083 </para>
1084 </listitem>
1085
1086 <listitem>
1087 <para>
1088 <emphasis role="bold">Size:</emphasis> Select from the
1089 list of supported floppy disk sizes.
1090 </para>
1091 </listitem>
1092
1093 <listitem>
1094 <para>
1095 <emphasis role="bold">Format Disk as FAT 12:</emphasis>
1096 This is the default format used for most floppy disks.
1097 For an unformatted disk, do not select this option.
1098 </para>
1099 </listitem>
1100
1101 </itemizedlist>
1102 </listitem>
1103
1104 <listitem>
1105 <para>
1106 Create the floppy disk image file.
1107 </para>
1108
1109 <para>
1110 Click <emphasis role="bold">Create</emphasis>.
1111 </para>
1112
1113 <para>
1114 The floppy disk image is created in the specified location
1115 and added to the <emphasis role="bold">Floppy
1116 Disks</emphasis> tab in Virtual Media Manager.
1117 </para>
1118 </listitem>
1119
1120 </orderedlist>
1121
1122 </sect2>
1123
1124 </sect1>
1125
1126 <sect1 id="hdimagewrites">
1127
1128 <title>Special Image Write Modes</title>
1129
1130 <para>
1131 For each virtual disk image supported by &product-name;, you can
1132 determine separately how it should be affected by write operations
1133 from a virtual machine and snapshot operations. This applies to
1134 all of the aforementioned image formats (VDI, VMDK, VHD, or HDD)
1135 and irrespective of whether an image is fixed-size or dynamically
1136 allocated.
1137 </para>
1138
1139 <para>
1140 By default, images are in <emphasis>normal</emphasis> mode. To
1141 mark an existing image with one of the non-standard modes listed
1142 below, use <command>VBoxManage modifymedium</command>. See
1143 <xref linkend="vboxmanage-modifymedium" />. Alternatively, use
1144 <command>VBoxManage storageattach</command> to attach the image to
1145 a VM and specify the <option>--mtype</option> argument. See
1146 <xref linkend="vboxmanage-storageattach" />.
1147 </para>
1148
1149 <para>
1150 The available virtual disk image modes are as follows:
1151 </para>
1152
1153 <itemizedlist>
1154
1155 <listitem>
1156 <para>
1157 <emphasis role="bold">Normal images</emphasis> have no
1158 restrictions on how guests can read from and write to the
1159 disk. This is the default image mode.
1160 </para>
1161
1162 <para>
1163 When you take a snapshot of your virtual machine as described
1164 in <xref linkend="snapshots" />, the state of a normal hard
1165 disk is recorded together with the snapshot, and when
1166 reverting to the snapshot, its state will be fully reset.
1167 </para>
1168
1169 <para>
1170 The image file itself is not reset. Instead, when a snapshot
1171 is taken, &product-name; <emphasis>freezes</emphasis> the
1172 image file and no longer writes to it. For the write
1173 operations from the VM, a second,
1174 <emphasis>differencing</emphasis> image file is created which
1175 receives only the changes to the original image. See
1176 <xref linkend="diffimages"/>.
1177 </para>
1178
1179 <para>
1180 While you can attach the same normal image to more than one
1181 virtual machine, only one of these virtual machines attached
1182 to the same image file can be executed simultaneously, as
1183 otherwise there would be conflicts if several machines write
1184 to the same image file.
1185 </para>
1186 </listitem>
1187
1188 <listitem>
1189 <para>
1190 <emphasis role="bold">Write-through hard disks</emphasis> are
1191 completely unaffected by snapshots. Their state is
1192 <emphasis>not</emphasis> saved when a snapshot is taken, and
1193 not restored when a snapshot is restored.
1194 </para>
1195 </listitem>
1196
1197 <listitem>
1198 <para>
1199 <emphasis role="bold">Shareable hard disks</emphasis> are a
1200 variant of write-through hard disks. In principle they behave
1201 exactly the same. Their state is <emphasis>not</emphasis>
1202 saved when a snapshot is taken, and not restored when a
1203 snapshot is restored. The difference only shows if you attach
1204 such disks to several VMs. Shareable disks may be attached to
1205 several VMs which may run concurrently. This makes them
1206 suitable for use by cluster filesystems between VMs and
1207 similar applications which are explicitly prepared to access a
1208 disk concurrently. Only fixed size images can be used in this
1209 way, and dynamically allocated images are rejected.
1210 </para>
1211
1212 <warning>
1213 <para>
1214 This is an expert feature, and misuse can lead to data loss,
1215 as regular filesystems are not prepared to handle
1216 simultaneous changes by several parties.
1217 </para>
1218 </warning>
1219 </listitem>
1220
1221 <listitem>
1222 <para>
1223 <emphasis role="bold">Immutable images</emphasis> only
1224 remember write accesses temporarily while the virtual machine
1225 is running. All changes are lost when the virtual machine is
1226 powered on the next time. As a result, as opposed to Normal
1227 images, the same immutable image can be used with several
1228 virtual machines without restrictions.
1229 </para>
1230
1231 <para>
1232 Creating an immutable image makes little sense since it would
1233 be initially empty and lose its contents with every machine
1234 restart. You would have a disk that is always unformatted when
1235 the machine starts up. Instead, you can first create a normal
1236 image and then later mark it as immutable when you decide that
1237 the contents are useful.
1238 </para>
1239
1240 <para>
1241 If you take a snapshot of a machine with immutable images,
1242 then on every machine power-up, those images are reset to the
1243 state of the last (current) snapshot, instead of the state of
1244 the original immutable image.
1245 </para>
1246
1247 <note>
1248 <para>
1249 As a special exception, immutable images are
1250 <emphasis>not</emphasis> reset if they are attached to a
1251 machine in a saved state or whose last snapshot was taken
1252 while the machine was running. This is called an
1253 <emphasis>online snapshot</emphasis>. As a result, if the
1254 machine's current snapshot is an online snapshot, its
1255 immutable images behave exactly like the a normal image. To
1256 reenable the automatic resetting of such images, delete the
1257 current snapshot of the machine.
1258 </para>
1259 </note>
1260
1261 <para>
1262 &product-name; never writes to an immutable image directly at
1263 all. All write operations from the machine are directed to a
1264 differencing image. The next time the VM is powered on, the
1265 differencing image is reset so that every time the VM starts,
1266 its immutable images have exactly the same content.
1267 </para>
1268
1269 <para>
1270 The differencing image is only reset when the machine is
1271 powered on from within &product-name;, not when you reboot by
1272 requesting a reboot from within the machine. This is also why
1273 immutable images behave as described above when snapshots are
1274 also present, which use differencing images as well.
1275 </para>
1276
1277 <para>
1278 If the automatic discarding of the differencing image on VM
1279 startup does not fit your needs, you can turn it off using the
1280 <option>autoreset</option> parameter of <command>VBoxManage
1281 modifymedium</command>. See
1282 <xref linkend="vboxmanage-modifymedium"/>.
1283 </para>
1284 </listitem>
1285
1286 <listitem>
1287 <para>
1288 <emphasis role="bold">Multiattach mode images</emphasis> can
1289 be attached to more than one virtual machine at the same time,
1290 even if these machines are running simultaneously. For each
1291 virtual machine to which such an image is attached, a
1292 differencing image is created. As a result, data that is
1293 written to such a virtual disk by one machine is not seen by
1294 the other machines to which the image is attached. Each
1295 machine creates its own write history of the multiattach
1296 image.
1297 </para>
1298
1299 <para>
1300 Technically, a multiattach image behaves identically to an
1301 immutable image except the differencing image is not reset
1302 every time the machine starts.
1303 </para>
1304
1305 <para>
1306 This mode is useful for sharing files which are almost never
1307 written, for instance picture galleries, where every guest
1308 changes only a small amount of data and the majority of the
1309 disk content remains unchanged. The modified blocks are stored
1310 in differencing images which remain relatively small and the
1311 shared content is stored only once at the host.
1312 </para>
1313 </listitem>
1314
1315 <listitem>
1316 <para>
1317 <emphasis role="bold">Read-only images</emphasis> are used
1318 automatically for CD/DVD images, since CDs/DVDs can never be
1319 written to.
1320 </para>
1321 </listitem>
1322
1323 </itemizedlist>
1324
1325 <para>
1326 The following scenario illustrates the differences between the
1327 various image modes, with respect to snapshots.
1328 </para>
1329
1330 <para>
1331 Assume you have installed your guest OS in your VM, and you have
1332 taken a snapshot. Later, your VM is infected with a virus and you
1333 would like to go back to the snapshot. With a normal hard disk
1334 image, you simply restore the snapshot, and the earlier state of
1335 your hard disk image will be restored as well and your virus
1336 infection will be undone. With an immutable hard disk, all it
1337 takes is to shut down and power on your VM, and the virus
1338 infection will be discarded. With a write-through image however,
1339 you cannot easily undo the virus infection by means of
1340 virtualization, but will have to disinfect your virtual machine
1341 like a real computer.
1342 </para>
1343
1344 <para>
1345 You might find write-through images useful if you want to preserve
1346 critical data irrespective of snapshots. As you can attach more
1347 than one image to a VM, you may want to have one immutable image
1348 for the OS and one write-through image for your data files.
1349 </para>
1350
1351 </sect1>
1352
1353 <sect1 id="diffimages">
1354
1355 <title>Differencing Images</title>
1356
1357 <para>
1358 The previous section mentioned differencing images and how they
1359 are used with snapshots, immutable images, and multiple disk
1360 attachments. This section describes in more detail how
1361 differencing images work.
1362 </para>
1363
1364 <para>
1365 A differencing image is a special disk image that only holds the
1366 differences to another image. A differencing image by itself is
1367 useless, it must always refer to another image. The differencing
1368 image is then typically referred to as a
1369 <emphasis>child</emphasis>, which holds the differences to its
1370 <emphasis>parent</emphasis>.
1371 </para>
1372
1373 <para>
1374 When a differencing image is active, it receives all write
1375 operations from the virtual machine instead of its parent. The
1376 differencing image only contains the sectors of the virtual hard
1377 disk that have changed since the differencing image was created.
1378 When the machine reads a sector from such a virtual hard disk, it
1379 looks into the differencing image first. If the sector is present,
1380 it is returned from there. If not, &product-name; looks into the
1381 parent. In other words, the parent becomes
1382 <emphasis>read-only</emphasis>. It is never written to again, but
1383 it is read from if a sector has not changed.
1384 </para>
1385
1386 <para>
1387 Differencing images can be chained. If another differencing image
1388 is created for a virtual disk that already has a differencing
1389 image, then it becomes a <emphasis>grandchild</emphasis> of the
1390 original parent. The first differencing image then becomes
1391 read-only as well, and write operations only go to the
1392 second-level differencing image. When reading from the virtual
1393 disk, &product-name; needs to look into the second differencing
1394 image first, then into the first if the sector was not found, and
1395 then into the original image.
1396 </para>
1397
1398 <para>
1399 There can be an unlimited number of differencing images, and each
1400 image can have more than one child. As a result, the differencing
1401 images can form a complex tree with parents, siblings, and
1402 children, depending on how complex your machine configuration is.
1403 Write operations always go to the one <emphasis>active</emphasis>
1404 differencing image that is attached to the machine, and for read
1405 operations, &product-name; may need to look up all the parents in
1406 the chain until the sector in question is found. You can view such
1407 a tree in the Virtual Media Manager.
1408 </para>
1409
1410 <figure id="fig-diff-images">
1411 <title>Differencing Images, Shown in Virtual Media Manager</title>
1412 <mediaobject>
1413 <imageobject>
1414 <imagedata align="center" fileref="images/virtual-disk-manager-2.png"
1415 width="12cm" />
1416 </imageobject>
1417 </mediaobject>
1418 </figure>
1419
1420 <para>
1421 In all of these situations, from the point of view of the virtual
1422 machine, the virtual hard disk behaves like any other disk. While
1423 the virtual machine is running, there is a slight run-time I/O
1424 overhead because &product-name; might need to look up sectors
1425 several times. This is not noticeable however since the tables
1426 with sector information are always kept in memory and can be
1427 looked up quickly.
1428 </para>
1429
1430 <para>
1431 Differencing images are used in the following situations:
1432 </para>
1433
1434 <itemizedlist>
1435
1436 <listitem>
1437 <para>
1438 <emphasis role="bold">Snapshots.</emphasis> When you create a
1439 snapshot, as explained in the previous section, &product-name;
1440 <emphasis>freezes</emphasis> the images attached to the
1441 virtual machine and creates differencing images for each image
1442 that is not in <emphasis>write-through</emphasis> mode. From
1443 the point of view of the virtual machine, the virtual disks
1444 continue to operate before, but all write operations go into
1445 the differencing images. Each time you create another
1446 snapshot, for each hard disk attachment, another differencing
1447 image is created and attached, forming a chain or tree.
1448 </para>
1449
1450 <para>
1451 In the above screenshot, you see that the original disk image
1452 is now attached to a snapshot, representing the state of the
1453 disk when the snapshot was taken.
1454 </para>
1455
1456 <para>
1457 If you <emphasis>restore</emphasis> a snapshot, and want to go
1458 back to the exact machine state that was stored in the
1459 snapshot, the following happens:
1460 </para>
1461
1462 <itemizedlist>
1463
1464 <listitem>
1465 <para>
1466 &product-name; copies the virtual machine settings that
1467 were copied into the snapshot back to the virtual machine.
1468 As a result, if you have made changes to the machine
1469 configuration since taking the snapshot, they are undone.
1470 </para>
1471 </listitem>
1472
1473 <listitem>
1474 <para>
1475 If the snapshot was taken while the machine was running,
1476 it contains a saved machine state, and that state is
1477 restored as well. After restoring the snapshot, the
1478 machine will then be in Saved state and resume execution
1479 from there when it is next started. Otherwise the machine
1480 will be in Powered Off state and do a full boot.
1481 </para>
1482 </listitem>
1483
1484 <listitem>
1485 <para>
1486 For each disk image attached to the machine, the
1487 differencing image holding all the write operations since
1488 the current snapshot was taken is thrown away, and the
1489 original parent image is made active again. If you
1490 restored the root snapshot, then this will be the root
1491 disk image for each attachment. Otherwise, some other
1492 differencing image descended from it. This effectively
1493 restores the old machine state.
1494 </para>
1495 </listitem>
1496
1497 </itemizedlist>
1498
1499 <para>
1500 If you later <emphasis>delete</emphasis> a snapshot in order
1501 to free disk space, for each disk attachment, one of the
1502 differencing images becomes obsolete. In this case, the
1503 differencing image of the disk attachment cannot simply be
1504 deleted. Instead, &product-name; needs to look at each sector
1505 of the differencing image and needs to copy it back into its
1506 parent. This is called "merging" images and can be a
1507 potentially lengthy process, depending on how large the
1508 differencing image is. It can also temporarily need a
1509 considerable amount of extra disk space, before the
1510 differencing image obsoleted by the merge operation is
1511 deleted.
1512 </para>
1513 </listitem>
1514
1515 <listitem>
1516 <para>
1517 <emphasis role="bold">Immutable images.</emphasis> When an
1518 image is switched to immutable mode, a differencing image is
1519 created as well. As with snapshots, the parent image then
1520 becomes read-only, and the differencing image receives all the
1521 write operations. Every time the virtual machine is started,
1522 all the immutable images which are attached to it have their
1523 respective differencing image thrown away, effectively
1524 resetting the virtual machine's virtual disk with every
1525 restart.
1526 </para>
1527 </listitem>
1528
1529 </itemizedlist>
1530
1531 </sect1>
1532
1533 <sect1 id="cloningvdis">
1534
1535 <title>Cloning Disk Images</title>
1536
1537 <para>
1538 You can duplicate hard disk image files on the same host to
1539 quickly produce a second virtual machine with the same OS setup.
1540 However, you should <emphasis>only</emphasis> make copies of
1541 virtual disk images using the utility supplied with
1542 &product-name;. See <xref linkend="vboxmanage-clonemedium" />.
1543 This is because &product-name; assigns a UUID to each disk image,
1544 which is also stored inside the image, and &product-name; will
1545 refuse to work with two images that use the same number. If you do
1546 accidentally try to reimport a disk image which you copied
1547 normally, you can make a second copy using the <command>VBoxManage
1548 clonevm</command> command and import that instead.
1549 </para>
1550
1551 <para>
1552 Note that Linux distributions identify the boot hard disk from the
1553 ID of the drive. The ID &product-name; reports for a drive is
1554 determined from the UUID of the virtual disk image. So if you
1555 clone a disk image and try to boot the copied image the guest
1556 might not be able to determine its own boot disk as the UUID
1557 changed. In this case you have to adapt the disk ID in your boot
1558 loader script, for example
1559 <filename>/boot/grub/menu.lst</filename>. The disk ID looks like
1560 the following:
1561 </para>
1562
1563<screen>scsi-SATA_VBOX_HARDDISK_VB5cfdb1e2-c251e503</screen>
1564
1565 <para>
1566 The ID for the copied image can be determined as follows:
1567 </para>
1568
1569<screen>hdparm -i /dev/sda</screen>
1570
1571 </sect1>
1572
1573 <sect1 id="iocaching">
1574
1575 <title>Host Input/Output Caching</title>
1576
1577 <para>
1578 &product-name; can optionally disable the I/O caching that the
1579 host OS would otherwise perform on disk image files.
1580 </para>
1581
1582 <para>
1583 Traditionally, &product-name; has opened disk image files as
1584 normal files, which results in them being cached by the host OS
1585 like any other file. The main advantage of this is speed: when the
1586 guest OS writes to disk and the host OS cache uses delayed
1587 writing, the write operation can be reported as completed to the
1588 guest OS quickly while the host OS can perform the operation
1589 asynchronously. Also, when you start a VM a second time and have
1590 enough memory available for the OS to use for caching, large parts
1591 of the virtual disk may be in system memory, and the VM can access
1592 the data much faster.
1593 </para>
1594
1595 <para>
1596 Note that this applies only to image files. Buffering does not
1597 occur for virtual disks residing on remote iSCSI storage, which is
1598 the more common scenario in enterprise-class setups. See
1599 <xref linkend="storage-iscsi" />.
1600 </para>
1601
1602 <para>
1603 While buffering is a useful default setting for virtualizing a few
1604 machines on a desktop computer, there are some disadvantages to
1605 this approach:
1606 </para>
1607
1608 <itemizedlist>
1609
1610 <listitem>
1611 <para>
1612 Delayed writing through the host OS cache is less secure. When
1613 the guest OS writes data, it considers the data written even
1614 though it has not yet arrived on a physical disk. If for some
1615 reason the write does not happen, such as power failure or
1616 host crash, the likelihood of data loss increases.
1617 </para>
1618 </listitem>
1619
1620 <listitem>
1621 <para>
1622 Disk image files tend to be very large. Caching them can
1623 therefore quickly use up the entire host OS cache. Depending
1624 on the efficiency of the host OS caching, this may slow down
1625 the host immensely, especially if several VMs run at the same
1626 time. For example, on Linux hosts, host caching may result in
1627 Linux delaying all writes until the host cache is nearly full
1628 and then writing out all these changes at once, possibly
1629 stalling VM execution for minutes. This can result in I/O
1630 errors in the guest as I/O requests time out there.
1631 </para>
1632 </listitem>
1633
1634 <listitem>
1635 <para>
1636 Physical memory is often wasted as guest OSes typically have
1637 their own I/O caches, which may result in the data being
1638 cached twice, in both the guest and the host caches, for
1639 little effect.
1640 </para>
1641 </listitem>
1642
1643 </itemizedlist>
1644
1645 <para>
1646 If you decide to disable host I/O caching for the above reasons,
1647 &product-name; uses its own small cache to buffer writes, but no
1648 read caching since this is typically already performed by the
1649 guest OS. In addition, &product-name; fully supports asynchronous
1650 I/O for its virtual SATA, SCSI, and SAS controllers through
1651 multiple I/O threads.
1652 </para>
1653
1654 <para>
1655 Since asynchronous I/O is not supported by IDE controllers, for
1656 performance reasons, you may want to leave host caching enabled
1657 for your VM's virtual IDE controllers.
1658 </para>
1659
1660 <para>
1661 For this reason, &product-name; enables you to configure whether
1662 the host I/O cache is used for each I/O controller separately.
1663 Either select the <emphasis role="bold">Use Host I/O
1664 Cache</emphasis> check box in the
1665 <emphasis role="bold">Storage</emphasis> settings for a given
1666 virtual storage controller, or use the following
1667 <command>VBoxManage</command> command to disable the host I/O
1668 cache for a virtual storage controller:
1669 </para>
1670
1671<screen>VBoxManage storagectl "VM name" --name &lt;controllername&gt; --hostiocache off</screen>
1672
1673 <para>
1674 See <xref linkend="vboxmanage-storagectl" />.
1675 </para>
1676
1677 <para>
1678 For the above reasons, &product-name; uses SATA controllers by
1679 default for new virtual machines.
1680 </para>
1681
1682 </sect1>
1683
1684 <sect1 id="storage-bandwidth-limit">
1685
1686 <title>Limiting Bandwidth for Disk Images</title>
1687
1688 <para>
1689 &product-name; supports limiting of the maximum bandwidth used for
1690 asynchronous I/O. Additionally it supports sharing limits through
1691 bandwidth groups for several images. It is possible to have more
1692 than one such limit.
1693 </para>
1694
1695 <para>
1696 Limits are configured using <command>VBoxManage</command>. The
1697 example below creates a bandwidth group named Limit, sets the
1698 limit to 20 MB per second, and assigns the group to the attached
1699 disks of the VM:
1700 </para>
1701
1702<screen>VBoxManage bandwidthctl "VM name" add Limit --type disk --limit 20M
1703VBoxManage storageattach "VM name" --storagectl "SATA" --port 0 --device 0 --type hdd
1704 --medium disk1.vdi --bandwidthgroup Limit
1705VBoxManage storageattach "VM name" --storagectl "SATA" --port 1 --device 0 --type hdd
1706 --medium disk2.vdi --bandwidthgroup Limit</screen>
1707
1708 <para>
1709 All disks in a group share the bandwidth limit, meaning that in
1710 the example above the bandwidth of both images combined can never
1711 exceed 20 MBps. However, if one disk does not require bandwidth
1712 the other can use the remaining bandwidth of its group.
1713 </para>
1714
1715 <para>
1716 The limits for each group can be changed while the VM is running,
1717 with changes being picked up immediately. The example below
1718 changes the limit for the group created in the example above to 10
1719 MBps:
1720 </para>
1721
1722<screen>VBoxManage bandwidthctl "VM name" set Limit --limit 10M</screen>
1723
1724 </sect1>
1725
1726 <sect1 id="storage-cds">
1727
1728 <title>CD/DVD Support</title>
1729
1730 <para>
1731 Virtual CD/DVD drives by default support only reading. The medium
1732 configuration is changeable at runtime. You can select between the
1733 following options to provide the medium data:
1734 </para>
1735
1736 <itemizedlist>
1737
1738 <listitem>
1739 <para>
1740 <emphasis role="bold">Host Drive</emphasis> defines that the
1741 guest can read from the medium in the host drive.
1742 </para>
1743 </listitem>
1744
1745 <listitem>
1746 <para>
1747 <emphasis role="bold">Image file</emphasis> gives the guest
1748 read-only access to the data in the image. This is typically
1749 an ISO file.
1750 </para>
1751 </listitem>
1752
1753 <listitem>
1754 <para>
1755 <emphasis role="bold">Empty</emphasis> means a drive without
1756 an inserted medium.
1757 </para>
1758 </listitem>
1759
1760 </itemizedlist>
1761
1762 <para>
1763 Changing between the above, or changing a medium in the host drive
1764 that is accessed by a machine, or changing an image file will
1765 signal a medium change to the guest OS. The guest OS can then
1766 react to the change, for example by starting an installation
1767 program.
1768 </para>
1769
1770 <para>
1771 Medium changes can be prevented by the guest, and &product-name;
1772 reflects that by locking the host drive if appropriate. You can
1773 force a medium removal in such situations by using the VirtualBox
1774 Manager or the <command>VBoxManage</command> command line tool.
1775 Effectively this is the equivalent of the emergency eject which
1776 many CD/DVD drives provide, with all associated side effects. The
1777 guest OS can issue error messages, just like on real hardware, and
1778 guest applications may misbehave. Use this with caution.
1779 </para>
1780
1781 <note>
1782 <para>
1783 The identification string of the drive provided to the guest,
1784 displayed by configuration tools such as the Windows Device
1785 Manager, is always VBOX CD-ROM, irrespective of the current
1786 configuration of the virtual drive. This is to prevent hardware
1787 detection from being triggered in the guest OS every time the
1788 configuration is changed.
1789 </para>
1790 </note>
1791
1792 <para>
1793 The standard CD/DVD emulation enables reading of standard data CD
1794 and DVD formats only. As an experimental feature, for additional
1795 capabilities, it is possible to give the guest direct access to
1796 the CD/DVD host drive by enabling <emphasis>passthrough</emphasis>
1797 mode. Depending on the host hardware, this may potentially enable
1798 the following things to work:
1799 </para>
1800
1801 <itemizedlist>
1802
1803 <listitem>
1804 <para>
1805 CD/DVD writing from within the guest, if the host DVD drive is
1806 a CD/DVD writer
1807 </para>
1808 </listitem>
1809
1810 <listitem>
1811 <para>
1812 Playing audio CDs
1813 </para>
1814 </listitem>
1815
1816 <listitem>
1817 <para>
1818 Playing encrypted DVDs
1819 </para>
1820 </listitem>
1821
1822 </itemizedlist>
1823
1824 <para>
1825 To enable host drive passthrough you can use the
1826 <option>--passthrough</option> option of the <command>VBoxManage
1827 storageattach</command> command. See
1828 <xref linkend="vboxmanage-storageattach" />.
1829 </para>
1830
1831 <para>
1832 Even if passthrough is enabled, unsafe commands, such as updating
1833 the drive firmware, will be blocked. Video CD formats are never
1834 supported, not even in passthrough mode, and cannot be played from
1835 a virtual machine.
1836 </para>
1837
1838 <para>
1839 On Oracle Solaris hosts, passthrough requires running
1840 &product-name; with real root permissions due to security measures
1841 enforced by the host.
1842 </para>
1843
1844 </sect1>
1845
1846 <sect1 id="storage-iscsi">
1847
1848 <title>iSCSI Servers</title>
1849
1850 <para>
1851 iSCSI stands for <emphasis>Internet SCSI</emphasis> and is a
1852 standard that supports use of the SCSI protocol over Internet
1853 (TCP/IP) connections. Especially with the advent of Gigabit
1854 Ethernet, it has become affordable to attach iSCSI storage servers
1855 simply as remote hard disks to a computer network. In iSCSI
1856 terminology, the server providing storage resources is called an
1857 <emphasis>iSCSI target</emphasis>, while the client connecting to
1858 the server and accessing its resources is called an
1859 <emphasis>iSCSI initiator</emphasis>.
1860 </para>
1861
1862 <para>
1863 &product-name; can transparently present iSCSI remote storage to a
1864 virtual machine as a virtual hard disk. The guest OS will not see
1865 any difference between a virtual disk image (VDI file) and an
1866 iSCSI target. To achieve this, &product-name; has an integrated
1867 iSCSI initiator.
1868 </para>
1869
1870 <para>
1871 &product-name;'s iSCSI support has been developed according to the
1872 iSCSI standard and should work with all standard-conforming iSCSI
1873 targets. To use an iSCSI target with &product-name;, you must use
1874 the command line. See <xref linkend="vboxmanage-storageattach" />.
1875 </para>
1876
1877 </sect1>
1878
1879 <sect1 id="vboximg-mount">
1880
1881 <title>vboximg-mount: A Utility for FUSE Mounting a Virtual Disk Image</title>
1882
1883 <para>
1884 <command>vboximg-mount</command> is a command line utility for Mac
1885 OS and Linux hosts that provides raw access to an &product-name;
1886 virtual disk image on the host system. Use this utility to mount,
1887 view, and optionally modify the disk image contents.
1888 </para>
1889
1890 <para>
1891 The utility is based on Filesystem in Userspace (FUSE) technology
1892 and uses the VirtualBox runtime engine. Ensure that &product-name;
1893 is running on the host system.
1894 </para>
1895
1896 <note>
1897 <para>
1898 When using <command>vboximg-mount</command>, ensure that the
1899 following conditions apply:
1900 </para>
1901
1902 <itemizedlist>
1903
1904 <listitem>
1905 <para>
1906 The disk image is not being used by any other systems, such
1907 as by guest VMs.
1908 </para>
1909 </listitem>
1910
1911 <listitem>
1912 <para>
1913 No VMs are running on the host system.
1914 </para>
1915 </listitem>
1916
1917 </itemizedlist>
1918 </note>
1919
1920 <para>
1921 Raw access using FUSE is preferred over direct loopback mounting
1922 of virtual disk images, because it is snapshot aware. It can
1923 selectively merge disk differencing images in an exposed virtual
1924 hard disk, providing historical or up-to-date representations of
1925 the virtual disk contents.
1926 </para>
1927
1928 <para>
1929 <command>vboximg-mount</command> enables you to view information
1930 about registered VMs, their attached disk media, and any
1931 snapshots. Also, you can view partition information for a disk
1932 image.
1933 </para>
1934
1935 <para>
1936 The <command>vboximg-mount </command>command includes experimental
1937 read-only access to file systems inside a VM disk image. This
1938 feature enables you to extract some files from the disk image
1939 without starting the VM and without requiring third-party file
1940 system drivers on the host system. FAT, NTFS, ext2, ext3, and ext4
1941 file systems are supported.
1942 </para>
1943
1944 <para>
1945 Use the <option>--help</option> option to view information about
1946 the <command>vboximg-mount</command> command usage. The complete
1947 command reference is described in
1948 <xref linkend="man_vboximg-mount" />.
1949 </para>
1950
1951 <para>
1952 When <command>vboximg-mount</command> mounts an &product-name;
1953 disk image, it creates a one level deep file system at a mount
1954 point that you specify. The file system includes a device node
1955 that represents the synthesized disk image as a readable or
1956 readable-writeable bytestream. This bytestream can be mounted
1957 either by using the host OS or by using other FUSE-based file
1958 systems.
1959 </para>
1960
1961 <sect2 id="vboximg-mount-display">
1962
1963 <title>Viewing Detailed Information About a Virtual Disk Image</title>
1964
1965 <para>
1966 The following examples show how to use the
1967 <command>vboximg-mount</command> command to view information
1968 about virtual disk images.
1969 </para>
1970
1971 <para>
1972 The following command outputs detailed information about all
1973 registered VMs and associated snapshots:
1974 </para>
1975
1976<screen>$ vboximg-mount --list --verbose
1977
1978 ------------------------------------------------------
1979 VM Name: "macOS High Sierra 10.13"
1980 UUID: 3887d96d-831c-4187-a55a-567c504ff0e1
1981 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/macOS High Sierra 10.13.vbox
1982 -----------------------
1983 HDD base: "macOS High Sierra 10.13.vdi"
1984 UUID: f9ea7173-6869-4aa9-b487-68023a655980
1985 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/macOS High Sierra 10.13.vdi
1986
1987 Diff 1:
1988 UUID: 98c2bac9-cf37-443d-a935-4e879b70166d
1989 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/
1990 Snapshots/{98c2bac9-cf37-443d-a935-4e879b70166d}.vdi
1991 Diff 2:
1992 UUID: f401f381-7377-40b3-948e-3c61241b1a42
1993 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/
1994 Snapshots/{f401f381-7377-40b3-948e-3c61241b1a42}.vdi
1995 -----------------------
1996 HDD base: "simple_fixed_disk.vdi"
1997 UUID: ffba4d7e-1277-489d-8173-22ca7660773d
1998 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/simple_fixed_disk.vdi
1999
2000 Diff 1:
2001 UUID: aecab681-0d2d-468b-8682-93f79dc97a48
2002 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/
2003 Snapshots/{aecab681-0d2d-468b-8682-93f79dc97a48}.vdi
2004 Diff 2:
2005 UUID: 70d6b34d-8422-47fa-8521-3b6929a1971c
2006 Location: /Volumes/work/vm_guests/macOS High Sierra 10.13/
2007 Snapshots/{70d6b34d-8422-47fa-8521-3b6929a1971c}.vdi
2008 ------------------------------------------------------
2009 VM Name: "debian"
2010 UUID: 5365ab5f-470d-44c0-9863-dad532ee5905
2011 Location: /Volumes/work/vm_guests/debian/debian.vbox
2012 -----------------------
2013 HDD base: "debian.vdi"
2014 UUID: 96d2e92e-0d4e-46ab-a0f1-008fdbf997e7
2015 Location: /Volumes/work/vm_guests/debian/ol7.vdi
2016
2017 Diff 1:
2018 UUID: f9cc866a-9166-42e9-a503-bbfe9b7312e8
2019 Location: /Volumes/work/vm_guests/debian/Snapshots/
2020 {f9cc866a-9166-42e9-a503-bbfe9b7312e8}.vdi</screen>
2021
2022 <para>
2023 The following command outputs partition information about the
2024 specified disk image:
2025 </para>
2026
2027<screen>$ vboximg-mount --image=f9ea7173-6869-4aa9-b487-68023a655980 --list
2028
2029 Virtual disk image:
2030
2031 Path: /Volumes/work/vm_guests/macOS High Sierra 10.13/macOS High Sierra 10.13.vdi
2032 UUID: f9ea7173-6869-4aa9-b487-68023a655980
2033
2034 # Start Sectors Size Offset Type
2035 1 40 409599 199.9M 20480 EFI System
2036 2 409640 67453071 32.1G 209735680 Hierarchical File System Plus (HFS+)
2037 3 67862712 1269535 107.8M 34745708544 Apple Boot (Recovery HD)</screen>
2038
2039 </sect2>
2040
2041 <sect2 id="vboximg-mount-steps">
2042
2043 <title>Mounting a Virtual Disk Image</title>
2044
2045 <para>
2046 The following steps show how to use the
2047 <command>vboximg-mount</command> command to mount a partition of
2048 a virtual disk image on the host OS.
2049 </para>
2050
2051 <orderedlist>
2052
2053 <listitem>
2054 <para>
2055 Create a mount point on the host OS. For example:
2056 </para>
2057
2058<screen>$ mkdir macos_sysdisk</screen>
2059 </listitem>
2060
2061 <listitem>
2062 <para>
2063 Show partition information about the virtual disk image.
2064 </para>
2065
2066<screen>$ vboximg-mount --image=<replaceable>uuid</replaceable> --list</screen>
2067
2068 <para>
2069 where <replaceable>uuid</replaceable> is the UUID of the
2070 disk image.
2071 </para>
2072 </listitem>
2073
2074 <listitem>
2075 <para>
2076 Use <command>vboximg-mount</command> to perform a FUSE mount
2077 of a partition on the virtual disk image. For example:
2078 </para>
2079
2080<screen>$ vboximg-mount --image=<replaceable>uuid</replaceable> -p 2 macos_sysdisk</screen>
2081
2082 <para>
2083 where <replaceable>uuid</replaceable> is the UUID for the
2084 disk image.
2085 </para>
2086
2087 <para>
2088 In this example, partition 2 is mounted on the
2089 <filename>macos_sysdisk</filename> mount point. The mount
2090 includes all snapshots for the disk image.
2091 </para>
2092 </listitem>
2093
2094 <listitem>
2095 <para>
2096 Use the host OS to mount the <literal>vhdd</literal> device
2097 node. The FUSE-mounted device node represents the virtual
2098 disk image.
2099 </para>
2100
2101<screen>$ ls macos_sysdisk
2102 macOS High Sierra 10.13.vdi vhdd
2103$ sudo mount macos_sysdisk/vhdd /mnt</screen>
2104 </listitem>
2105
2106 </orderedlist>
2107
2108 </sect2>
2109
2110 </sect1>
2111
2112</chapter>
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