LVM扩容逻辑磁盘

266 阅读1分钟
#划分pv

pvcreate /dev/sdb1

#扩容vg

root@agent1:~# vgextend ubuntu-vg /dev/sdb1
  Volume group "ubuntu-vg" successfully extended

#扩容lv

root@agent1:~# lvextend -L +19G /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <19.00 GiB (4863 extents) to <38.00 GiB (9727 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

#更新扩容

root@agent1:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 5
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 9960448 (4k) blocks long.

#查看

root@agent1:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               954M     0  954M   0% /dev
tmpfs                              198M  920K  197M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   38G  4.2G   32G  12% /
tmpfs                              986M     0  986M   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              986M     0  986M   0% /sys/fs/cgroup
/dev/sda2                          976M  150M  760M  17% /boot
tmpfs                              198M     0  198M   0% /run/user/1000