Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best method for setting the virtual hard drive (VDI) of the primary controller for an existing virtual machine?

Does the syntax change if the VDI is really a child differencing disk of some other parent disk? Do you need to attach the parent VDI and then the child VDI in some way?


I have an existing VM --- I want to replace the hard drive it uses to boot - with either another normal virtual HD or possibly a differencing disk. Can this be done with VBoxManage?

share|improve this question
up vote 2 down vote accepted

I believe this should do it for a virtual hard drive.

VBoxManage modifyvm winxp-web-dev --hda "/home/vbox/.VirtualBox/HardDisks/my_new_disk.vdi"

(That is how I do it when I create vm's from the console)

share|improve this answer
I think this is not valid way to done. While I try your suggestion, I get VBoxManage: error: Unknown option: -hda error. – Sencer H. Dec 6 '13 at 19:45
Should be double minuses there. (Worked on 4.1.6) – Jontas Dec 10 '13 at 8:07

Pretty old question but here is how I do it:

VBoxManage storageattach my-vm-name \
                         --storagectl "SATA Controller" \
                         --device 0 \
                         --port 0 \
                         --type hdd \
                         --medium /path/to/my-new.vdi

This assumes you want to replace the old disk. If you want to want to just add another disk use another port, for example 1 if you have only 1 disk (on port 0). Please note you could also add disks (or cd/dvd images) to "IDE Controller".

share|improve this answer

Just want to add to @calas with a VM managed by vagrant (run in VM's folder and replace sandbox_default_ with your VM name prefix):

VBoxManage storageattach `VBoxManage list vms | grep \"sandbox_default_ | awk '{print $2;}'` --storagectl SATA --port 0 --type hdd --medium box-disk1.vmdk
share|improve this answer

I'm not sure if you can do it though VBoxManage, I've always changed it through the GUI after using CloneHD, you answer may be in the VBoxManage Manuel

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.