Centos 6.5 64-bit, adjust the partition size

Source: Internet
Author: User
Tags disk usage
Adjust hard disk partition size

To increase the root space and reduce the home space.

1. View hard disk usage.
[[email protected] ~]# df -hFilesystem                    Size  Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root   48G   45G   17M 100% /tmpfs                         246M     0  246M   0% /dev/shm/dev/sda1                     485M   33M  427M   8% /boot/dev/mapper/VolGroup-lv_home   50G  180M   47G   1% /home
2. Adjust the size of the home Partition
[[Email protected] ~] # Umount/home [[email protected] ~] # E2fsck-F/dev/mapper/VolGroup-lv_homee2fsck 1.41.12 (17-may-2010) Step 1: Check inode, block, and size Step 2: Check the directory structure Step 2: check directory connectivity pass 4: Checking reference counts step 5th: Check cluster profile information/dev/mapper/VolGroup-lv_home: 11/3303104 files (0.0% non-contiguous ), 253351/13207552 blocks [[email protected] ~] # Resize2fs-P/dev/mapper/VolGroup-lv_home 2gresize2fs 1.41.12 (17-may-2010) resizing the filesystem on/dev/mapper/VolGroup-lv_home to 524288 (4 K) blocks. begin pass 2 (max = 32768) is repositioning the block too pass 3 (max = 404) is scanning inode table xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxthe filesystem on/dev/mapper/VolGroup-lv_home is now 524288 blocks long. [[email protected] ~] # Mount/home [[email protected] ~] # DF-hfilesystem size used avail use % mounted on/dev/mapper/VolGroup-lv_root 48G 45g 17 m 100%/tmpfs 246 M 0 246 m 0%/dev/SHM/dev/sda1 485 m 33 m 427 m 8%/boot/dev/mapper/VolGroup-lv_home 2.0g 152 M 1.8g 8%/home
3. Release Space
[[email protected] ~]# lvreduce -L 2G /dev/mapper/VolGroup-lv_home  WARNING: Reducing active and open logical volume to 2.00 GiB  THIS MAY DESTROY YOUR DATA (filesystem etc.)Do you really want to reduce lv_home? [y/n]: y  Reducing logical volume lv_home to 2.00 GiB  Logical volume lv_home successfully resized[[email protected] ~]# df -hFilesystem                    Size  Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root   48G   45G   16M 100% /tmpfs                         246M     0  246M   0% /dev/shm/dev/sda1                     485M   33M  427M   8% /boot/dev/mapper/VolGroup-lv_home  2.0G  152M  1.8G   8% /home[[email protected] ~]# vgdisplay  --- Volume group ---  VG Name               VolGroup  System ID  Format                lvm2  Metadata Areas        1  Metadata 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 Size               99.51 GiB  PE Size               4.00 MiB  Total PE              25474  Alloc PE / Size       13088 / 51.12 GiB  Free  PE / Size       12386 / 48.38 GiB  VG UUID               ILLwIo-pQ0o-2Ayw-fYcP-QhcW-A1id-Sozp1f
4. Add free space to root
[[email protected] ~]#  lvextend -L +48.38G /dev/mapper/VolGroup-lv_root  Rounding size to boundary between physical extents: 48.38 GiB  Extending logical volume lv_root to 96.54 GiB  Logical volume lv_root successfully resized[[email protected] ~]# resize2fs -p /dev/mapper/VolGroup-lv_rootresize2fs 1.41.12 (17-May-2010)Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing requiredold desc_blocks = 4, new_desc_blocks = 7Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 25307136 (4k) blocks.The filesystem on /dev/mapper/VolGroup-lv_root is now 25307136 blocks long.[[email protected] ~]# df -hFilesystem                    Size  Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root   96G   45G   46G  50% /tmpfs                         246M     0  246M   0% /dev/shm/dev/sda1                     485M   33M  427M   8% /boot/dev/mapper/VolGroup-lv_home  2.0G  152M  1.8G   8% /home
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.