VMware virtual machine hard disk expansion

Virtual machine hard disk expansion:

1. Shut down the virtual machine, select to edit the virtual machine, click the hard disk, and then click Expand

2. Enter the maximum disk size

 3. Click the extension and start the machine

Note: If the capacity cannot be expanded, delete the created snapshot to expand the capacity. After the expansion is completed, it is recommended to create a snapshot before operating

4. After booting, enter df -h to check the disk space

5. Run fdisk  -l to view hard disk information. (Generally, only sda and sda1 are not expanded)

6. Run fdisk /dev/sda

 7. Enter m, check that n is add new partition, enter n
and enter p, and everything after p is selected as the default. (just press enter)

 8. Enter t again, enter the partition number according to the default, and enter 8e for the Hex code (change the partition type to Linux  LVM ).

9. Enter w to save and exit

 10. It is recommended to reboot first, and then use fdisk -l to check whether it takes effect (the next step may go wrong if you do not restart)

 11. Format the created disk partition, mkfs -t ext3 /dev/sda3.

 12. Run pvcreate /dev/sda3. Enter y (you need to convert the disk type to Linux LVM before you can use the pvcreate operation)

 13. Use pvdisplay to view the new physical volume.

 14. Add /dev/sda3 to the centos volume group, use vgextend centos /dev/sda3 at this time. (I don’t know what volume group I belong to, enter df -h to view /dev/mapper/*-*, for example /dev/mapper/centos-root, the volume group is centos) 

 15. Increase the size of /dev/mapper/centos-root by 10GB. Use lvresize -L + 10G /dev/mapper/centos-root. (Pay attention to the size of the expanded memory. If an error is reported, it means that there is no such a large space for expansion. You need to reduce and increase the space. For example, change it to: lvresize -L + 9.9G /dev/mapper/centos-root)

 16. Finally, synchronize the system files. xfs_growfs /dev/mapper/centos-root.

 17. Enter df -h again to view the results

Guess you like

Origin blog.csdn.net/Mogeko1/article/details/129201319