加大VirtualBox Image大小的办法
2016-04-30 20:06
274 查看
转:https://blog.jyore.com/2013/06/virtualbox-increase-size-of-rhelfedoracentosscientificos-guest-file-system/
VirtualBox: Increase Size of RHEL/Fedora/CentOS/Scientific Guest File System
Posted on June17, 2013 by Joey
Yore — 20
Comments ↓
Tired of running out of space on your VM and running through complicated steps in order to get your VM resized? This article provides the steps to take without you having to boot live CDs, clone VDI’s, or anything else complicated or time consuming. We will
simply leverage VirtualBox manager commands on our host and system commands on the guest.
E:\Oracle\VirtualBox>VBoxManage modifyhd "D:\VirtualBox VMs\development\development.vdi" --resize 20480
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
First, shutdown the VM you plan to work on. Then we will run the manager tool. the
you wish to resize your 10GB disk to 25GB, then you would use 25600 (1024*25). This should resize the VDI appropriately, however, if you boot up your VM, you will soon see that you are still at your original disk space.
it will be locked. Other volume managers may let you resize the partition. Some may let
you if you boot from a live CD.
With LVM we can actually make all these changes to the logical volume on a live file system. It never hurts to backup your filesystem, or at least anything important, but it is not required.
The following steps will allow you to resize your partition. In a terminal run the following commands in bold (you need root permissions to run fdisk):
df
Take note of the logical volume mapping (ex. /dev/mapper/fedora-root)
fdisk -l
Take note of the filesystem partition of your physical volume sits (ex. /dev/sda2)
fdisk /dev/sda
Run fdisk of this phyisical volume
d
Delete a partition
2
Select your partition (we are using 2 from /dev/sda2)
n
Create a new partition
p
Make it a primary partition
2
The partition number to make it on (same as we deleted)
<return>
Set the starting block (keep the default as it is usually correct)
<return>
Set the ending block (keep the default as it is fine for our use case)
w
Write the partition (will also exit fdisk shell)
reboot
We must reboot in order to have the new partition table loaded
pvresize /dev/sda2
Resizes the physical volume
pvscan
Use to verify the new size
lvextend -l +100%FREE /dev/mapper/fedora-root
Extend the logical volume to take all free space
resize2fs /dev/mapper/fedora-root
Resize the file system
df
See your newly sized volume
And that is it! With the last df command, you should see that your volume increased! In our
example, let’s say you had 9GB of the 10GB disk and you resized it to 25GB. In the first dfcommand,
you would have seen 90% full. After the resize, you should see the system as only 36% full,
thus verifying the resize success!
The commands are reposted below for easier reference:
相关文章推荐
- 【刷题笔记/剑指Offer】51-61
- 第九周学习进度条
- 构建自己的PHP框架--构建缓存组件(2)
- 动态规划常见问题所涉及的公式(转载)
- C经典 写函数进行数据交换
- windows安装Linux系列双系统时基本的注意事项
- maven学习系列4----依赖
- 敏捷管理视频
- Linux内核期末总结
- day3.23总结_Set和Map
- Java核心知识点-JVM再深入
- 构建之法阅读笔记06
- 移动前端第二弹:善用meta
- 判断用户是否登录
- 机器学习笔记05:正则化(Regularization)、过拟合(Overfitting)
- JAVA监听器原理
- 移动前端第一弹:viewport详解
- android 通知栏 notification
- day3.22总结_List
- Linux内核分析学习总结