Created
May 27, 2019 00:13
-
-
Save jms1989/afde7918e09f3da550efe2dba7b7e841 to your computer and use it in GitHub Desktop.
resizing vmdk image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if exist "C:\Program Files\Oracle\VirtualBox" set path="%path%;C:\Program Files\Oracle\VirtualBox" | |
set file=%1 | |
set /A size=%2 | |
echo Converting VMDK to VDI | |
VBoxManage clonemedium "%file%.vmdk" "%file%.vdi" --format vdi | |
echo Resizing Image | |
VBoxManage modifymedium "%file%.vdi" --resize %size% | |
if exist "%file%_resized.vmdk" ( | |
echo Resized disk exists | |
) else ( | |
echo Converting VDI image to VMDK | |
VBoxManage clonemedium "%file%.vdi" "%file%_resized.vmdk" --format vmdk --variant fixed | |
) | |
echo Deleting VDI image | |
VBoxManage closemedium disk "%file%.vdi" --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment