扩展oracle VM VirtualBox硬盘容量
来源:互联网 发布:porter robinson知乎 编辑:程序博客网 时间:2024/06/02 05:06
1.首先对于box的扩展,只支持VDI VHD两种格式
DOC下,访问到vbox安装目录下:
//VirtualBox 的安装目录cd D:\Oracle\VirtualBox d:
如果硬盘是vmdk格式,首先需要克隆并转格式,命令如下:
VDI:
VBoxManage clonehd "C:\Users\pactera\VirtualBox VMs\centos\centos.vmdk" "C:\Users\pactera\VirtualBox VMs\centos\centos.vdi" --format VDI
VHD:
VBoxManage clonehd "C:\Users\pactera\VirtualBox VMs\centos\centos.vmdk" "C:\Users\pactera\VirtualBox VMs\centos\centos.vhd" --format VHD
其他实用命令:
删除
D:\Oracle\VirtualBox>VBoxManage storagectl <”C:\Users\pactera\VirtualBox VMs\cen
tos\centos.vdi”> –remove
浏览
D:\Oracle\VirtualBox>VBoxManage.exe list hdds
2、修改硬盘大小
示例为:15G即25600M
VBoxManage modifyhd "C:\Users\pactera\VirtualBox VMs\centos\centos.vhd" --resize 25600
3、用新增的空间新建分区
[root@localhost ~]# fdisk /dev/sdaWelcome 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): mCommand 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 (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)Command (m for help): nPartition type: p primary (3 primary, 0 extended, 1 free) e extendedSelect (default e): pSelected partition 4No free sectors availableCommand (m for help): xfs_growfs /dev/mapper/centos-root enter后输入w再enter
4、用以下命令可以看到 多了一个/dev/sda3的分区
[root@localhost ~]# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes, 52428800 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: 0x000d51e5
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 20971519 9436160 8e Linux LVM
/dev/sda3 20971520 52428799 15728640 83 Linux
Disk /dev/mapper/centos-root: 24.7 GB, 24687673344 bytes, 48218112 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 /dev/mapper/centos-swap: 1073 MB, 1073741824 bytes, 2097152 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
c . reboot 重启,然后格式化/dev/sda3
mkfs.ext3 /dev/sda3
5、创建物理卷
[root@localhost ~]# pvcreate /dev/sda3
Physical volume “/dev/sda3” successfully created
使用新增物理卷扩展vg
[root@localhost ~]# vgextend centos /dev/sda3
Volume group “centos” successfully extended
[root@localhost ~]#xfs_growfs /dev/mapper/centos-root
6、lvresize -l +100%FREE /dev/mapper/centos-root
Size of logical volume centos/root changed from <8.00 GiB (2047 extents) to 22.99 GiB (5886 extents).
Logical volume centos/root successfully resized.
7、最后扩展在线扩展文件系统:
[root@localhost ~]#xfs_growfs /dev/mapper/centos-root
说明: 很多资料是说这个: resize2fs -f /dev/mapper/centos-root
但是报错,因为centOS默认文件系统是xfs的只能用,NND坑了我好久(直到看到别人的http://blog.itpub.net/24486203/viewspace-1790666)才知道要用这个:xfs_growfs
/dev/mapper/centos-root
[root@localhost ~]#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 23G 3.6G 20G 16% /
devtmpfs 486M 0 486M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.7M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/sda1 1014M 125M 890M 13% /boot
tmpfs 100M 0 100M 0% /run/user/0
/dev/sda3 20971520 52428799 15728640 83 Linux
报错:
1>操作过程如果有报错:
WARNING: Re-reading the partition table failed with error 22:
执行:
[root@localhost ~]#/sbin/kpartx -a /dev/sda3
后继续操作
参考文章:
主:http://blog.csdn.net/laiyangwen1120/article/details/51036404
其他:
http://blog.163.com/zhu329599788@126/blog/static/66693350201731521131776/
http://blog.csdn.net/weiguang1017/article/details/52252448
https://zhidao.baidu.com/question/468894513.html
- 扩展oracle VM VirtualBox硬盘容量
- VirtualBox 扩展虚拟硬盘容量
- VirtualBox如何扩展虚拟机Ubuntu的硬盘容量?
- Oracle VM virtualBox快捷键
- Oracle VM VirtualBox
- Oracle VM VirtualBox
- Oracle VM VirtualBox 安装
- Oracle VM VirtualBox安装笔记
- oracle vm virtualbox按照Ubuntu
- 虚拟机安装oracle vm virtualbox
- Oracle VM Virtualbox使用总结
- Oracle VM VirtualBox 导入vdi
- Oracle VM VirtualBox网络说明
- Oracle VM VirtualBox安装 CentOS
- Oracle VM VirtualBox的使用
- Oracle VM VirtualBox安装centos7
- Oracle VM VirtualBox 导入vdi
- VM增加硬盘容量
- 剑指offer——62.二叉搜索树的第k个结点
- 数组演练——合并数组
- vim配置
- Redis常用命令(3)Hash类型
- apply()与call()的区别
- 扩展oracle VM VirtualBox硬盘容量
- 面向对象 串行化对象 魔术方法
- Maven -- 将引用的本地jar文件打进war包里
- ssh端口转发
- 51 mod P1627 瞬间移动 排列组合
- fastclick.js解决移动端(ipad)点击事件反应慢问题
- cordova震动蜂鸣器输入参数
- JavaScript难点系列(六):原型链与继承
- Java设计模式总结——6大设计原则