VirtualBox

source: vbox/trunk/doc/manual/en_US/man_VBoxManage-storageattach.xml@ 96301

最後變更 在這個檔案從96301是 96300,由 vboxsync 提交於 3 年 前

doc: comment fixing

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 23.2 KB
 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 manpage, user manual, usage: VBoxManage storageattach
4-->
5<!--
6 Copyright (C) 2006-2020 Oracle Corporation
7
8 This file is part of VirtualBox Open Source Edition (OSE), as
9 available from http://www.alldomusa.eu.org. This file is free software;
10 you can redistribute it and/or modify it under the terms of the GNU
11 General Public License (GPL) as published by the Free Software
12 Foundation, in version 2 as it comes in the "COPYING" file of the
13 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15-->
16<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
17 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
18<!ENTITY % all.entities SYSTEM "all-entities.ent">
19%all.entities;
20]>
21<refentry id="vboxmanage-storageattach" lang="en">
22 <refentryinfo>
23 <pubdate>August 2019</pubdate>
24 <title>VBoxManage storageattach</title>
25 </refentryinfo>
26
27 <refmeta>
28 <refentrytitle>VBoxManage-storageattach</refentrytitle>
29 <manvolnum>1</manvolnum>
30 </refmeta>
31
32 <refnamediv>
33 <refname>VBoxManage-storageattach</refname>
34 <refpurpose>attach, remove, and modify storage media used by a virtual machine</refpurpose>
35 <refclass>&product-name;</refclass>
36 </refnamediv>
37
38 <refsynopsisdiv>
39 <cmdsynopsis id="synopsis-vboxmanage-storageattach">
40<!-- The 'id' is mandatory and must start with 'synopsis-'. -->
41 <command>VBoxManage storageattach</command>
42 <group choice="req">
43 <arg choice="plain"><replaceable>uuid</replaceable></arg>
44 <arg choice="plain"><replaceable>vmname</replaceable></arg>
45 </group>
46 <arg choice="req">--storagectl=<replaceable>name</replaceable></arg>
47 <arg>--bandwidthgroup=<group choice="plain">
48 <arg choice="plain">name</arg>
49 <arg choice="plain">none</arg>
50 </group></arg>
51 <arg>--comment=<replaceable>text</replaceable></arg>
52 <arg>--device=<replaceable>number</replaceable></arg>
53 <arg>--discard=<group choice="plain">
54 <arg choice="plain">on</arg>
55 <arg choice="plain">off</arg>
56 </group></arg>
57 <arg>--encodedlun=<replaceable>lun</replaceable></arg>
58 <arg>--forceunmount</arg>
59 <arg>--hotpluggable=<group choice="plain">
60 <arg choice="plain">on</arg>
61 <arg choice="plain">off</arg>
62 </group></arg>
63 <arg>--initiator=<replaceable>initiator</replaceable></arg>
64 <arg>--intnet</arg>
65 <arg>--lun=<replaceable>lun</replaceable></arg>
66 <arg>--medium=<group choice="plain">
67 <arg choice="plain">none</arg>
68 <arg choice="plain">emptydrive</arg>
69 <arg choice="plain">additions</arg>
70 <arg choice="plain"><replaceable>uuid</replaceable></arg>
71 <arg choice="plain"><replaceable>filename</replaceable></arg>
72 <arg choice="plain">host:<replaceable>drive</replaceable></arg>
73 <arg choice="plain">iscsi</arg>
74 </group></arg>
75 <arg>--mtype=<group choice="plain">
76 <arg choice="plain">normal</arg>
77 <arg choice="plain">writethrough</arg>
78 <arg choice="plain">immutable</arg>
79 <arg choice="plain">shareable</arg>
80 <arg choice="plain">readonly</arg>
81 <arg choice="plain">multiattach</arg>
82 </group></arg>
83 <arg>--nonrotational=<group choice="plain">
84 <arg choice="plain">on</arg>
85 <arg choice="plain">off</arg>
86 </group></arg>
87 <arg>--passthrough=<group choice="plain">
88 <arg choice="plain">on</arg>
89 <arg choice="plain">off</arg>
90 </group></arg>
91 <arg>--passwordfile=<replaceable>file</replaceable></arg>
92 <arg>--password=<replaceable>password</replaceable></arg>
93 <arg>--port=<replaceable>number</replaceable></arg>
94 <arg>--server=<group choice="plain">
95 <arg choice="plain"><replaceable>name</replaceable></arg>
96 <arg choice="plain"><replaceable>ip</replaceable></arg>
97 </group></arg>
98 <arg>--setparentuuid=<replaceable>uuid</replaceable></arg>
99 <arg>--setuuid=<replaceable>uuid</replaceable></arg>
100 <arg>--target=<replaceable>target</replaceable></arg>
101 <arg>--tempeject=<group choice="plain">
102 <arg choice="plain">on</arg>
103 <arg choice="plain">off</arg>
104 </group></arg>
105 <arg>--tport=<replaceable>port</replaceable></arg>
106 <arg>--type=<group choice="plain">
107 <arg choice="plain">dvddrive</arg>
108 <arg choice="plain">fdd</arg>
109 <arg choice="plain">hdd</arg>
110 </group></arg>
111 <arg>--username=<replaceable>username</replaceable></arg>
112 </cmdsynopsis>
113 </refsynopsisdiv>
114
115 <refsect1>
116 <title>Description</title>
117 <para>
118 The <command>VBoxManage storageattach</command> command enables
119 you to manage a storage medium that you connected to a storage
120 controller by using the <command>VBoxManage storagectl</command>
121 command.
122 </para>
123 <variablelist>
124 <varlistentry>
125 <term><replaceable>uuid</replaceable> | <replaceable>vmname</replaceable></term>
126 <listitem><para>
127 Specifies the Universally Unique Identifier (UUID) or the
128 name of the virtual machine (VM).
129 </para></listitem>
130 </varlistentry>
131 <varlistentry>
132 <term><option>--storagectl=<replaceable>name</replaceable></option></term>
133 <listitem><para>
134 Specifies the name of the storage controller. Use the
135 <command>VBoxManage showvminfo</command> command to list the
136 storage controllers that are attached to the VM.
137 </para></listitem>
138 </varlistentry>
139 <varlistentry>
140 <term><option>--port=<replaceable>number</replaceable></option></term>
141 <listitem><para>
142 Specifies the port number of the storage controller to
143 modify. You must specify this option unless the storage
144 controller has only a single port.
145 </para></listitem>
146 </varlistentry>
147 <varlistentry>
148 <term><option>--device=<replaceable>number</replaceable></option></term>
149 <listitem><para>
150 Specifies the port's device number to modify. You must
151 specify this option unless the storage controller has only
152 one device per port.
153 </para></listitem>
154 </varlistentry>
155 <varlistentry>
156 <term><option>--type=dvddrive | fdd | hdd</option></term>
157 <listitem><para>
158 Specifies the drive type to which the medium is associated.
159 Only omit this option if the medium type can be determined
160 by using the <option>--medium</option> option or by
161 information provided by an earlier medium attachment
162 command.
163 </para></listitem>
164 </varlistentry>
165 <varlistentry>
166 <term><option>--medium=none | emptydrive | additions | <replaceable>uuid</replaceable> | <replaceable>filename</replaceable> | host:<replaceable>drive</replaceable> | iscsi</option></term>
167 <listitem><para>
168 Specifies one of the following values:
169 </para><variablelist>
170 <varlistentry>
171 <term><literal>none</literal></term>
172 <listitem><para>
173 Removes any existing device from the specified slot.
174 </para></listitem>
175 </varlistentry>
176 <varlistentry>
177 <term><literal>emptydrive</literal></term>
178 <listitem><para>
179 For a virtual DVD or floppy drive only.
180 </para><para>
181 Makes the device slot behave like a removeable drive
182 into which no media has been inserted.
183 </para></listitem>
184 </varlistentry>
185 <varlistentry>
186 <term><literal>additions</literal></term>
187 <listitem><para>
188 For a virtual DVD drive only.
189 </para><para>
190 Attaches the VirtualBox Guest Additions image to the
191 specified device slot.
192 </para></listitem>
193 </varlistentry>
194 <varlistentry>
195 <term><replaceable>uuid</replaceable></term>
196 <listitem><para>
197 Specifies the UUID of a storage medium to attach to
198 the specified device slot. The storage medium must
199 already be known to &product-name;, such as a storage
200 medium that is attached to another VM. Use the
201 <command>VBoxManage list</command> command to list
202 media.
203 </para></listitem>
204 </varlistentry>
205 <varlistentry>
206 <term><replaceable>filename</replaceable></term>
207 <listitem><para>
208 Specifies the full path of an existing disk image to
209 attach to the specified device slot. The disk image
210 can be in ISO, RAW, VDI, VMDK, or other format.
211 </para></listitem>
212 </varlistentry>
213 <varlistentry>
214 <term><literal>host:<replaceable>drive</replaceable></literal></term>
215 <listitem><para>
216 For a virtual DVD or floppy drive only.
217 </para><para>
218 Connects the specified device slot to the specified
219 DVD or floppy drive on the host computer.
220 </para></listitem>
221 </varlistentry>
222 <varlistentry>
223 <term><literal>iscsi</literal></term>
224 <listitem><para>
225 For virtual hard disks only.
226 </para><para>
227 Specifies an iSCSI target for which you must specify
228 additional information. See
229 <xref linkend="storage-iscsi" />.
230 </para></listitem>
231 </varlistentry>
232 </variablelist><para>
233 For removeable media such as floppies and DVDs, you can make
234 configuration changes while a VM is running. Changes to
235 devices or hard disk device slots require that the VM be
236 powered off.
237 </para></listitem>
238 </varlistentry>
239 <varlistentry>
240 <term><option>--mtype=normal | writethrough | immutable | shareable | readonly | multiattach</option></term>
241 <listitem><para>
242 Specifies how this medium behaves with respect to snapshots
243 and write operations. See <xref linkend="hdimagewrites" />.
244 </para></listitem>
245 </varlistentry>
246 <varlistentry>
247 <term><option>--comment=<replaceable>text</replaceable></option></term>
248 <listitem><para>
249 Specifies an optional description to store with the medium.
250 </para></listitem>
251 </varlistentry>
252 <varlistentry>
253 <term><option>--setuuid=<replaceable>uuid</replaceable></option></term>
254 <listitem><para>
255 Modifies the UUID of a medium before attaching it to a VM.
256 </para><para>
257 This is an expert option. Inappropriate values might make
258 the medium unusable or lead to broken VM configurations if
259 another VM already refers to the same medium.
260 </para><para>
261 Using the <option>--setuuid=""</option> option
262 assigns a new random UUID to an image, which can resolve
263 duplicate UUID errors if you used a file copy utility to
264 duplicate an image.
265 </para></listitem>
266 </varlistentry>
267 <varlistentry>
268 <term><option>--setparentuuid=<replaceable>uuid</replaceable></option></term>
269 <listitem><para>
270 Modifies the parent UUID of a medium before attaching it to
271 a VM.
272 </para><para>
273 This is an expert option. Inappropriate values might make
274 the medium unusable or lead to broken VM configurations if
275 another VM already refers to the same medium.
276 </para></listitem>
277 </varlistentry>
278 <varlistentry>
279 <term><option>--passthrough=on | off</option></term>
280 <listitem><para>
281 For a virtual DVD drive only.
282 </para><para>
283 Enables writing to a DVD. This feature is experimental, see
284 <xref linkend="storage-cds" />.
285 </para></listitem>
286 </varlistentry>
287 <varlistentry>
288 <term><option>--tempeject=on | off</option></term>
289 <listitem><para>
290 For a virtual DVD drive only.
291 </para><para>
292 Specifies whether to permit a temporary guest-triggered
293 medium eject operation. When set to <literal>on</literal>,
294 you can eject a medium. The ability for a guest-triggered
295 eject operation does not persist if the VM is powered off
296 and restarted. So, when you set this option to
297 <literal>on</literal> and the VM is restarted, the
298 originally configured medium is still in the drive.
299 </para></listitem>
300 </varlistentry>
301 <varlistentry>
302 <term><option>--nonrotational=on | off</option></term>
303 <listitem><para>
304 Enables you to specify that the virtual hard disk is
305 non-rotational. Some guest OSes, such as Windows 7 or later,
306 treat such disks as solid state drives (SSDs) and do not
307 perform disk fragmentation on them.
308 </para></listitem>
309 </varlistentry>
310 <varlistentry>
311 <term><option>--discard=on | off</option></term>
312 <listitem><para>
313 Specifies whether to enable the auto-discard feature for a
314 virtual hard disk. When set to <literal>on</literal>, a VDI
315 image is shrunk in response to a <command>trim</command>
316 command from the guest OS.
317 </para><para>
318 The virtual hard disk must meet the following requirements:
319 </para><itemizedlist>
320 <listitem><para>
321 The disk format must be VDI.
322 </para></listitem>
323 <listitem><para>
324 The size of the cleared area of the disk must be at
325 least 1 MB.
326 </para></listitem>
327 <listitem><para>
328 Ensure that the space being trimmed is at least a 1 MB
329 contiguous block at a 1 MB boundary.
330 </para></listitem>
331 </itemizedlist><para>
332 Consider running defragmentation commands as background cron
333 jobs to save space. On Windows, run the <command>defrag.exe
334 /D</command> command. On Linux, run the <command>btrfs
335 filesystem defrag</command> command.
336 </para><note>
337 <para>
338 When you configure the guest OS to issue the
339 <command>trim</command> command, the guest OS typically
340 sees the disk as an SSD.
341 </para>
342 <para>
343 Ext4 supports the <option>-o discard</option> mount
344 option. Mac OS X might require additional settings.
345 Windows 7, 8, and 10 automatically detect and support
346 SSDs. The Linux <command>exFAT</command> driver from
347 Samsung supports the <command>trim</command> command.
348 </para>
349 </note><para>
350 The Microsoft implementation of exFAT might not support this
351 feature.
352 </para><para>
353 You can use other methods to issue trim commands. The Linux
354 <command>fstrim</command> command is part of the
355 <filename>util-linux</filename> package. Earlier solutions
356 required you to zero out unused areas by using the
357 <command>zerofree</command> or a similar command, and then
358 to compact the disk. You can only perform these steps when
359 the VM is offline.
360 </para></listitem>
361 </varlistentry>
362 <varlistentry>
363 <term><option>--bandwidthgroup=<replaceable>name</replaceable></option></term>
364 <listitem><para>
365 Specifies the bandwidth group to use for the device. See
366 <xref linkend="storage-bandwidth-limit" />.
367 </para></listitem>
368 </varlistentry>
369 <varlistentry>
370 <term><option>--forceunmount</option></term>
371 <listitem><para>
372 For a virtual DVD or floppy drive only.
373 </para><para>
374 Forcibly unmounts the DVD, CD, or floppy or mounts a new
375 DVD, CD, or floppy even if the previous removable storage is
376 locked by the guest for reading. See
377 <xref linkend="storage-cds" />.
378 </para></listitem>
379 </varlistentry>
380 </variablelist>
381 <para>
382 The following options are applicable when you specify the
383 <option>--medium=iscsi</option> option:
384 </para>
385 <variablelist>
386 <varlistentry>
387 <term><option>--server=<replaceable>hostname</replaceable> | <replaceable>IP-address</replaceable></option></term>
388 <listitem><para>
389 Specifies the host name or IP address of the iSCSI target.
390 </para></listitem>
391 </varlistentry>
392 <varlistentry>
393 <term><option>--target=<replaceable>target</replaceable></option></term>
394 <listitem><para>
395 Specifies the target name string, which is determined by the
396 iSCSI target and is used to identify the storage resource.
397 </para></listitem>
398 </varlistentry>
399 <varlistentry>
400 <term><option>--tport=<replaceable>port</replaceable></option></term>
401 <listitem><para>
402 Specifies the TCP/IP port number of the iSCSI service on the
403 target.
404 </para></listitem>
405 </varlistentry>
406 <varlistentry>
407 <term><option>--lun=<replaceable>LUN</replaceable></option></term>
408 <listitem><para>
409 Specifies the logical unit number (LUN) of the target
410 resource. For a single disk drive, the value is zero.
411 </para></listitem>
412 </varlistentry>
413 <varlistentry>
414 <term><option>--encodedlun=<replaceable>LUN</replaceable></option></term>
415 <listitem><para>
416 Specifies the hexadecimal-encoded of the target resource.
417 For a single disk drive, the value is zero.
418 </para></listitem>
419 </varlistentry>
420 <varlistentry>
421 <term><option>--username=<replaceable>username</replaceable></option></term>
422 <listitem><para>
423 Specifies the user name to use for target authentication.
424 </para><note>
425 <para>
426 Unless you provide a settings password, the user name is
427 stored as clear text in the XML machine configuration
428 file.
429 </para>
430 </note></listitem>
431 </varlistentry>
432 <varlistentry>
433 <term><option>--password=<replaceable>password</replaceable></option></term>
434 <listitem><para>
435 Specifies the password used for target authentication.
436 </para><note>
437 <para>
438 Unless you provide a settings password, this password is
439 stored as clear text in the XML machine configuration
440 file. When you specify a settings password for the first
441 time, the target authentication password is stored in
442 encrypted form.
443 </para>
444 </note><remark>
445 This design does not conform to Oracle's security
446 guidelines. You should not be able to specify a password on
447 the command line because the password can be seen in a
448 process listing.
449 </remark></listitem>
450 </varlistentry>
451 <varlistentry>
452 <term><option>--passwordfile=<replaceable>password-filename</replaceable></option></term>
453 <listitem><para>
454 Specifies a file that contains the target authentication
455 password as clear text.
456 </para><note>
457 <para>
458 Use permission and ownership settings to ensure that the
459 contents of this file cannot be read by unauthorized
460 users.
461 </para>
462 </note></listitem>
463 </varlistentry>
464 <varlistentry>
465 <term><option>--initiator=<replaceable>initiator</replaceable></option></term>
466 <listitem><para>
467 Specifies the iSCSI initiator.
468 </para><para>
469 The Microsoft iSCSI Initiator is a system, such as a server,
470 that attaches to an IP network and initiates requests and
471 receives responses from an iSCSI target. The SAN components
472 in the iSCSI initiator are largely analogous to Fibre
473 Channel SAN components, and they include the following:
474 </para><itemizedlist>
475 <listitem><para>
476 <emphasis role="bold">iSCSI driver.</emphasis>
477 Transports blocks of iSCSI commands over the IP network.
478 This iSCSI driver is installed on the iSCSI host and is
479 included with the Microsoft iSCSI Initiator.
480 </para></listitem>
481 <listitem><para>
482 <emphasis role="bold">Gigabit Ethernet
483 adapter.</emphasis> Connects to an iSCSI target. Use an
484 Ethernet adapter that can transmit 1000 megabits per
485 second (Mbps). Like standard 10/100 adapters, most
486 gigabit adapters use a preexisting Category 5 or
487 Category 6E cable. Each port on the adapter is
488 identified by a unique IP address.
489 </para></listitem>
490 <listitem><para>
491 <emphasis role="bold">iSCSI target.</emphasis> Is any
492 device that receives iSCSI commands. The device can be
493 an end node such as a storage device, or it can be an
494 intermediate device such as a network bridge between IP
495 and Fibre Channel devices. Each port on the storage
496 array controller or network bridge is identified by one
497 or more IP addresses.
498 </para></listitem>
499 </itemizedlist></listitem>
500 </varlistentry>
501 <varlistentry>
502 <term><option>--intnet</option></term>
503 <listitem><para>
504 Specifies whether to connect to the iSCSI target that uses
505 internal networking. This configuration requires further
506 configuration. See <xref linkend="iscsi-intnet" />.
507 </para></listitem>
508 </varlistentry>
509 </variablelist>
510 </refsect1>
511
512 <refsect1>
513 <title>Examples</title>
514 <remark role="help-scope" condition="GLOBAL" />
515 <para>
516 The following command attaches the <filename>o7.vdi</filename>
517 disk image to the specified SATA storage controller on the
518 <filename>ol7</filename> VM.
519 </para>
520<screen>$ storageattach ol7 --storagectl "SATA Controller" --port 0 --device 0 \
521--type hdd --medium /VirtualBox/ol7/ol7.vdi</screen>
522 <para>
523 The following command attaches the
524 <filename>o7-r6-dvd.iso</filename> DVD image to the specified IDE
525 storage controller on the <filename>ol7</filename> VM.
526 </para>
527<screen>$ VBoxManage storageattach ol7 --storagectl "IDE Controller" --port 0 --device 0 \
528--type dvddrive --medium ol7-r6-dvd.iso</screen>
529 </refsect1>
530
531 <refsect1>
532 <title>See Also</title>
533 <para>
534 <xref linkend="vboxmanage-list" />,
535 <xref linkend="vboxmanage-showvminfo" />,
536 <xref linkend="vboxmanage-storagectl" />
537 </para>
538 </refsect1>
539</refentry>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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