我已经用完了虚拟机磁盘(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映像的大小?


当前回答

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

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

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

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

干杯!

其他回答

正如Luca在回答中提到的,所需的步骤是:

将VMDK镜像克隆为VDI格式 VBoxManage clonehd”源代码。vmdk”“克隆。Vdi”——格式化Vdi 调整VDI映像的大小 VBoxManage modifyhd "克隆。Vdi”——调整大小51200 克隆回VMDK格式 VBoxManage clonehd克隆。vdi”“调整大小。Vmdk "——格式化Vmdk

如果可以使用VDI映像,则步骤3是可选的。

所有这些步骤都可以在VirtualBox图形用户界面下的File -> Virtual Media Manager中执行。选择要克隆的驱动器,然后选择“复制”。打开一个对话框,允许您选择磁盘格式和选项。要调整VDI图像的大小,只需使用底部的滑块(如果不可见,则单击属性)。

最后,您可能还需要在客户操作系统中更改磁盘大小:

运行客户操作系统,调整磁盘分区大小。如果您正在运行Linux,则可以使用gparted或kparted。

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

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

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

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

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

因为这是一个vmdk文件,所以您可以使用VMWare的vdiskmanager,如果它适用于您的平台的话。VMWare在这里有x86 Linux、Windows和OS X版本(请参阅右侧的“附件”)。

然后你只要做:

1023856-vdiskmanager-windows-7.0.1.exe -x 30720M Machine-disk1.vmdk

它避免了必须克隆,然后扩展磁盘。现在,缺点是您需要额外的工具,而vmdk是VMWare的磁盘格式,并且您仍在使用Virtualbox,因此可能存在不兼容性。

qemu-img也可以工作,但我不确定它是否支持调整vmdk文件的大小。它看起来像这样:

qemu-img resize Machine-disk1.vmdk +8G

提醒一下,对于这两种情况,在调整底层磁盘的大小之后,仍然需要增加分区。这些工具本质上都是dd if=/dev/old_disk of=/dev/new_disk bs=16M。

这里所有的办法都试过了,但似乎都不管用。经过几个小时的挖掘,我发现了这篇博客文章,就像魔法一样,一切都起作用了。我需要做一些调整,所以这是修改后的版本。使用Docker 17.06.0-ce版本测试,构建02c1d87。

一旦开发人员真正开始容器化他们的应用程序,他们通常会生成大量的映像,并迅速填满默认分配给Docker虚拟机的20GB硬盘空间。为了确保Docker虚拟机有足够的磁盘空间,我们应该将/dev/sda1的大小调整为一个更合理的数字。

Download GParted Live CD/USB/HD/PXE Bootable Image. Stop the Docker virtual machine docker-machine stop default. Boot2Docker package installer ships with a VMDK volume, which VirtualBox’s native tools cannot resize. In order to resize the Docker disk volume, first clone the VDI volume from the default VMDK volume vboxmanage clonehd /full/path/to/disk.vmdk /full/path/to/disk_resized.vdi --format VDI --variant Standard. Resize the newly cloned VDI volume to the desired capacity. We recommend at least 64GB vboxmanage modifyhd /full/path/to/disk_resized.vdi --resize <size in MB>. Launch the VirtualBox application, select default VM and click on the “Settings” gear on top. Click on the “Storage” icon. Remove the default VMDK volume. Add a new IDE controller. Mount the GParted ISO via the “Add CD/DVD Device” option. Mount the cloned VDI volume via the “Add CD/DVD Device” option. If you are running Docker on a computer with a solid-state hard drive, please make sure the “Solid-state Drive” option is selected for the cloned VDI volume. Click on the “Start” icon to boot up the Docker virtual machine, which will launch the GParted ISO. Select “GParted Live (Default settings)”. Set the policy for handling keymaps to “Don’t touch keymap”. Set language preference to option “33”, which maps to “US English”. Select option “1” to run “Forcevideo” and configure X manually. Keep the default resolution of “1024×760” by selecting option “2”. Keep the default “vesa” as the VGA card. Keep the default colour depth of “24” by selecting option “0”. Once GParted launches, click on the “Resize/Move” icon. Set the new disk volume size to desired size by dragging the slider. In this example, the maximum size is 127,035MB. Click on the “Resize/Move” button to start the process. Confirm the resizing operation by clicking on the “Apply” button. Power off the machine after the resizing operation finishes. Remove the GParted ISO. Log into the Docker virtual machine to verify that the volume resizing was successful by starting machine docker-machine start default If you experience network issues, restart the docker-machine

您可以使用Vmware player来调整vmdk的大小。 如果你想保持vmdk格式,这将删除往返转换(在其他文章中提到)。只要确保当你将vmdk添加到vmware时,不要在提示时单击升级格式,保持当前的格式以防VirtualBox不接受它。