
The original partition /data of the Linux system has data. If you want to reinstall the system without formatting the /data partition
You need to prepare a virtual machine with a /data partition


Then load the ISO, start reinstalling and retain the /data partition, and load it directly to the partition interface
Online learning video tutorial Share: linux video tutorial
I learned from the beginning that the /data partition is 2048MB, so I directly chose to keep this partition

Then delete the other partitions , and then repartition

Then wait for the system to be reinstalled as usual. After the system is reinstalled, go in and check the /data partition file to still prove that it has been successful

Add a disk to the system and use LVM management to expand the existing volume group. Enter the system and view the partition df -h

You can see the two partitions using LVM when installing the system: /, /var, check the volume group name and volume group usage vgdisplay
View the current logical volume The space status is as shown below: 

Now I feel that 8G of /var is not enough. I want to expand it to 28G. Insert a new 20G hard disk; use 'fdisk -l'View

Format partition operation 'fsdisk /dev/sdb'

Put the newly added disk Set to LVM mode

Confirm partition

Create the newly added partition /dev/sdb1 as a physical volume

Expand the volume group centos. Expand the physical volume /dev/sdb1 to centos

At this time, centos has 20G free space. Expand all /dev/sdb1 to /var

At this time, although the 20G disk has been extended to /var, it has not been written to the file system. Enter /etc/fstab to confirm

Write to the file system to make the expansion effective

Recommended related articles and tutorials: linux tutorial
The above is the detailed content of How to reinstall linux system. For more information, please follow other related articles on the PHP Chinese website!