Skip to content

Commit 06194bd

Browse files
authored
Update ToC and examples for storage control
Thanks to the users posting in the thread - https://superuser.com/questions/741734/virtualbox-how-can-i-add-mount-a-iso-image-file-from-command-line
1 parent 33d748e commit 06194bd

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ A JavaScript library to interact with [VirtualBox](https://www.virtualbox.org/)
1414
- [Starting a cold machine: Two ways](#starting-a-cold-machine-two-ways)
1515
- [Stopping a machine](#stopping-a-machine)
1616
- [Pausing, Saving and Resuming a machine](#pausing-saving-and-resuming-a-machine)
17+
- [Export a Machine](#export-a-machine)
18+
- [Snapshot Manage](#snapshot-manage)
19+
- [Cloning a VM](#cloning-vms)
20+
- [Storage](#storage)
21+
- [Manage the IDE controller](#manage-the-ide-controller)
22+
- [Attach a disk image file](#attach-a-disk-image-file)
1723
- [Controlling the guest OS](#controlling-the-guest-os)
1824
- [A note about security :warning:](#a-note-about-security)
1925
- [Running programs in the guest](#running-programs-in-the-guest)
@@ -222,6 +228,41 @@ virtualbox.snapshotTake("machine_name", "snapshot_name", function(error, uuid) {
222228
});
223229
```
224230

231+
## Storage
232+
233+
### Manage the IDE controller
234+
235+
In case the VM doesn't have an IDE controller you can use the storagectl command to add one:
236+
237+
```javascript
238+
virtualbox.storage.addCtl({
239+
vm: "machine_name",
240+
device_name: "IDE", //optional
241+
type: "ide" //optional
242+
}, function(){
243+
console.log('Controller has been added!');
244+
})
245+
```
246+
247+
### Attach a disk image file
248+
249+
Mount an ISO file to the added controller:
250+
251+
```javascript
252+
virtualbox.storage.attach({
253+
vm: "machine_name",
254+
device_name: "IDE", //optional
255+
port: "ide", //optional
256+
device: "0",
257+
type: "0",
258+
medium: "X:\Folder\containing\the.iso"
259+
}, function(){
260+
console.log('Image has been mounted!');
261+
})
262+
```
263+
264+
The _medium_ parameter of the options object can be set to the **none** value to unmount.
265+
225266
# Controlling the guest OS
226267

227268
## A note about security :warning:

0 commit comments

Comments
 (0)