Prerequisites:
Linux Root partition resizing requires the use of LVM for existing root partitions. If you select the default option when selecting partition settings during Linux installation, LVM is used for management. The command used to view the current root partition management mode is:
Fdisk-l
The system column of the corresponding hard disk is Linux LVM, that is, it is LVM management and can be resized.
Expansion steps:
1. First, add a new disk, start the system, and enter the system. Use root to log on, run fdisk, and partition the Newly Added Disk. We assume that all the disk capacity is divided into one partition and the partition is/dev/sdb1. Change the partition format to LVM format.
TIPS:
. After we make adjustments to the partition, We will prompt that the partition table will change after the system is restarted. In fact, we can use the partprobe command.
. Method for modifying the partition format: fdisk/dev/sdb1
Command (M for help): t change the partition type Partition Number (1-4): 3 select the second hex code (type L to list codes ): the 8e disk format is changed to Linux LVM and can be viewed using L.
2. view the physical volume (PV) in the system and run the pvdisplay command;
3. Create a new physical volume (PV): pvcreate/dev/sdb1;
4: Add a new physical volume to the volume group by using the virtual volume group (VG): vgextend volgroup00/dev/sdb1. The volume group name comes from step 2;
5: Run vgdisplay to view the expanded virtual volume group (VG). If the displayed capacity increases, the virtual volume group (VG) is successfully expanded;
6: add the new space to the logical volume: lvextend-L + n (m, or G)/dev/volgroup00/logvol00;
7: When DF-H is used, no new space is available. You need to activate the new space resize2fs-P/dev/volgroup00/logvol00;
8. Now we can see the expanded space. DF-LH.