Solve the problem of insufficient capacity of Virtualbox

Now Virtualbox a new disk. Certain capacity than the original big then perform clone command. Clone the original disk contents to a new disk and then restart the computer. Run-related expansion command.

#克隆磁盘
cd C:\Program Files\Oracle\VirtualBox\
VBoxManage.exe clonehd "C:\Users\Administrator\VirtualBox VMs\centos7\centos7.vdi" "C:\Users\Administrator\VirtualBox VMs\centos7\centos60G.vdi" --existing
#
#                                                                                                        源磁盘.                                           新建的磁盘


#扩容相关命令
lsblk 查看磁盘相关信息

sda           8:0    0  60G  0 disk 
├─sda1        8:1    0   1G  0 part /boot
├─sda2        8:2    0  19G  0 part 
│ ├─cl-root 253:0    0  17G  0 lvm  /
│ └─cl-swap 253:1    0   2G  0 lvm  [SWAP]

发现磁盘已经识别新容量了.
fdisk 利用未分区的容量新建一个分区 sda3 40g
lvm
扩展vg
vgextend cl /dev/sda3
扩展lv(设置新容量)
lvextend -L +50G /dev/cl/root 
扩展文件系统
#查看文件系统分区类型(xfs)
/dev/mapper/cl-root xfs        20G   11G   16G   20% /

    xfs 扩展文件系统命令
    xfs_growfs /dev/mapper/cl-root
    ext  扩展文件系统命令
    resize2fs  /dev/mapper/cl-root

#查看文件系统是否扩展成功
/dev/mapper/cl-root xfs        56G   11G   46G   20% /
已经扩展成功.

Guess you like

Origin www.cnblogs.com/lovesKey/p/11220916.html