VMware ESXi expands the capacity of virtual machines

The hard disk space of the virtual machine managed by ESXi is not enough. Let me talk about how to expand the capacity.

1. View the status quo

Through the following three commands, you can check the status of the hard disk, and you can see that there are only 500G, and 45% has been used. This time we will expand the capacity by 500G.

df -Th
lsblk
fdisk -l

The file name of the IDE disk is /dev/hdxxx

SCSI/SATA/USB disk file name is /dev/sdxxx

The concept of /dev/sda is shown in the following figure:

2. Increase capacity

The hard disk size is set to 1000G

Shut down the virtual machine and view the data after restarting

You can see that the space has increased, but the file system /dev/mapper/centos-root space has not changed

3. Create a new partition

# 创建分区命令
fdisk /dev/sda
再输入p
新增分区输入:n
回车(默认为主分区primary)
分区号,起始扇区,结束扇区都默认(回车)
设置分区格式输入:t
分区号默认(回车)
Hex 代码为 8e (8e代表Linux LVM分区类型)
w (写入分区表)
等待分区完成

View the results and see that the sda3 partition has been successfully created

4. Format the new partition

Restart the virtual machine to reread the partition table

Use the command mkfs.ext3 /dev/sda3 to start formatting the partition

5. Merge partitions

Merge the new partition into /dev/mapper/centos-root

# lvm  
lvm> pvcreate /dev/sda3   
# 输入y确认  
lvm> vgextend centos /dev/sda3    
# 查看一下当前的Volume卷详情   
lvm> vgdisplay -v

Next, merge the system disk /dev/mapper/centos-root with the free capacity of 136446 of sda3 (free pe of sda3), and then exit

lvm> lvextend -l+136446 /dev/mapper/centos-root
lvm> quit

Finally, expand the file system, let the system recognize it, and enter the command

xfs_growfs /dev/mapper/centos-root

Six, view the results

7. Summary

The operation needs to be prudent, do not fill in the wrong

material

  1. Expand the capacity of [virtual machine] in VMWare ESXi
  2. After reading it, you will understand what /dev/sda and /dev/hda are

at last

If you like my article, you can follow my official account (Programmer Malatang)

My personal blog is: https://shidawuhen.github.io/

Review of previous articles:

  1. Design Patterns
  2. recruitment
  3. think
  4. storage
  5. Algorithm series
  6. reading notes
  7. small tools
  8. architecture
  9. network
  10. Go language

Guess you like

Origin blog.csdn.net/shida219/article/details/129261156