将 Proxmox 虚拟机管理程序上的磁盘大小从 8GB 扩展到 18GB 后,我尝试在 Ubuntu 20.04 VM 上看到这个新空间:

这些是我在虚拟机上运行的命令
# Physical volume is called /dev/sda3
sudo pvs
# resize the Physical Volume (PV)
sudo pvresize /dev/sda3
# root logical volume is
df -h
# expand the logical volume
sudo lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
# resize my number 3 partition (this gave me 17GB on sda3)
sudo growpart /dev/sda 3
Run Code Online (Sandbox Code Playgroud)
我可以在sda3分区上看到它!
想看看 18GB 的/dev/mapper/ubuntu--vg-ubuntu--lv
https://unix.stackexchange.com/a/583544 - 我正在遵循这些说明
任何指点都会很棒!
Dav*_*eer 12
https://packetpushers.net/ubuntu-extend-your-default-lvm-space/是对我帮助最大的文章。
总之
# allocate more space on hypervisor
# make the partition see the space (dev/sda3, Resize, Write, quit)
sudo cfdisk
# extend the physical volume from the partition
sudo pvresize /dev/sda3
# extend LV to use up all space from VG
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# resize file system
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
# check can see the space on filesystem
df -h
Run Code Online (Sandbox Code Playgroud)