[VMware/Linux] Virtual machine root directory expansion

Hello everyone, I am a studious junior. The virtual machine/directory capacity allocated by IT recently is too small and does not meet the environment deployment conditions, so I want IT to expand the capacity. IT added a disk to me and then asked me to Expand lvm. . . . . . Record the expansion method here

1. First add a disk, here a disk sdr is added

fdisk -l #查看新的磁盘有没有添加上去

2. Enter lvm management and create pv

pvcreate /dev/sdr #把刚添加的磁盘创建成pv

3. View the volume group information, here mainly to obtain the VG name volume group name

vgdisplay -v

 4. Mount the previously created volume storage volume to the desired volume group

vgextend centos(就是上面查到的vg name) /dev/sdr(第二步创建的pv)

5. Expand the capacity of an existing volume

lvextend -l +100%FREE /dev/mapper/centos-root 
#这里是将/dev/sdr的所有磁盘容量全部加到/dev/mapper/centos-root下

6. File expansion

xfs_growfs /dev/mapper/centos-root
#/dev/mapper/centos-root  你通过df -h 即可看到哪个文件挂载到 / 目录下的

7. Check whether the expansion is successful

df -h

It’s not easy for newcomers to create. If you think it’s good, please give it a thumbs up! ! !

Please indicate the source when reprinting!

                                                            

 

Guess you like

Origin blog.csdn.net/weixin_43784564/article/details/125865274