Vagrant 擴大磁盤根目錄(圖文詳解)
實驗環境:
[root@centos72 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@centos72 ~]# uname -a
Linux centos72 3.10.0-327.4.5.el7.x86_64 #1 SMP Mon Jan 25 22:07:14 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
1.安裝vagrant-disksize
【參考鏈接】https://github.com/sprotheroe/vagrant-disksize
[root@centos72 ~]# vagrant plugin install vagrant-disksize
2.修改vagrantfile配置文件
3.重啓虛擬機
重啓前如圖:
重啓中如圖:
重啓後如圖:
4.新建分區
5.刷新分區表
6.創建物理卷(pvcreate)
[root@cenos72 ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7.添加新的物理卷到卷組centos
[root@centos72~]# vgextend centos /dev/sda3
Volume group "centos" successfully extended
8.查看卷組,增加卷組centos的大小
[root@centos72 ~]# lvresize -L +10G /dev/mapper/centos-root
注意:/dev/mapper/centos-root 由 df -h 查看
9. 刷新邏輯卷centos-root的大小
[root@centos72 ~]# xfs_growfs /dev/mapper/centos-root
注意:
(1)如果此邏輯捲上的文件系統是EXT3/EXT4類型,需要使用resize2fs工具;
(2)如果此邏輯捲上的文件系統是XFS類型,需要使用 xfs_growfs。
10.確認擴容後的大小
[root@centos72 ~]# df -hT