After installing Red Hat Enterprise Edition Linux5, how can I reduce the root partition? Solution: the default partition structure of the Red Hat Enterprise Edition Linux installer is: partition/boot partition and swap partition, and then allocate the remaining space to a logical volume, the logical volume is used as the root (/) partition. All data files and system files are stored in one system partition, which is not a good choice for the production system. If the system cannot be reinstalled, you can reduce the size of the root partition by reducing the logical volume of the root partition. Alert
After installing Red Hat Enterprise Linux 5, how does one reduce the root partition?
Solution:
The default partition structure of the Red Hat Enterprise Linux installer is: partition/boot and swap, and allocate the remaining space to a logical volume, and use the logical volume as the root (/) partition.
All data files and system files are stored in one system partition, which is not a good choice for the production system. If the system cannot be reinstalled, you can reduce the size of the root partition by reducing the logical volume of the root partition.
Warning LVM reduction may cause data loss. Therefore, data backup is required. Red Hat cannot help you recover a large amount of data.
The logical volume where the root partition is located must be scaled down in the rescue mode.
First, start the system from the first CD of Red Hat Enterprise Linux 5, enter linux rescue at the prompt, and press enter to confirm. Select the language and keyboard mode. Select "No" when the system prompts you to enable the network device ". Finally, select "Skip" when prompted to allow the rescue mode to mount the Red Hat Enterprise Linux system to/mnt/sysimage ". The file system must not be mounted. In this case, the necessary rescue mode is successfully entered.
Next, run the following command to scan all the physical volumes, Volume groups, and logical volumes on the hard disk:
# Lvm. static pvscan
# Lvm. static vgscan
# Lvm. static lvscan check that the rescue system detects the correct lvm structure on the hard disk.
Next, activate the logical volume in rescue mode. For example, run the following command to activate/dev/VolGroup00/LogVol00:
# Lvm. static lvchange-ay/dev/VolGroup00/LogVol00 the next step is to reduce the file system size and logical volume/dev/VolGroup00/LogVol00. Make sure that the root file system and the logical volume have enough space to store all the previous data. For example, if file system 99% is used, this method cannot be implemented or may cause irreparable data loss. Before changing the file system size, run the command e2fsck to check the file system:
# E2fsck-f/dev/VolGroup00/LogVol00
# Resize2fs/dev/VolGroup00/LogVol00 3000 M
# Lvm. static lvreduce-L 3000 M/dev/VolGroup00/LogVol00 note that this operation is for/dev/VolGroup00/LogVol00. Please note that this is done on/dev/VolGroup00/LogVol00. the number shown here (300 M) is the final size of the file system, rather than the size to be reduced.
Finally, verify that the modification takes effect and restart the system.
# Lvm. static vgdisplay VolGroup00
# Exit warning: reducing LVM may cause data loss. Therefore, data backup is required.