Skip to content

Instantly share code, notes, and snippets.

@sawanoboly
Last active January 20, 2021 23:52
Show Gist options
  • Save sawanoboly/84c880399acee7035d46 to your computer and use it in GitHub Desktop.
Save sawanoboly/84c880399acee7035d46 to your computer and use it in GitHub Desktop.
VagrantでVM起動時に、追加ディスクを作成してアタッチ - VirtualBox Provider ref: http://qiita.com/sawanoboly/items/cbd056252a130a4b961e
VBoxManage storageattach <uuid|vmname>
--storagectl <name>
[--port <number>]
[--device <number>]
[--type dvddrive|hdd|fdd]
[--medium none|emptydrive|additions|
<uuid|filename>|host:<drive>|iscsi]
[--mtype normal|writethrough|immutable|shareable|
readonly|multiattach]
[--comment <text>]
[--setuuid <uuid>]
[--setparentuuid <uuid>]
[--passthrough on|off]
[--tempeject on|off]
[--nonrotational on|off]
[--discard on|off]
[--bandwidthgroup <name>]
[--forceunmount]
[--server <name>|<ip>]
[--target <target>]
[--tport <port>]
[--lun <lun>]
[--encodedlun <lun>]
[--username <username>]
[--password <password>]
[--initiator <initiator>]
[--intnet]
# -- snip --
config.vm.define machine do |config|
config.vm.provider :virtualbox do |vb|
at_disk = 'tmp/name_of_file.vdi'
unless File.exists?(at_disk)
vb.customize ['createhd', '--filename', at_disk, '--size', 5 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', at_disk]
end
end
end
# -- snip --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment