First of all, check if you have any CD/DVD drive installed, whether empty or not (note the use of the find
command to filter results):
1.- Is there any empty CD/DVD drive?
C:\Oracle\VirtualBox>vboxmanage showvminfo "Windows 7 SP1 - SandBox 01" | find "empty" /i
SATA (1, 0): Empty
Congratulations, you have found a possible empty CD/DVD drive. So you can attach your ISO to it, but...
... in order to face the worst scenario, lets show another way to find your CD/DVD drive, if installed:
2.- Locate the name of your VM:
C:\Oracle\VirtualBox>VBoxManage.exe list vms
"Windows 7 SP1 - SandBox 01" {e016fcf2-9b6e-4b8e-b89b-49a3c8ba0898}
3.- List its storage controllers (note the find
command to filter too much output data) (*):
C:\Oracle\VirtualBox>vboxmanage showvminfo "Windows 7 SP1 - SandBox 01" | find "storage controller name" /i
Storage Controller Name (0): IDE
Storage Controller Name (1): SATA
4.- Show its attached devices:
C:\Oracle\VirtualBox>vboxmanage showvminfo "Windows 7 SP1 - SandBox 01" | find "IDE"
Storage Controller Name (0): IDE
(this one is empty, so there are no device controllers, whether hard disks or CD/DVD drives)
C:\Oracle\VirtualBox>vboxmanage showvminfo "Windows 7 SP1 - SandBox 01" | find "SATA"
Storage Controller Name (1): SATA
SATA (0, 0): d:\VirtualBox VMs\Windows 7 SP1 - SandBox 01\SnapShots/{71b8bf72-dca1-4816-89ff-feba271ec262}.vmdk (UUID: 71b8bf72-dca1-4816-89ff-feba271ec262)
SATA (1, 0): Empty
SATA(0,0) has a(the) virtual disk, and SATA(1,0) is empty (first number between parentheses is known as type
, second one is device
), so it should be the CD/DVD drive.
5.- Lets attach an ISO image file (Office 2013, for example) to it:
C:\Oracle\VirtualBox>vboxmanage storageattach "Windows 7 SP1 - SandBox 01" --storagectl "SATA" --port 1 --device 0 --type dvddrive --medium "Office2013-VL-SP1.iso"
(no results on screen means OK
).
$- To remove the ISO keeping the CD/DVD drive controller:
C:\Oracle\VirtualBox>vboxmanage storageattach "Windows 7 SP1 - SandBox 01" --storagectl "SATA" --port 1 --device 0 --type dvddrive --medium "emptydrive"
$- For the case there is no "empty" CD/DVD drive controller installed, VirtualBox should add a new one to an existing controller, assumed we choose a not-occupied port/device, for example for the SATA controller:
C:\Oracle\VirtualBox>vboxmanage storageattach "Windows 7 SP1 - SandBox 01" --storagectl "SATA" --port 5 --device 0 --type dvddrive --medium "Office2013-VL-SP1.iso"
(note we used port 5)
And for the IDE controller:
C:\Oracle\VirtualBox>vboxmanage storageattach "Windows 7 SP1 - SandBox 01" --storagectl "IDE" --port 0 --device 0 --type dvddrive --medium "Office2013-VL-SP1.iso"
(note we used (0,0)
, this is, the first port and first device)
$- If we want to remove (destroy) (any of) the devices (example for the last IDE one):
C:\Oracle\VirtualBox>vboxmanage storageattach "Windows 7 SP1 - SandBox 01" --storagectl "IDE" --port 0 --device 0 --type dvddrive --medium "emptydrive"
(the ISO image gets umounted at the same time of executing this command).
$- Finally, if we wanna create a new controller instead of using the existing(s) one(s) (example for a SATA controller that we will name SATA3):
C:\Oracle\VirtualBox>vboxmanage storagectl "Windows 7 SP1 - SandBox 01" --name SATA3 --add sata
$- And maybe removing it later:
C:\Oracle\VirtualBox>vboxmanage storagectl "Windows 7 SP1 - SandBox 01" --name SATA3 --remove
(*) If the name is not enough (could have been changed) to figure out what kind of controller is it, try:
C:\Oracle\VirtualBox>vboxmanage showvminfo "Windows 7 SP1 - SandBox 01" | find "storage controller" /i
Storage Controller Name (0): IDE
Storage Controller Type (0): PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 2
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
Storage Controller Name (1): SATA
Storage Controller Type (1): IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1): 30
Storage Controller Port Count (1): 2
As we can see, controller named IDE
(#0) is a PIIX4 device (IDE) and the one named SATA
(#1) is an IntelAhci (SATA).
NOTE: IDE controllers accept possible image files at 4 configurations: (0,0), (0,1), (1,0) and (1,1). Choose the one that is not occupied. SATA controllers accept 30. These parameters can be configured on VM properties. Remember that, in both cases, count starts at 0
, not 1
.
NOTE2: Some devices can be created during VM execution (running), depending on the operating system and device. For example, SATA devices can be created on runtime for Windows 7 VMs. Anyway, an ISO CD/DVD image file can always be inserted on runtime in any empty medium. You can check running vms by doing:
C:\Oracle\VirtualBox>vboxmanage list runningvms
Thanks to @and31415 and @DanielB for their comments and info.
@DanialB: when it says
IDE(1, 0)
, is that port 1, device 0? Or device 1, port 0? – Chris Dodd – 2014-10-08T19:58:10.1603Also, all relevant information on a virtual machine can be discovered with
VBoxManage showvminfo
. This includes storage controllers and their names. – Daniel B – 2014-04-14T22:21:49.2901@DanielB,
VBoxManage showvminfo
listsIDE (1, 0): C:\Oracle\VirtualBox\VBoxGuestAdditions.iso
andSATA (0, 0): d:\VirtualBox VMs\Windows 7 SP1 - SandBox 01\Win7SP1.vmdk
. I am a bit confused about both0
and1
. Do they correlate with--port
and--device
? – Sopalajo de Arrierez – 2014-04-14T22:56:26.300When concerning ISO image files, should I add an
ide
or asata
device? – Sopalajo de Arrierez – 2014-04-14T23:01:36.303@SopalajodeArrierez Yes, those numbers are port/device identifiers. For maximum compatibility you should pick an IDE controller for virtual CD/DVD drives: "So even if your guest operating system has no support for SCSI or SATA devices, it should always be able to see [it]." Other than that, VirtualBox gives you "four slots attached to the traditional IDE controller, which are always present" and "30 slots attached to the SATA controller, if enabled and supported by the guest operating system." Source
– and31415 – 2014-04-14T23:17:06.633IDE controllers have two ports (the first item in the tuple), each capable of connecting two devices (the second element). Same as on a real PC. The GUI attaches optical media to (1, 0) by default. – Daniel B – 2014-04-15T06:47:02.457
@DanielB, are the controllers media (0,0), (0,1), (1,0) and (1,1)? Does de first number indicates controller number (0 for the first one, 1 for the second... etc) and the second number indicates 0 for master and 1 for slave? – Sopalajo de Arrierez – 2014-04-15T08:23:41.713
It's not the controller number, it's the port number. On the same controller. IDE controllers have a primary and a secondary port. Device 0 is master, 1 is slave, yes. – Daniel B – 2014-04-15T08:30:38.593
Thanks, @DanielB. I think the answer of @and31415 would enhance with something like
VBoxManage.exe showvminfo "Windows 7 SP1 - SandBox 01" | find "storage" /i
, andC:\>VBoxManage.exe showvminfo "Windows 7 SP1 - SandBox 01" | find "IDE"
, or evenC:\>VBoxManage.exe showvminfo "Windows 7 SP1 - SandBox 01" | find "SATA"
to help googlers arriving here. – Sopalajo de Arrierez – 2014-04-15T19:56:24.617