oracle virtualbox 扩大虚拟机硬盘

调整分配的disk大小

cd D:\Oracle\VirtualBox\

D:

VBoxManage.exe list hdds

VBoxManage.exe modifyhd 2e8d53da-8f90-410f-bd1c-19c4798afab8 --resize 51200

这时在操作系统层面已经看到扩容后的硬盘大小,但是并没有分配给/dev/sda2使用。

[root@node1 ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000a9539

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM

Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 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: 2147 MB, 2147483648 bytes, 4194304 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

创建/dev/sda3,然后加到 /dev/sda2 所在的vg里
centos 7 操作如下

# fdisk /dev/sda
# pvcreate /dev/sda3
# vgextend centos /dev/sda3
# lvextend -L +20G /dev/centos/root
# xfs_growfs /dev/centos/root
# xfs_info /dev/centos/root
# df -hT

你可能感兴趣的:(virtualbox)