Solve the Linux system CentOS adjust the home and root partition size "Compact full version" __linux

Source: Internet
Author: User
Tags compact disk usage
Source: http://www.php114.net/2013/1019/637.html

Objective: To reduce the volgroup-lv_home to 20G and add the remaining space to the Volgroup-lv_root
1. View disk usage First[root@localhost ~]# df-h File system capacity is used available% mount point filesystem size Used avail use% mounted ON/DEV/MAPPER/VO Lgroup-lv_root 154G 7.9G 139G 6%/tmpfs 1.9G 100K 1.9G 1%/dev/shm/dev/sda1 485M 6 9M 391M 15%/boot/dev/mapper/volgroup-lv_home 299G 984M 283G 1%/home 2. Uninstall/home[Root@localhost ~]# Umount/home Umount/home If you are prompted not to uninstall, there is a process consuming/home, using the following command to terminate the occupation process: [Root@localhost ~]# fuser-m,/home 3, adjust the size of the partition[Root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_home 20G If prompted to run "E2fsck-f/dev/mapper/volgroup-lv_home", Executes the related command: [root@localhost ~]# e2fsck-f/dev/mapper/volgroup-lv_home then executes the command again: [Root@localhost ~]#, Resize2fs-p,/dev/mappe R/volgroup-lv_home 20G Note: resize2fs for the reset disk size, just a new size, does not affect the results, you need the following lvreduce coordination 4, mount the/home, view the disk usage[Root@localhost ~]# mount/home [root@localhost ~]# df-h 5. Set free spaceUse the Lvreduce directive to reduce the amount of space occupied by LVM logical volumes. The data already on the logical volume may be deleted, so you must confirm it before you operate. 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 is to reduce the size of the logical volume using lvreduce by reducing 20G from the current file system.    Note: The reduced size cannot be smaller than the size of the file, otherwise the data will be lost. You can use the Vgdisplay command to view the size of the operation. You can also use the fdisk-l command to view details. [Root@localhost ~]# vgdisplay Note: Vgdisplay for metadata information showing LVM volume groups 6. Hang the idle space in the root directory[Root@localhost ~]# lvextend-l +283g/dev/mapper/volgroup-lv_root Note: lvextend-l +283g to add 283G to the file system [Root@localhost ~]# R Esize2fs-p/dev/mapper/volgroup-lv_root 7, check the adjustment results[Root@localhost ~]# Df-h
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.