Linux Logical Volume management adjust partition size

Source: Internet
Author: User

Test machine Various error, create a directory are error, DF looked at a bit, found Volgroup-lv_root 100%, virtual Disk full, how to do it

1, resolution process

# df-h//View Partitions# Umount/home//un-mount# e2fsck-f/dev/mapper/volgroup-lv_home//Partition Detection# resize2fs-p/dev/mapper/volgroup-lv_home 100G//Set the Lv_home virtual partition to 100G# Mount/home//Mount Home# df-h//View Partitions# lvreduce-l 100g/dev/mapper/volgroup-lv_home//Free Space# Vgdisplay//To view the amount of free space# Lvextend-l +311.47g/dev/mapper/volgroup-lv_root//Extending the Lv_root virtual partition# resize2fs-p/dev/mapper/volgroup-lv_root//lv_root Resizing Partitions

LVM (Logical Disk Management) with high flexibility.

2, detailed resolution process

[Email protected] ~]# DF-hfilesystem Size used Avail use%mounted on/dev/mapper/volgroup-lv_root 50G 47G 16M -% ///Lv_root's full.Tmpfs1.9G 72K1.9G1%/dev/SHM/DEV/SDA1 485M 40M 420M9% /Boot/dev/mapper/volgroup-lv_home 406G 19G 366G5%/Home//Lv_home A lot of space[[Email protected]~]# resize2fs-p/dev/mapper/volgroup-lv_home 100gresize2fs1.41. A( --may- .) Filesystem at/dev/mapper/volgroup-lv_home isMounted On/home; on-Line resizing Requiredon-line shrinking from 107865088To65536000Not supported.//first umount to RESIZE2FS[[Email protected]~]# Umount/home//Umount Home Directory[[Email protected]~]# resize2fs-p/dev/mapper/volgroup-lv_home 100gresize2fs1.41. A( --may- .) Please run first'e2fsck-f/dev/mapper/volgroup-lv_home'.//prompt for disk detection first[[Email protected]~]# e2fsck-f/dev/mapper/volgroup-lv_homee2fsck1.41. A( --may- .First step: Check Inode, block, and size step two: Check the directory structure 3rd step: Check the directory connectivity pass4: Checking Reference counts 5th step: Check Cluster summary information/dev/mapper/volgroup-lv_home:1459/16384000Files (4.0% non-contiguous),5914204/65536000Blocks[[email protected]~]# resize2fs-p/dev/mapper/volgroup-lv_home 100G//Reset SizeResize2fs1.41. A( --may- .) Resizing the filesystem on/dev/mapper/volgroup-lv_home to26214400(4k) blocks. Begin Pass2(max =32768) relocating block Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbegin pass3(max = -) is scanning inode table xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxthe filesystem on/dev/mapper/volgroup-lv_home isNow26214400BlocksLong. [[Email protected]~]# mount/home/[[Email protected]~]# DF-hfilesystem Size used Avail use%mounted on/dev/mapper/volgroup-lv_root 50G 47G 16M -% /Tmpfs1.9G 72K1.9G1%/dev/SHM/DEV/SDA1 485M 40M 420M9% /Boot/dev/mapper/volgroup-lv_home 99G 19G 75G -% /Home[[email protected]~]# lvreduce-l 100g/dev/mapper/volgroup-lv_home//Free SpaceWarning:reducing Active and open logical volume to100.00GiB This May DESTROY YOUR DATA (filesystem etc) Really want to reduce lv_home? [y/N]: Y reducing Logical volume lv_home to100.00GiB Logical Volume lv_home successfully resized[[email protected]~]# DF-hfilesystem Size used Avail use%mounted on/dev/mapper/volgroup-lv_root 50G 47G 16M -% /Tmpfs1.9G 72K1.9G1%/dev/SHM/DEV/SDA1 485M 40M 420M9% /Boot/dev/mapper/volgroup-lv_home 99G 19G 75G -% /Home[[email protected]~]# Vgdisplay---Volume Group---VG Name VolGroup System ID Format lvm2 Metadata areas1Metadata Sequence No5VG Access Read/write VG Status resizable MAX LV0Cur LV3Open LV3Max PV0Cur PV1Act PV1VG Size465.27GiB PE Size4.00MiB Total PE119109Alloc PE/Size39372/153.80GiB Free PE/Size79737/311.47GiB//Free SpaceVG UUID vt2v4t-byxs-tqqk-cy0h-ide3-pabx-Lufkrs[[email protected]~]# Lvextend-l +311.47g/dev/mapper/volgroup-lv_root//free space added to Lv_rootRounding size to boundary between physical extents:311.47GiB Extending Logical Volume Lv_root to361.47GiB Logical Volume lv_root successfully resized[[email protected]~]# resize2fs-p/dev/mapper/volgroup-LV_ROOTRESIZE2FS1.41. A( --may- .) Filesystem at/dev/mapper/volgroup-lv_root ismounted on/; on-Line resizing requiredold desc_blocks=4, new_desc_blocks = at    //wait here, the more you expand, the longer it takes.Performing an on-line resize of/dev/mapper/volgroup-lv_root to94757888(4k) blocks. The FileSystem on/dev/mapper/volgroup-lv_root isNow94757888BlocksLong. [[email protected] openfire]# DF-hfilesystem Size used Avail use%mounted on/dev/mapper/volgroup-lv_root 356G 48G 308G -% /Tmpfs1.9G 72K1.9G1%/dev/SHM/DEV/SDA1 485M 40M 420M9% /Boot/dev/mapper/volgroup-lv_home 99G 19G 75G -%/Home

Reprint Please specify
Author: submarine Eagle
Address: http://blog.51yip.com/linux/1699.html

Linux Logical Volume management adjust partition size

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.