Oracle VM VirtualBox修改磁盘大小

本文详细描述了如何在Windows环境下,通过命令行操作修改OracleVirtualBox虚拟机的磁盘大小,包括停止虚拟机、使用VBoxManage增大磁盘、格式化新空间以及在Linux中调整LVM卷组和逻辑卷的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、 修改虚拟机磁盘大小
先把虚拟机停掉。再增加磁盘大小。
路径中有空格的用""包起来。

D:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "D:\Program Files\VirtualBox VMs\mycentos\mycentos.vdi" --resize 30000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

查看虚拟机的大小
在这里插入图片描述
二、启动虚拟机
查看磁盘,看不到新增的磁盘。
在这里插入图片描述
查看总磁盘已经扩展到31.5GB

[root@localhost ~]# fdisk -l /dev/sda

Disk /dev/sda: 31.5 GB, 31457280000 bytes, 61440000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009162b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

三、格式化新增的空间

[root@localhost ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值