Before:
LVM partition management is to pave the way for subsequent disk expansion. Now 2TB hard disks are very common. For hard disk partitions exceeding 2TB, you need to use the parted command to operate. fdisk can only operate within 2TB. This tutorial will teach you How to Easily Realize the Partitioning and Capacity Expansion of Disks Above 2T and Below 2T
First, first confirm whether there is a parted command, if not, install it with yum install -y parted
Second, check the disk status fdisk -l
3. As you can see in the picture above, the sda disk has a size of 10TB, and then partition and format it
The above is that the large disk has been divided into lvm format, and the format division within 2T is carried out below
The disk within 2T is divided into lvm format
First, first check the partition status of the hard disk. fdisk -l
This 1T sda disk is the object of our operation this time.
2. Next, start partitioning the dev/sda disk, fdisk /dev/sda
3. Continue the previous step (do not close it) and set the newly added disk to LVM mode
. 5. Save after confirming the partition
The above is all the operations of dividing the LVM format below 2T. Next, we will expand the disk capacity. The operation method is the same whether it is above 2T or below. Since the large-capacity disk has been mounted before, let’s expand the capacity of this 1T now.
1. Query the volume group name and expand to the volume group vgdisplay
Expand the physical volume dev/sda1 to the centos volume group
2, and expand all the space to the home directory
3. At this time, although the 1T disk space has been expanded to the home directory, it has not been written to the file system. Enter etc/fstab to confirm Check whether the home file system is ext4
Fourth, write to the file system to make the expansion take effect
xfs uses the following command to expand the disk space: xfs_growfs /dev/mapper/centos-home
5. Compare the difference before and after expansion.
Before
expansion After expansion