200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > Oracle VM VirtualBox Ubuntu1804虚拟机磁盘扩容

Oracle VM VirtualBox Ubuntu1804虚拟机磁盘扩容

时间:2020-05-06 05:06:48

相关推荐

Oracle VM VirtualBox Ubuntu1804虚拟机磁盘扩容

一、需要解决的问题

安装ubuntu1804时分配的磁盘空间50GB,伴随着安装软件和资料文件的堆积,磁盘剩余容量越来越少,需要给已经安装的虚拟机磁盘扩展10GB容量。

二、使用到的软件

1、VboxManage.exe 安装virtual box时已默认安装,在virtual box软件路径下。

2、Gparted,ubuntu桌面软件。

三、扩容方法

1、Windows端cmd终端中使用VboxManage工具给vdi扩容

注:执行命令前需要先关闭虚拟机,并确认实体物理机器的磁盘是否有足够的容量分配给虚拟机。

a) 使用VBoxManage.exe list hdds查看系统安装虚拟机请,获取UUID;

D:\software\VirtualBox>VBoxManage.exe list hddsUUID: 152485ac-0794-4827-9fe4-9270b141e146Parent UUID: baseState:createdType: normal (base)Location: D:\Virtual_OS\ubuntu1804\ubuntu1804.vdiStorage format: VDICapacity: 51200 MBytesEncryption:disabledUUID: a57adf6f-2798-424f-8082-ae7aeaa3aa0eParent UUID: baseState:locked writeType: normal (base)Location: D:\Virtual_OS\ubuntu1804-test\ubuntu1804-test\ubuntu1804-test.vdiStorage format: VDICapacity: 51200 MBytesEncryption:disabledUUID: 14690b28-6963-4009-b31d-0a22eba2eed5Parent UUID: baseState:createdType: normal (base)Location: D:\Virtual_OS\ubuntu1604\ubuntu16.04\ubuntu16.04-disk002.vdiStorage format: vdiCapacity: 125381 MBytesEncryption:disabledUUID: 19569733-5327-4179-9fe4-97243f7833adParent UUID: baseState:createdType: normal (base)Location: D:\Virtual_OS\ubuntu\ubuntu.vdiStorage format: VDICapacity: 30979 MBytesEncryption:disabledUUID: b3d85e4a-77bc-4569-ae14-53fadb5d7a1aParent UUID: baseState:createdType: normal (base)Location: D:\Virtual_OS\Ubuntu1204\Ubuntu1204\Ubuntu1204.vdiStorage format: VDICapacity: 10240 MBytesEncryption:disabled

b) 使用VBoxManage.exe modifyhd对指定的UUID磁盘容量扩展。

格式:

VBoxManage.exe modifyhd [UUID] --resize [size]

resize 大小计算 60x1024 = 61440

D:\software\VirtualBox>VBoxManage.exe modifyhd a57adf6f-2798-424f-8082-ae7aeaa3aa0e --resize 614400%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

可能遇到的问题:

没有关闭虚拟机就执行磁盘扩展,报错如下:

D:\software\VirtualBox>VBoxManage.exe modifyhd a57adf6f-2798-424f-8082-ae7aeaa3aa0e --resize 61440VBoxManage.exe: error: Failed to lock media when resizing 'D:\Virtual_OS\ubuntu1804-test\ubuntu1804-test\ubuntu1804-test.vdi'VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MediumWrap, interface IMedium, callee IUnknownVBoxManage.exe: error: Context: "Resize(cbResize, pProgress.asOutParam())" at line 810 of file VBoxManageDisk.cppVBoxManage.exe: error: Failed to resize medium!

扩容完之后,查看virtual box 虚拟机下的存储空间已经从50GB扩展到60GB

2、虚拟机中使用Gparted软件给磁盘扩容

扩展完磁盘容量后,新扩展的磁盘空间还是未分配的。

打开Gparted软件(如果还未安装需要先安装)

分区显示有10G的内容未分配

已分区的盘右键选择“Resize/Move”,在弹窗的界面中“New size”中填写要扩展的容量。

参考文档

给VirtualBox上的Ubuntu虚拟机扩展硬盘空间/qinqin-me/p/QQQ2260996312.htmlx

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。