VMware virtual machine Linux system disk expansion
Many friends use
VMware
to create virtual machines, and often choose the default disk size of 20G.
After using it, they find that 20G is not enough, and the service starts No.
Let us solve it together today,VMware
virtual machineLinux
system disk expansion.
Check disk space
df -h
Focus on the selected logical volume name
The names of each system may not be the same
but they are all/dev/mapper
What follows the beginning is the name of the logical volume
step:
- Add new disk to virtual machine
- Create partitions for new disk
- Format the newly created partition
- Create a physical volume for the partition you just formatted
- Add the just created physical volume to the logical volume that needs to be expanded.
- Increase file system size
- Comparison before and after verification expansion
Add new disk to virtual machine
- Edit virtual machine settings
- Add to
- After selecting the disk, click Next
- Check the recommended disk type and click Next
- Check Create a new disk and click Next
- Set the maximum disk size, check Store disk as a single file, and click Next
- Complete the wizard
- Confirm virtual machine settings
- Virtual machine after adding new disk
View disk information
fdisk -l
Red box Chinese new disk
Create partition
Use
fdisk /dev/sdb
to create a partition and complete the following operations according to the wizard
First enter n to create a new partition
and then enter p primary Partition
Select the starting position of the partition and press Enter to use the default value
Select the end position of the partition and press Enter to use the default value
Then enter wq to save and exit
This creates a partition with a size of 200G
fdisk /dev/sdb
Format the newly created partition
mkfs is make filesystem to create a file system
Common Linux file systems are xfs and ext4
This case uses the xfs file system
mkfs.xfs -f /dev/sdb1
ext4 and XFS are two common file systems in Linux operating systems. They are both modern, high-performance file systems, each with their own pros and cons. Here's how they compare:
Performance: XFS performs better than ext4 when handling large files and directories. ext4 performs better when processing small files and directories. In addition, XFS has better concurrent access performance and higher throughput.
Reliability: ext4 recovers faster than XFS after a file system crash, but XFS has better data protection capabilities. XFS has better metadata checksum recovery capabilities, allowing fast recovery even if the file system is damaged.
Scalability: XFS performs better in terms of scalability as it supports large storage and large files. At the same time, XFS supports online file system expansion, which can expand the file system without interrupting service. ext4 can also be extended online, but it is not as flexible as XFS.
Compatibility: ext4 is the default file system of Linux and has good compatibility with various Linux distributions and tools. It also supports other operating systems such as Windows and MacOSX. XFS has poor compatibility between Linux distributions, but is well compatible with other operating systems.
Function: ext4 supports functions such as encryption and snapshots, while XFS does not support encryption and snapshots. However, XFS supports advanced features such as file system management, space quotas, permission control, and file attributes, which are not so powerful in ext4.
Generally speaking, XFS is more suitable for large enterprise environments and large-capacity data storage, while ext4 is suitable for small and medium-sized enterprises and home users. Which file system to choose should be determined based on specific application scenarios and needs.
Create physical volumes for partitions
Use
pvcreate /dev/sdb1
to create a physical volume
Prompt for warning inputy
Enter
pvcreate /dev/sdb1
View physical volume properties
pvdisplay
Add a physical volume to a logical volume
Add the physical volume /dev/sdb1 to the logical volume centos_lihaozhe
vgextend centos_lihaozhe /dev/sdb1
Increase file system size
xfs_growfs /dev/mapper/centos_lihaozhe-root
Comparison before and after verification expansion
df -h
Before expansion
After expansion
pvdisplay
Before expansion
After expansion