Fix the home and root partition size under CentOS for Linux system

Source: Internet
Author: User
Tags disk usage

goal: Reduce the volgroup-lv_home to 20G and add the remaining space to the Volgroup-lv_root 1. Check disk usage First[[email protected] ~]# df-h file systemcapacity has been used with available% mount pointsFilesystemSize used Avail use% mounted on/dev/mapper/volgroup-lv_root154G 7.9G 139G 6%/Tmpfs1.9G 100K 1.9G 1%/dev/shm/dev/sda1485M 69M 391M 15%/boot/dev/mapper/volgroup-lv_home299G 984M 283G 1% /Home 2. Uninstall/ Home[[email protected] ~]# Umount/homeumount/home If the prompt cannot be uninstalled, a process consumes/home, using the following command to terminate the process: [[email protected] ~]# fuser-m/Home 3. Adjust the partition size[Email protected] ~]# resize2fs-p/dev/mapper/volgroup-lv_home 20G If prompted to run "E2fsck-f/dev/mapper/volgroup-lv_home", Execute the relevant command: [[email protected] ~]# e2fsck-f/dev/mapper/volgroup-lv_home and then re-execute the command: [[email protected] ~]# resize2fs-p/dev/m Apper/volgroup-lv_home 20G Note: resize2fs to re-set the size of the disk, just re-specify the size, not affect the results, need the following lvreduce mates 4. Mount Home/home to view disk usage[Email protected] ~]# mount/home[[email protected] ~]# df-h 5. Set free spaceUse the Lvreduce directive to reduce the amount of space that LVM logical volumes occupy. The data already on the logical volume may be deleted, so you must confirm it before the operation. Remember to enter "Y" [[email protected] ~]# 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 reducing the size of the logical volume by using Lvreduce to reduce 20G from the current file system.  Note: The reduced size cannot be less than the size of the file, otherwise the data will be lost. You can use the Vgdisplay command to see what size you can manipulate. You can also use the FDISK-L command to view detailed information. [[email protected] ~]# Vgdisplay Note: vgdisplay to display metadata information for LVM volume groups 6. Hang the unused space in the root directory[[email protected] ~]# lvextend-l +283g/dev/mapper/volgroup-lv_root Note: lvextend-l +283g for adding 283g[[email protected on file systems] ~]# resize2fs-p/dev/mapper/volgroup-lv_root 7. Check the adjustment results[Email protected] ~]# df-h from: http://www.php114.net/2013/1019/637.html

Fix the home and root partition size under CentOS for Linux system

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.