操作前需要关闭打开的虚拟机,vbox不用关闭。

打开Finder,找到【应用程序】,在右侧找到VirtualBox.app,然后打开右键,找到【显示包内容】,记住这个路径


2.打开终端,来到你找到的路径:

cd /Applications/VirtualBox.app/Contents/MacOS/


3.list命令查看虚拟硬盘的uuid

VBoxManage list hdds

UUID:           afb915b0-9f0b-4627-b02b-c0fdd8196590

Parent UUID:    base

State:          locked read

Type:           normal (base)

Location:       /Users/刘德华/VirtualBox VMs/python/python.vdi

Storage format: VDI

Capacity:       8192 MBytes

Encryption:     disabled


4.查看VBoxManager怎么用:

VBoxManage -h


执行命令扩容到15G:5.使用 VBoxManage modifyhd uuid –-resize capacity 命令行来扩容

capacity = x GB * 1024

VBoxManage modifyhd afb915b0-9f0b-4627-b02b-c0fdd8196590 --resize 15360


查看扩容后的结果:

VBoxManage list hdds

UUID:           afb915b0-9f0b-4627-b02b-c0fdd8196590

Parent UUID:    base

State:          created

Type:           normal (base)

Location:       /Users/刘德华/VirtualBox VMs/python/python.vdi

Storage format: VDI

Capacity:       15360 MBytes

Encryption:     disabled