VirtualBox:不支持在mac os x resize上的VBoxManage modifyhd托管

时间:2012-09-06 15:20:18

标签: macos resize virtualbox

我正在使用VirtualBox在OS X上托管VM。我正在尝试使用以下命令调整虚拟硬盘的大小:

VBoxManage modifyhd [file path]/ubuntu_vm-disk1.vmdk --resize 16000

我收到以下错误:

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

这是我的showhdinfo:

Accessible:           yes
Logical size:         15719 MBytes
Current size on disk: 6066 MBytes
Type:                 normal (base)
Storage format:       VMDK
Format variant:       dynamic default

我做错了什么?

已更新 我删除了所有快照,并在路径周围用“”重试命令,现在出现以下错误:

VBoxManage: error: Failed to lock media when compacting '/Users/dwstein_old/VirtualBox VMs/Ubuntu_120723/ubuntu_vm-disk1.vmdk'
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Medium, interface IMedium, callee nsISupports
Context: "Resize(cbResize, progress.asOutParam())" at line 522 of file VBoxManageDisk.cpp
VBoxManage: error: Code VBOX_E_INVALID_OBJECT_STATE (0x80BB0007) - Current object state prohibits operation (extended info not available)

4 个答案:

答案 0 :(得分:0)

可以通过3个步骤完成:

  • 使用VBoxManage将VMDK克隆为VDI格式
  • 使用VBoxManage调整磁盘大小以创建可用空间
  • 使用GParted
  • 修改文件系统以为驱动器分配可用空间

我在这里写了resize your VM Disk

的教程

答案 1 :(得分:0)

这只是一个许可问题。只需使用管理员命令提示符尝试相同的命令。

答案 2 :(得分:0)

简短的回答是,您需要先对其进行转换,然后再对其进行克隆,然后再尝试调整其大小。您还有一个额外的第一步来转换它。 vmdk-> vdi

1。正如tvial所说,请按照tutorial

中的步骤1将您的vdmk文件转换为vdi

这里说使用clonehd命令。因此,在您的情况下,它将完全像: VBoxManage clonehd <ubuntu_vm-disk1.vmdk> <output-name-here-step1.vdi> --format vdi

他的教程中的实际步骤是:

# Go to the VM folder on your Host computer.
cd ~/VirtualBox VMs/VM-NAME  
# Since resize can't be applied to .vmdk, we'll convert the disk to .vdi format
VBoxManage clonehd box-disk1.vmdk box-disk1.vdi --format vdi  
# Output example : 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% # Clone hard disk created in format 'vdi'. UUID: 49474a0a-c48c-4b15-8df0-0b9687b4bbaf

2。克隆步骤

2a。在VirtualBox内,创建一个具有更多分配空间的新vm。

2b。 (可能会跳过此步骤)运行命令clonemedium,其输出文件名与第1步中的步骤1相同,而您在第2a步中刚刚创建的vdi作为第二个参数,在您的情况下: VBoxManage clonemedium <output-name-here-step1.vdi> <name-of-vdi-step2a.vdi> --existing

别忘了最后的--existing

3。请按照此处great tutorial for OS X

的其余步骤进行操作

完成教程,调整文件大小。如果运行VirtualBox 5.1.2或更高版本,请使用modifymedium而不是Modifyhd。我使用了modifyhd,但其他资源表示不赞成使用modifymedium。

VBoxManage modifymedium --resize 1600 <name-of-vdi-step2a>.vdi

4。还应注意,Ubuntu(其中的VM)可能识别分配的更大空间。您必须启动Ubuntu VM,然后对其重新分区。可以找到相关步骤here

答案 3 :(得分:0)

我的情况-具有快照和动态分配的内存的虚拟机6.0。

备份您的虚拟机并关闭它。

第1步-删除快照。

第2步-使用下面给出的命令增加虚拟大小。

VBoxManage modifymedium disk "\Path\To\Vdi\xyz.vdi" --resize XXXXX 

(新大小以MB为单位)

第3步-启动虚拟机并打开终端。

步骤4。-此步骤将为您提供所有驱动器分区的列表。就我而言,应该是/ dev / disk1的disk1s2增大了大小。

diskutil list

步骤5--

diskutil repairdisk disk1

第6步--

diskutil apfs resizeContainer disk1s2 124g 

(这里124g是我实际想要的大小。)