Linux CENTOS6 adjust root mount partition capacity size (pro-Test available) __linux

Source: Internet
Author: User
Linux (CentOS 6) adjust mount partition size   Install CENTOS6 Use automatic recommendation zoning, found a problem/home partition is too large.   Goal:/home 20G, left add to/directory   1. View partition mode [root@localhost ~]# df-h file system   capacity used to mount points with% of%/dev/mapper/volgroup- Lv_root 50G 2.9G 44G 7%/tmpfs 5.9G 100K 5.9G 1%/dev/shm/dev/sda1 485M 37M 423M 8%/boot/dev/mapper/volgroup-lv_home 1 1T 200M 988G 1%/home   2. Uninstall mount Partition [Root@localhost ~]# umount/home   3. Check the error of the Volgroup-lv_home file,-f even if there are no indications of error in the file system, It is still mandatory to check correctness. [Root@localhost ~]# e2fsck-f/dev/mapper/volgroup-lv_home e2fsck 1.41.12 (17-may-2010) First step: Check Inode, block, and size step two: Check directory structure step 3rd : Check directory Connectivity pass 4:checking reference counts step 5th: Check cluster profile/dev/mapper/volgroup-lv_home:27/69304320 files (0.0% Non-contigu ous), 4400705/277215232 blocks   4. Adjust/home to 20G, [root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_home 20G re SIZE2FS 1.41.12 (17-may-2010) resizing filesystem on/dev/mapper/volgroup-lv_home to 5242880 (4k). Begin pass 2 (max = 32784) is relocating block xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin Pass 3 (max = 8460) is scanning the inode table xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin pass 4 (max = 15) is updating the inode reference xxxxxxxxxxxxx Xxxxxxxxxxxxxxxxxxxxxxxxxxx the filesystem on/dev/mapper/volgroup-lv_home is now 5242880 blocks long.   5. Re-mount and view [root@localhost ~]# mount/home [root@localhost ~]# df-h File system capacity has been used available with percent mount point/dev/mapper/volgroup-lv_ Root 50G 2.9G 44G 7%/tmpfs 5.9G 100K 5.9G 1%/dev/shm/dev/sda1 485M 37M 423M 8%/boot/dev/mapper/volgroup-lv_home 20G 172M 19G 1%/home     6. Divide the remaining space outside 20G. Use 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 warning:reducing Active and open logical volume To 20.00 GiB the May DESTROY YOUR DATA (filesystem etc.) Do your really want to reduce lv_home? [y/n]: Y reducing Logical volume Lv_home to 20.00 GiB-Logical Volume lv_home successfully resized [root@localhost ~]# DF- H file system capacity has been used available with%% mount point/dev/mapper/volgroup-lv_root 50G 2.9G 44G 7%/TMPFS 5.9G 100K 5.9G 1%/dev/shm/dev/sda1 485M 37M 423M 8%/boot/dev/mapper/volgroup-lv_home 20G 172M 19G 1%/home   7. View "Free P E/size "remaining space [root@localhost ~]# vgdisplay---Volume group---VG Name volgroup System ID Format lvm2 Metadata Areas 1 M Etadata Sequence No 5 vg Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 MAX PV 0 Cur PV 1 Act PV 1 VG S ize 1.09 TiB PE Size 4.00 MiB Total PE 285022 Alloc pe/size 19424/75.88 GiB free pe/size 265598/1.01 TiB VG UUID N Sbflh-j7fn-xdvf-zljl-tfcu-y5tm-ybndk0   8. Use the Lvextend directive: Extend the logical volume space to the/dev/mapper/volgroup-lv_root directory, which is the "/" directory.   [root@localhost ~]# lvextend-l +1.01t/dev/mapper/volgroup-lv_root rounding size to boundary between physical nts:1.01 extending logical Volume Lv_root to 1.06 TiB Logical Volume Lv_root successfully resized   9. Perform operations to make them effective, You must wait patiently in the middle. [Root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_root resize2fs 1.41.12 (17-may-2010) Filesystem at/dev/mapper/ Volgroup-lv_root is MounteD on/; On-line resizing required Old desc_blocks = 4, new_desc_blocks = performing a on-line resize V_root to 284227584 (4k) blocks. The filesystem on/dev/mapper/volgroup-lv_root is now 284227584 blocks long.   10. View partition success [root@localhost ~]# df-h file system capacity already used available% mount point/dev/mapper/volgroup-lv_root 1.1T 2.9G 1011G 1%/TMPFS 5.9G 100K 5.9G 1%/dev/shm/dev/sda1 485M 37M 423M 8%/boot/dev/mapper/volgroup-lv_home 20G 172M 19G 1%/home 11. Reboot [Root @localhost ~]# Shutdown-r Now

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.