ESXi Ubuntu的磁盘扩展

执行命令

root@ub22:~# lvextend --resizefs -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <15.00 GiB (3839 extents) to <30.00 GiB (7679 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 4
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 7863296 (4k) blocks long.

执行之前 (shí

$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              197M  1.3M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   15G   14G   91M 100% /
tmpfs                              982M     0  982M   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          2.0G  129M  1.7G   8% /boot
tmpfs                              197M  4.0K  197M   1% /run/user/1000

执行之后

root@ub22:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                Q2OWHx-8i9n-8iY2-2gQo-i9d0-jUu2-hTNxnv
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2023-10-14 07:17:34 +0000
  LV Status              available
  # open                 1
  LV Size                <15.00 GiB
  Current LE             3839
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
root@ub22:~# lvextend
  No command with matching syntax recognised.  Run 'lvextend --help' for more information.
root@ub22:~# ll /dev/mapper
total 0
drwxr-xr-x  2 root root      80 Oct 17 21:05 ./
drwxr-xr-x 19 root root    4060 Oct 14 07:24 ../
crw-------  1 root root 10, 236 Oct 14 07:24 control
lrwxrwxrwx  1 root root       7 Oct 17 21:05 ubuntu--vg-ubuntu--lv -> ../dm-0
root@ub22:~# lvextend --resizefs -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <15.00 GiB (3839 extents) to <30.00 GiB (7679 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 4
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 7863296 (4k) blocks long.

请参照以下链接:https://minory.org/esxi-ubuntu-lvextend.html