VirtualBox

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

Last change on this file since 84151 was 82969, checked in by vboxsync, 5 years ago

Copyright year updates - manual ones.

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