Solve the linux system CentOS adjust home and root partition size

  
owncloud xxx /data /path modification, no web server write permissions, so the redundant home partition capacity is adjusted to the root folder, so, solve the relevant problem . The next question is to solve the problem of the external hard disk. Goal: Reduce VolGroup-lv_home to 20G and add the remaining space to VolGroup-lv_root 1. First check the disk usage [root@localhost ~]# df -h File system capacity is available Available % Mount point Filesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root 154G 7.9G 139G 6% /tmpfs 1.9G 100K 1.9G 1% /dev/shm/dev/sda1 485M 69M 391M 15% /boot/dev/mapper/VolGroup-lv_home 299G 984M 283G 1% /home 2. Uninstall /home[root@localhost ~]# umount /homeumount /home If the prompt fails to uninstall, there is a process occupying /home. Use the following command to terminate the occupied process: [root @localhost ~]# fuser -m /home 3, adjust the partition size [root@localhost ~]# resize2fs -p /dev/mapper/VolGroup-lv_home 20G If prompted to run "e2fsck -f /dev/mapper/VolGroup-lv_home&rdquo ;, execute the relevant command: [root@localhost ~]# e2fsck -f /dev/mapper/VolGroup-lv_home Then re-execute the command: [root@localhost ~]# resize2fs -p /dev/mapper/VolGroup-lv_home 20G Note :resize2fs to reset the disk size, just reassign The next size does not affect the result. You need the following lvreduce cooperation. 4. Mount the /home to check the disk usage [root@localhost ~]# mount /home[root@localhost ~]# df -h 5. Set the idle Space uses the lvreduce directive to reduce the amount of space occupied by LVM logical volumes. Data already on the logical volume may be deleted, so confirmation must be made before the operation. Remember to enter “y”[root@localhost ~]# lvreduce -L 20G /dev/mapper/VolGroup-lv_home Note: lvreduce -L 20G means to set the current file system to 20G, if lvreduce -l 20G refers to the current Reduce 20G on the file system Use lvreduce to reduce the size of the logical volume. Note: The reduced size cannot be smaller than the file size, otherwise data will be lost. You can use the vgdisplay command to check the size of the operation. You can also use the fdisk -l command to view the details. [root@localhost ~]# vgdisplay Note: vgdisplay is to display the metadata information of the LVM volume group. 6. Hang the idle space in the root directory [root@localhost ~]# lvextend -L +283G /dev/mapper/VolGroup- Lv_root Note: lvextend -L +283G adds 283G to the file system [root@localhost ~]# resize2fs -p /dev/mapper/VolGroup-lv_root 7. Check the adjustment result [root@localhost ~]# df -h
Copyright © Windows knowledge All Rights Reserved