Expansion of centos virtual machine

I would like to ask you a question. The department has applied for a high-configuration machine specifically for compiling code. Since the previous compilation time was in a virtual machine, the original virtual machine was exported to ova, then ubuntu was installed on the physical machine, and vmware was installed on ubuntu to import the three centos.

the above is the background of the problem. Since the disk allocated to one of the machines (centos7) is relatively small during pre-allocation, is there any other way to expand the capacity of a partition of the virtual machine (without affecting the original data)

ubuntu physical machine partition:

root@somecompany-System-Product-Name:~/vmware-sharp df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  2.3M  3.2G   1% /run
/dev/sda2       439G  259G  158G  63% /
tmpfs            16G     0   16G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/loop0      2.4M  2.4M     0 100% /snap/gnome-calculator/180
/dev/loop2       13M   13M     0 100% /snap/gnome-characters/103
/dev/loop1       15M   15M     0 100% /snap/gnome-logs/37
/dev/loop3      141M  141M     0 100% /snap/gnome-3-26-1604/70
/dev/loop4      3.8M  3.8M     0 100% /snap/gnome-system-monitor/51
/dev/loop5       35M   35M     0 100% /snap/gtk-common-themes/319
/dev/loop6       87M   87M     0 100% /snap/core/4917
/dev/sda1       511M  4.7M  507M   1% /boot/efi
tmpfs           3.2G   16K  3.2G   1% /run/user/121
tmpfs           3.2G   64K  3.2G   1% /run/user/0
root@somecompany-System-Product-Name:~/vmware-sharp 

there is 158g of space available on the physical machine disk, and vmware and so on are installed in the root directory.

centos7 virtual machine situation:


[root@localhost ~]-sharp lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   80G  0 disk 
sda1            8:1    0  200M  0 part /boot
sda2            8:2    0 39.8G  0 part 
  centos-root 253:0    0 35.8G  0 lvm  /
  centos-swap 253:1    0    4G  0 lvm  [SWAP]
sdb               8:16   0  100G  0 disk 
sdb1            8:17   0  100G  0 part /compile


[root@localhost ~]-sharp df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   36G   14G   23G  38% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G   89M  3.9G   3% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sdb1                 99G   68G   27G  72% /compile
/dev/sda1                197M  108M   89M  55% /boot
tmpfs                    799M     0  799M   0% /run/user/0
[root@localhost ~]-sharp 
[root@localhost ~]-sharp fdisk -l

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000da464

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    83886079    41737216   8e  Linux LVM

Disk /dev/mapper/centos-root: 38.4 GB, 38440796160 bytes, 75079680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7ce45d25

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576   83  Linux
[root@localhost ~]-sharp 

as shown in the figure above, I hung the disk of / dev/sdb1 to the / compile directory. The available size of compile is only 27g. How to use the disk capacity of ubuntu physical machine to expand the size of the virtual machine / compile, provided that the existing data content is not affected.
can you expand the capacity / compile size according to the operations in the article centos7 disk expansion . Thank you.

Apr.03,2022

your virtual machine uses lvm system, and dynamic expansion is very simple.
you can refer to this article

.

https://www.rootusers.com/how...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3df4b-44765.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3df4b-44765.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?