czwartek, 9 lutego 2017

Resize vagrant disk storage (hard drive) with Virtual Box provider and Windows guest.

Before you start whole process of resizing disk storage you have to stop your VM.

Also you need to know your VM name.

It can be checked with:

VBoxManage list vms
"YOUR_VM_NAME" {385e587a-ad47-4d36-a734-a126b9e04590}

Usually vagrant boxes comes with VMDK type storage which cannot be resized.
You need to convert the format to resizeable VDI:

VBoxManage  clonehd "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vmdk" "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vdi" --format vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone medium created in format 'vdi'. UUID: 67985552-a3e5-4fad-aedd-82565ac963d4
 packer-virtualbox-iso-1459796137-disk1.vmdk is a hdd disk file. Your file name can differ slightly. packer-virtualbox-iso-1459796137-disk1.vdi is new disk file that will be created in VDI format.

Now it's time to resize the disk image.
VBoxManage modifymedium /root/VirtualBox\ VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vdi --resize 163840
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% 163840 is new disk size in MB.

Now you need to convert the disk image back to VMDK. 
REMEMBER: Use new name of file  
VBoxManage  clonehd "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vdi" "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk2.vmdk" --format vmdk
Attach new storage and remove old one.
VBoxManage storageattach YOUR_VM_NAME --storagectl "IDE Controller" --device 0 --port 0 --type hdd --medium "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk2.vmdk"
rm "/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vmdk"
Now :
Run the VM (for example: `vagrant up`). In our case it is a Windows machine. That's why you need to go to the guest system and increase disk size there. Open Disk Management `diskmgmt.msc`. Right click on allocated partition and click Extend Volume.


  • Click right button
  • Choose an "Extend Volume.."
  • Click "Next"
  • Your disk is already extended



Be Sharp Software 


2 komentarze:

  1. If you use old filename for disk, you may encounter this error on VM startup:
    ==> default: Booting VM...
    There was an error while executing `VBoxManage`, a CLI used by Vagrant
    for controlling VirtualBox. The command and stderr is shown below.

    Command: ["startvm", "385e587a-ad47-4d36-a734-a126b9e04590", "--type", "headless"]

    Stderr: VBoxManage: error: UUID {9f433356-976c-422b-b7f1-2e1279cec993} of the medium '/root/VirtualBox VMs/YOUR_VM_NAME/packer-virtualbox-iso-1459796137-disk1.vmdk' does not match the value {15800ccf-d1c0-4a52-b179-2f14b876eddf} stored in the media registry ('/root/.config/VirtualBox/VirtualBox.xml')
    VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium

    OdpowiedzUsuń
  2. However, BetOnline responded to those complaints solely by making it one of the safest casinos on-line on the earth. Like other prime on-line casinos, they employed a more environment friendly group, guaranteeing no customers face any issues. When it involves depositing your cash, the Wild Casino 토토사이트 web site clarifies it is no less concerned about your cash. While ensuring the gamers that their particulars are 100 percent secure, this trusted on-line casino says it has employed many of the “industry-leading” measures to make sure safety. The Wild Casino site says it is continuously in search of to enhance its safety measures.

    OdpowiedzUsuń