parted partition and disk expansion (2)

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
insert image description here
Second, check the disk status fdisk -l

insert image description here
3. As you can see in the picture above, the sda ​​disk has a size of 10TB, and then partition and format it
insert image description here
insert image description here

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
insert image description here
This 1T sda disk is the object of our operation this time.

2. Next, start partitioning the dev/sda disk, fdisk /dev/sda
insert image description here
3. Continue the previous step (do not close it) and set the newly added disk to LVM mode
insert image description here
. 5. Save after confirming the partition

insert image description here
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

insert image description here
Expand the physical volume dev/sda1 to the centos volume group
insert image description here
2, and expand all the space to the home directory
insert image description here
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

insert image description here
Fourth, write to the file system to make the expansion take effect
insert image description here
xfs uses the following command to expand the disk space: xfs_growfs /dev/mapper/centos-home
insert image description here

5. Compare the difference before and after expansion.
Before
insert image description here
expansion After expansion
insert image description here

Later, if the disk is full, connect it to convert the format, and then you can directly write it in. It is not so troublesome to change the operating system. The premise is: you need to create the lvm volume in advance when you install the operating system for the first time. For specific operations, please See my last document! ! !

Guess you like

Origin blog.csdn.net/weixin_44200830/article/details/118493262