VirtualBox修改虚拟机磁盘VDI的大小
2016-12-06 09:55
357 查看
虚拟机在使用的过程中,有时会遇到磁盘大小不够用,如果设置了”动态分配存储“,可以通过下面的方法对磁盘的空间进行手动扩展。
1.启动CMD命令行,进入VirtualBox的安装目录。如
cd E:\Program Files\Oracle\VirtualBox
2.查看需要修改的虚拟硬盘:
E:\Program Files\Oracle\VirtualBox>VBoxManage.exe list hdds
UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
Parent UUID: base
State: locked write
Type: normal (base)
Location: F:\VM\CentOS-64.vdi
Storage format: VDI
Capacity: 8000 MBytes
UUID: 707d45b6-380d-4e51-96bd-8c9508bfd313
Parent UUID: base
State: created
Type: normal (base)
Location: F:\VM\CentOS-64-ext.vdi
Storage format: VDI
Capacity: 21273 MBytes
UUID: aca81637-fbc0-4826-be66-847ecc96d83b
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi
Storage format: VDI
Capacity: 10240 MBytes
----
我们看到共有三个虚拟磁盘,我们要修改图中第一个,它的空间大小为8G,UUID:e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
2. 调整磁盘空间为15G:
E:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a --resize 150000%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%3.重新查看:E:\Program Files\Oracle\VirtualBox>VBoxManage.exe list hdds
UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
Parent UUID: base
State: locked write
Type: normal (base)
Location: F:\VM\CentOS-64.vdi
Storage format: VDI
Capacity: 15000 MBytesUUID: 707d45b6-380d-4e51-96bd-8c9508bfd313
Parent UUID: base
State: created
Type: normal (base)
Location: F:\VM\CentOS-64-ext.vdi
Storage format: VDI
Capacity: 21273 MBytesUUID: aca81637-fbc0-4826-be66-847ecc96d83b
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi
Storage format: VDI
Capacity: 10240 MBytes4.查看新的磁盘空间重新启动虚拟机,查看磁盘情况。[root@aimin ~]# fdisk -l /dev/sdaDisk /dev/sda: 15.7 GB, 15728640000 bytes
255 heads, 63 sectors/track, 1912 cylinders 可以看到磁盘空间已经扩展到15G,但这时还不可以使用。5.Enable新增加的空间使用 fdisk 将虚拟磁盘的空闲空间创建为一个新的分区。注意要使用代表 Linux LVM 的分区号 8e 来作为 ID。# fdisk /dev/sda n {new partition} p {primary partition} 3 {partition number} [这时会提示修改大小,选择默认直接回车即可]t {change partition id} 3 {partition number} 8e {Linux LVM partition} w------如果中间有设置大小之类的提示,就直接回车。完成后,如果提示:WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)就重启一下系统。 6.查看新增加的sda3是否标记为LVM,如果没有需要reboot#fdisk -l /dev/sda7.调整LVM大小先看一下Volume Group名称[root@aimin ~]# vgdisplay
--- Volume group ---
VG Name vg_aimin....vg_aimin是我的VolumeGroup的名称,实际操作时,需要使用实际显示的名称。 8.把新分配的空间创建一个新的物理卷#pvcreate /dev/sda39.然后使用新的物理卷来扩展 LVM 的 VolGroup,# vgextend vg_aimin /dev/sda3
No physical volume label read from /dev/sda3
Writing physical volume data to disk "/dev/sda3"
Physical volume "/dev/sda3" successfully created
Volume group "vg_aimin" successfully extended10.然后扩展 LVM 的逻辑卷 vg_aimin-lv_root,# lvextend /dev/vg_aimin/lv_root /dev/sda3
11.调整逻辑卷的大小#resize2fs /dev/vg_aimin/lv_root到这里就完成了空间的扩展。 12.查看效果[root@aimin ~]# df -h文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_aimin-lv_root 12G 5.2G 6.2G 46% /tmpfs 499M 80K 499M 1% /dev/shm/dev/sda1 485M 33M 427M 8% /boot成功扩展!!!若感兴趣请查看原文来源: http://blog.csdn.net/wutong_login/article/details/40147057
1.启动CMD命令行,进入VirtualBox的安装目录。如
cd E:\Program Files\Oracle\VirtualBox
2.查看需要修改的虚拟硬盘:
E:\Program Files\Oracle\VirtualBox>VBoxManage.exe list hdds
UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
Parent UUID: base
State: locked write
Type: normal (base)
Location: F:\VM\CentOS-64.vdi
Storage format: VDI
Capacity: 8000 MBytes
UUID: 707d45b6-380d-4e51-96bd-8c9508bfd313
Parent UUID: base
State: created
Type: normal (base)
Location: F:\VM\CentOS-64-ext.vdi
Storage format: VDI
Capacity: 21273 MBytes
UUID: aca81637-fbc0-4826-be66-847ecc96d83b
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi
Storage format: VDI
Capacity: 10240 MBytes
----
我们看到共有三个虚拟磁盘,我们要修改图中第一个,它的空间大小为8G,UUID:e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
2. 调整磁盘空间为15G:
E:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a --resize 150000%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%3.重新查看:E:\Program Files\Oracle\VirtualBox>VBoxManage.exe list hdds
UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a
Parent UUID: base
State: locked write
Type: normal (base)
Location: F:\VM\CentOS-64.vdi
Storage format: VDI
Capacity: 15000 MBytesUUID: 707d45b6-380d-4e51-96bd-8c9508bfd313
Parent UUID: base
State: created
Type: normal (base)
Location: F:\VM\CentOS-64-ext.vdi
Storage format: VDI
Capacity: 21273 MBytesUUID: aca81637-fbc0-4826-be66-847ecc96d83b
Parent UUID: base
State: created
Type: normal (base)
Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi
Storage format: VDI
Capacity: 10240 MBytes4.查看新的磁盘空间重新启动虚拟机,查看磁盘情况。[root@aimin ~]# fdisk -l /dev/sdaDisk /dev/sda: 15.7 GB, 15728640000 bytes
255 heads, 63 sectors/track, 1912 cylinders 可以看到磁盘空间已经扩展到15G,但这时还不可以使用。5.Enable新增加的空间使用 fdisk 将虚拟磁盘的空闲空间创建为一个新的分区。注意要使用代表 Linux LVM 的分区号 8e 来作为 ID。# fdisk /dev/sda n {new partition} p {primary partition} 3 {partition number} [这时会提示修改大小,选择默认直接回车即可]t {change partition id} 3 {partition number} 8e {Linux LVM partition} w------如果中间有设置大小之类的提示,就直接回车。完成后,如果提示:WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)就重启一下系统。 6.查看新增加的sda3是否标记为LVM,如果没有需要reboot#fdisk -l /dev/sda7.调整LVM大小先看一下Volume Group名称[root@aimin ~]# vgdisplay
--- Volume group ---
VG Name vg_aimin....vg_aimin是我的VolumeGroup的名称,实际操作时,需要使用实际显示的名称。 8.把新分配的空间创建一个新的物理卷#pvcreate /dev/sda39.然后使用新的物理卷来扩展 LVM 的 VolGroup,# vgextend vg_aimin /dev/sda3
No physical volume label read from /dev/sda3
Writing physical volume data to disk "/dev/sda3"
Physical volume "/dev/sda3" successfully created
Volume group "vg_aimin" successfully extended10.然后扩展 LVM 的逻辑卷 vg_aimin-lv_root,# lvextend /dev/vg_aimin/lv_root /dev/sda3
11.调整逻辑卷的大小#resize2fs /dev/vg_aimin/lv_root到这里就完成了空间的扩展。 12.查看效果[root@aimin ~]# df -h文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/vg_aimin-lv_root 12G 5.2G 6.2G 46% /tmpfs 499M 80K 499M 1% /dev/shm/dev/sda1 485M 33M 427M 8% /boot成功扩展!!!若感兴趣请查看原文来源: http://blog.csdn.net/wutong_login/article/details/40147057
相关文章推荐
- Android-屏幕适配全攻略(绝对详细)
- WKWebView的交互
- Mac下配置多个SSH-Key
- 将MongoDB服务器设置成Windows启动服务
- Fiddler抓手机数据包
- python3.5如何安装statsmodels包?
- Python 图形处理库PIL批量修改图片大小和格式
- 循环引用,看我就对了
- RabbitMQ的入门和安装
- 恋爱:适合单身男女青年的相亲约会恋爱(我只是看着好玩才读的)
- Product of Array Except Self
- 文件下载 springmvc
- 反射
- 获取手机号码被360标记问题(代码备份)
- Android Studio混淆的简单使用
- 按顺序保存一系列图像时文件名的设置使用
- 【玩转SQLite系列】(三)通过sql语句操作SQLite数据库
- Django
- Oracle模糊查询时间以及按照时间区间查询
- 环信推送