如何调整VirtualBox vmdk文件的大小

本文翻译自:How to resize a VirtualBox vmdk file

I've run out of space on a virtual machine disk which is a vmdk and need to resize the virtual image. 我的虚拟机磁盘空间不足,这是一个vmdk,需要调整虚拟映像的大小。 Resizing with the command 使用命令调整大小

vboxmanage modifyhd Machine-disk1.vmdk --resize 30720

gives the error 给出了错误

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

How can I resize a vmdk image? 如何调整vmdk图像的大小?


#1楼

参考:https://stackoom.com/question/mv2T/如何调整VirtualBox-vmdk文件的大小


#2楼

I was able to resize the vmdk by cloning it and then modifying and resizing. 我能够通过克隆它然后修改和调整大小来调整vmdk的大小。

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

#3楼

If you want to end having back a vmdk hard disk (maybe you are interested in using the disk in vwmare too), the complete steps are: 如果你想结束退回vmdk硬盘(也许你有兴趣在vwmare中使用磁盘),完整的步骤是:

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

The above will resize the hard disk up to 50GB (50 * 1024MB). 以上将调整硬盘大小为50GB(50 * 1024MB)。

To complete things you need to resize the drive too! 要完成任务,您还需要调整驱动器的大小! To achieve this, you might want to download gparted iso and boot from that iso to resize your drive (select the iso from within the virtualbox settings). 要实现此目的,您可能需要从该iso下载gparted iso和boot以调整驱动器大小(从虚拟机设置中选择iso)。

PS If your new size is too small, you'll get the same error even with your new vdi file. PS如果您的新尺寸太小,即使使用新的vdi文件也会出现相同的错误。


#4楼

VBoxManage does the trick, but don't forget that you have to use GParted or another tool to allocate the free space created with VBoxManage . VBoxManage可以解决问题,但不要忘记你必须使用GParted或其他工具来分配用VBoxManage创建的可用空间。

Have a look to my blog post to get detailed information and step by step screenshots. 看看我的博客文章 ,获取详细信息和一步一步的截图。


#5楼

I have a Windows 7 client on a Mac host and this post was VERY helpful. 我在Mac主机上有一个Windows 7客户端,这篇文章非常有帮助。 Thanks. 谢谢。

I would add that I didn't use gparted. 我想补充一点,我没有使用gparted。 I did this: 我这样做了:

  1. Launch new enlarged vmdk image. 启动新的放大的vmdk图像。
  2. Go to Start and right click Computer and select Manage. 转到“开始”,右键单击“计算机”并选择“管理
  3. Click Disk Management 单击磁盘管理
  4. You should see some grayed space on your (in my case) C drive 您应该看到(在我的情况下)C驱动器上有一些灰色的空间
  5. Right click the C drive and select Extend Volume. 右键单击C驱动器,然后选择“扩展卷”。
  6. Choose size and go 选择尺寸然后去

Sweet! 甜! I preferred that to using a 3rd party tool with warnings about data loss. 我更喜欢使用第三方工具,其中包含有关数据丢失的警告。

Cheers! 干杯!


#6楼

Actually, Only this these commands are needed: 实际上,只需要这些命令:

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

Then, you can select cloned.dvi in Virtualbox GUI storage. 然后,您可以在Virtualbox GUI存储中选择cloned.dvi。

After that, start the virtual windows and expand your C disk as the methods of Code Chops. 之后,启动虚拟窗口并展开C盘作为Code Chops的方法。

It is not necessary to convert the *.vdi file to *.vmdk file back. 没有必要将* .vdi文件转换回* .vmdk文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值