Ubuntu 18.04.1 LTS LVM 磁盘扩容

Ubuntu LVM 磁盘扩容 参考: https://blog.csdn.net/yjk13703623757/article/details/80267647

--------》查看现有磁盘空间
root@ubuntu_server:/dev# df -hl  
Filesystem                         Size  Used Avail Use% Mounted on
udev                               957M     0  957M   0% /dev
tmpfs                              198M  1.2M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  3.9G  3.9G     0 100% /                  --------------》原来磁盘空间
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/loop0                          90M   90M     0 100% /snap/core/6130
/dev/loop1                          87M   87M     0 100% /snap/core/4917
/dev/sda2                          976M  139M  771M  16% /boot
tmpfs                              197M     0  197M   0% /run/user/1000
tmpfs                              197M     0  197M   0% /run/user/0

--------->扩容失败
root@ubuntu_server:/dev# sudo lvresize -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv       
  /etc/lvm/archive/.lvm_ubuntu_server_6698_1809159778: write error failed: No space left on device   --------------》失败
  
--------》使用了lvresize,重新调整了(+10G)/dev/ubuntu-vg/root的lv大小,并刷新了文件系统。(扩展磁盘)
root@ubuntu_server:/dev# lvresize -A n -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv    
  Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to 14.00 GiB (3584 extents).
  WARNING: This metadata update is NOT backed up.
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
  
--------》扩张文件系统
root@ubuntu_server:/dev# resize2fs -p /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 = 1, new_desc_blocks = 2
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 3670016 (4k) blocks long.

----------》再次查看磁盘使用情况(扩容成功)
root@ubuntu_server:/dev# df -hl
Filesystem                         Size  Used Avail Use% Mounted on
udev                               957M     0  957M   0% /dev
tmpfs                              198M  1.2M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   14G  3.9G  9.3G  30% /              --------------》现在的磁盘空间
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/loop0                          90M   90M     0 100% /snap/core/6130
/dev/loop1                          87M   87M     0 100% /snap/core/4917
/dev/sda2                          976M  139M  771M  16% /boot
tmpfs                              197M     0  197M   0% /run/user/1000
tmpfs   

猜你喜欢

转载自blog.csdn.net/LookingNorth/article/details/86504637