我已经用完了虚拟机磁盘(vmdk)上的空间,需要调整虚拟映像的大小。使用命令调整大小

vboxmanage modifyhd Machine-disk1.vmdk --resize 30720

给出错误

Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!

如何调整vmdk映像的大小?


当前回答

一个快速而简单的选择:

关闭机器 创建所需大小的新虚拟盒磁盘 将内容从旧磁盘移动到新磁盘: Vboxmanage clonehd“源磁盘。vmdk”“新磁盘。vmdk”——现有的 打开机器 您可能必须在操作系统中调整分区大小,以填充磁盘的其余部分


警告

如果新磁盘比源磁盘短,则会丢失源磁盘上新磁盘大小位置上的数据。

在步骤1之前,您可以防止在操作系统内源磁盘的末端释放delta空间,其中delta = size(source-disk) - size(new-disk)。

其他回答

我有一个Mac主机上的Windows 7客户端,这篇文章非常有帮助。谢谢。

我要补充一点,我没有使用gparted。我是这样做的:

启动新的放大的vmdk映像。 转到开始,右键单击计算机,选择管理。 单击磁盘管理 你应该在你的C盘上看到一些灰色的空间(在我的情况下) 右键单击C驱动器并选择扩展卷。 选择尺寸然后出发

甜蜜的!比起使用带有数据丢失警告的第三方工具,我更喜欢这种方法。

干杯!

我可以通过克隆vmdk,然后修改和调整它的大小来调整它的大小。

vboxmanage clonehd "virtualdisk.vmdk" "new-virtualdisk.vdi" --format vdi
vboxmanage modifyhd "new-virtualdisk.vdi" --resize 30720

实际上,只需要这些命令:

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 51200

然后选择“克隆”。Virtualbox GUI存储。

在那之后,启动虚拟窗口和扩展你的C盘作为Code chop的方法。

没有必要转换*。Vdi文件到*。返回VMDK文件。

如果您希望结束返回vmdk硬盘(可能您也有兴趣在vwmare中使用该磁盘),完整的步骤如下:

VBoxManage clonemedium "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifymedium "cloned.vdi" --resize 51200
VBoxManage clonemedium "cloned.vdi" "resized.vmdk" --format vmdk

以上将调整硬盘大小至50GB (50 * 1024MB)。 要完成事情,你也需要调整驱动器的大小!要实现这一点,您可能需要下载gparted iso,并从该iso引导来调整驱动器的大小(从virtualbox设置中选择iso)。

附注:如果你的新大小太小,即使你的新vdi文件也会得到同样的错误。

这是一种调整VirtualBox磁盘大小的方法,无论它是固定格式的磁盘还是动态格式的磁盘。具体来说,它可以防止磁盘是固定格式时出现的错误。


⚠️备份虚拟磁盘。你永远不知道会出什么问题。

在主机上:

Open a terminal window. On Windows: Open the command prompt cmd. Go to the directory with the virtual disk you want to resize. For example: cd "My VMs" Create a new VirtualBox disk with your desired filename, size (in megabytes) and format (either Standard (dynamic) or Fixed). For example, to create a 50 GB fixed-format disk called MyNewDisk.vdi: VBoxManage createmedium --filename "MyNewDisk.vdi" --size 50000 --variant Fixed If VBoxManage is not recognized as a command, specify the full path to it. It can be found in the VirtualBox installation directory. On Windows the above command would become: "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createmedium --filename "MyNewDisk.vdi" --size 50000 --variant Fixed Copy the original disk to the new disk. VBoxManage clonemedium "MyOriginalDisk.vdi" "MyNewDisk.vdi" --existing The resize is done! You can check the properties of the new disk if you want: VBoxManage showmediuminfo "MyNewDisk.vdi" Change the virtual machine to use the new disk instead.

接下来,在您的客户操作系统上,您需要调整分区大小以使用新的可用空间。