Page 1 of 1
Increase Win7 VDI file Size
Posted: 31. May 2013, 23:58
by elchap1n
Has anyone successfully resized the win7 vdi file successfully using these steps:
1) Find out where the VDI files are
$ VBoxManage list hdds
2) backup current disk by cloning it
$ sudo sudo VboxManage clonehd /Users/Win7//Win7.vdi /Volumes/Data/VBOX/backups/Win7-clone.vdi
3) Once the backup completes, resize the VDI file
$ VBoxManage modifyhd <path to your vdi> --resize <new size in megabytes>
Example:
$ sudo VBoxManage modifyhd /Users/Win7//Win7.vdi --resize 40960
Where resize value is new size in megabytes
4) restart virtual box
after resizing, VBox and the OS should know the new size
5) Let your OS know the new logical size of the drive
Let the OS know the new size
-- use computer management/disk management to extend the disk
Any suggestions?
Re: Increase Win7 VDI file Size
Posted: 31. May 2013, 23:59
by Perryg
Why do you need to use sudo?
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 16:51
by elchap1n
Thinking I may need to run with privileges. However, i can try without sudo. But as far as the procedure goes, does it seem is the correct way to extend the win7 VDI disk?
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 17:02
by Perryg
Does it not work for you? From the looks of it I would think it should, unless the virtual drive is fixed or you have snapshots.
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 17:06
by mpack
Yes, it's correct except that if you want to make a backup of a VDI file then the best method is the most obvious one, i.e. copy the file using the host. Cloning (clonehd) means to copy and also change the internal UUIDs, hence is only needed if you intend to mount both the original and "backup" VDI at the same time, which you don't. This way, if there is some problem after the resize you can simply copy the VDI back, and you are precisely back where you started, no harm done. If the UUIDs are different then recovery isn't as easy.
ps. You made no mention of snapshots. Hopefully that means you aren't using them. However for others reading this: a reminder that you can't resize a drive in this way if you are using snaphots.
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 17:13
by elchap1n
Ok, I have updated my procedure - since I am not going to be mounting the VDIs at the same time, is this more appropriate?
1) Find out where the VDI files are
$ VBoxManage list hdds
2) backup current disk by cloning it or using host
$ cp /Users/Win7/Win7.vdi /Users/Win7/Win7.vdi_copy
3) Once the backup completes, resize the VDI file
$ VBoxManage modifyhd <path to your vdi> --resize <new size in megabytes>
Example:
$ VBoxManage modifyhd /Users/Win7/Win7.vdi --resize 40960
Where resize value is new size in megabytes
4) restart virtual box
after resizing, VBox and the OS should know the new size
5) Let your OS know the new logical size of the drive
Let the OS know the new size
-- use computer management/disk management to extend the disk
Thanks you so much!
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 17:18
by mpack
Yes, that will work.
I'm not sure it's possible to guarantee a procedure correct for all scenarios. Where possible IMHO it's best to backup the entire VM folder, which ensures that snapshots etc will not be harmed (in the process of discovering that you can't resize such a VM anyway!). However sometimes the user has stored the main VDI file outside the VM folder, in which case your procedure deals with that scenario better.
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 17:26
by elchap1n
Perfect, and yes i understand that it may not resolve all scenarios, but I wanted to try to get as close as possible. In case the resizing does not work, I should be able to mount the copy instead of the original, correct?
In case something happens with the original (i.e. the resizing corrrupts it), will this work:
# rename the original to old
$ mv /Users/Win7/Win7.vdi /Users/Win7/Win7.vdi_old
# rename the copy to original
$ cp /Users/Win7/Win7.vdi_copy /Users/Win7/Win7.vdi
# start VBox
Or is there something else I would need to do inside VBox?
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 18:09
by Perryg
I would also suggest *not* saving the backup file in the same folder as the original. I have seen this cause issues in the past.
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 18:15
by mpack
Yes, replacing the original with the backup, whether by renaming or copying, will be enough to fully restore the VM to the "before" state. Provided of course that the VM is fully shut down first - you wouldn't want to replace the VDI when the VM is merely suspended (I'm assuming the host OS will prevent you replacing it while the VM is still running!).
Re: Increase Win7 VDI file Size
Posted: 3. Jun 2013, 18:32
by elchap1n
Ok, got the final steps:
###############################################################
0) Power off windows VM
1) Find out where the VDI files are
$ VBoxManage list hdds
2) backup current disk by cloning it or using host
$ cp /Users/Win7/Win7.vdi /Users/TEMP/Win7.vdi_copy
3) Once the backup completes, resize the VDI file
$ VBoxManage modifyhd <path to your vdi> --resize <new size in megabytes>
Example:
$ VBoxManage modifyhd /Users/Win7/Win7.vdi --resize 40960
Where resize value is new size in megabytes
4) restart virtual box
after resizing, VBox and the OS should know the new size
5) Let your OS know the new logical size of the drive
Let the OS know the new size
-- use computer management/disk management to extend the disk
###############################################################
If the resizing fails:
# rename or move the original to other location
$ mv /Users/Win7/Win7.vdi /Users/TEMP/Win7.vdi_old
# move/copy original copied to Win7 location
$ cp/mv /Users/TEMP/Win7.vdi_copy /Users/Win7/Win7.vdi
# rename the copy to original
$ cp /Users/Win7/Win7.vdi_copy /Users/Win7/Win7.vdi
# start VBox
###############################################################
To detach the failed disk:
1) ensure VBox is powered off
2) select VM
3) Click on settings
4) Go to storage Tab
5) Under the data controller, highlight VDI file, Remove
###############################################################
To attach the copied disk:
1) 1) ensure VBox is powered off
2) select VM
3) Click on settings
4) Go to storage Tab
5) Under the data controller, click + to add, find the disk and add it
###############################################################