扩容(LVM)分区 1.查看磁盘情况 df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 391M 1.6M 389M 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv 20G 17G 2.4G 88% / tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 974M 135M 773M 15% /boot 2.显示存在的卷组 vgdisplay --- Volume group --- VG Name ubuntu-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size <29.00 GiB PE Size 4.00 MiB Total PE 7423 Alloc PE / Size 5120 / 20.00 GiB Free PE / Size 2303 / <9.00 GiB VG UUID BEsGEW-TN2c-aOHh-e0Yk-wmWq-KXrR-C40Ule 可以看出Alloc PE / Size 5120 / 20.00 GiB Free PE / Size 2303 / <9.00 GiB 这两个 第一个就是我的 /dev/mapper/ubuntu–vg-ubuntu–lv 这个磁盘 第二个是 这个磁盘可以扩容的大小 也就是剩余可以扩容多少 3.扩容开始 lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv Size of logical volume ubuntu-vg/ubuntu-lv changed from 20.00 GiB (5120 extents) to <29.00 GiB (7423 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. 4.重新计算磁盘大小 resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv #resize2fs /dev/ubuntu-vg/ubuntu-lv 5.重新查看磁盘情况 vgdisplay --- Volume group --- VG Name ubuntu-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size <29.00 GiB PE Size 4.00 MiB Total PE 7423 Alloc PE / Size 7423 / <29.00 GiB Free PE / Size 0 / 0 VG UUID BEsGEW-TN2c-aOHh-e0Yk-wmWq-KXrR-C40Ule 6.查看磁盘情况 df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 391M 1.6M 389M 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv 29G 17G 11G 60% / tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 974M 135M 773M 15% /boot