Linux Logical Volume management tuning partition size Example

Source: Internet
Author: User

Test machine A variety of errors, create a directory are error, DF looked, found Volgroup-lv_root 100%, virtual Disk full, how to do?

1, the settlement process

# Df-h//view partitions
# Umount/home//Cancellation mount
# e2fsck-f/dev/mapper/volgroup-lv_home//Zoning detection
# resize2fs-p/dev/mapper/volgroup-lv_home 100G//Set 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//View free space size
# Lvextend-l +311.47g/dev/mapper/volgroup-lv_root//Extended Lv_root virtual partitions
# resize2fs-p/dev/mapper/volgroup-lv_root//lv_root Reset partition size

LVM (Logical Disk Management) with high flexibility.

2, the detailed resolution process

[Root@localhost ~]# Df-h
FileSystem Size Used Avail use% mounted on
/dev/mapper/volgroup-lv_root 50G 47G 16M 100%///lv_root full
Tmpfs 1.9G 72K 1.9G 1%/DEV/SHM
/DEV/SDA1 485M 40M 420M 9%/boot
/dev/mapper/volgroup-lv_home 406G 19G 366G 5%/home//lv_home lots of space

[Root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_home 100G
RESIZE2FS 1.41.12 (17-may-2010)
FileSystem at/dev/mapper/volgroup-lv_home is mounted on/home; On-line resizing required
On-line shrinking from 107865088 to 65536000 not supported. First Umount to RESIZE2FS.

[Root@localhost ~]# umount/home//umount Home Directory

[Root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_home 100G
RESIZE2FS 1.41.12 (17-may-2010)
Please run ' e2fsck-f/dev/mapper/volgroup-lv_home ' first. Prompt for disk detection first

[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 the directory structure

Step 3rd: Check directory Connectivity

Pass 4:checking Reference counts

5th step: Check the cluster summary information

/dev/mapper/volgroup-lv_home:1459/16384000 files (4.0% non-contiguous), 5914204/65536000 blocks

[Root@localhost ~]# resize2fs-p/dev/mapper/volgroup-lv_home 100G//Resize
RESIZE2FS 1.41.12 (17-may-2010)
Resizing the filesystem on/dev/mapper/volgroup-lv_home to 26214400 (4k) blocks.
Begin Pass 2 (max = 32768)
Relocating Block xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin Pass 3 (max = 2000)
Scanning Inode Table Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The filesystem on/dev/mapper/volgroup-lv_home is now 26214400 blocks long.

[Root@localhost ~]# mount/home/

[Root@localhost ~]# Df-h
FileSystem Size Used Avail use% mounted on
/dev/mapper/volgroup-lv_root 50G 47G 16M 100%/
Tmpfs 1.9G 72K 1.9G 1%/DEV/SHM
/DEV/SDA1 485M 40M 420M 9%/boot
/dev/mapper/volgroup-lv_home 99G 19G 75G 20%/home

[Root@localhost ~]# lvreduce-l 100g/dev/mapper/volgroup-lv_home//Free space
Warning:reducing Active and open Logical volume to 100.00 GiB
This May DESTROY YOUR DATA (filesystem etc.)
Do your really want to reduce lv_home? [y/n]: Y
Reducing logical Volume Lv_home to 100.00 GiB
Logical Volume Lv_home successfully resized

[Root@localhost ~]# Df-h
FileSystem Size Used Avail use% mounted on
/dev/mapper/volgroup-lv_root 50G 47G 16M 100%/
Tmpfs 1.9G 72K 1.9G 1%/DEV/SHM
/DEV/SDA1 485M 40M 420M 9%/boot
/dev/mapper/volgroup-lv_home 99G 19G 75G 20%/home

[Root@localhost ~]# 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 465.27 GiB
PE Size 4.00 MiB
Total PE 119109
Alloc pe/size 39372/153.80 GiB
Free pe/size 79737/311.47 GiB//Idle Space
VG UUID Vt2v4t-byxs-tqqk-cy0h-ide3-pabx-lufkrs

[Root@localhost ~]# lvextend-l +311.47g/dev/mapper/volgroup-lv_root//Free space added to Lv_root
Rounding size to boundary between physical extents:311.47 GiB
Extending logical Volume Lv_root to 361.47 GiB
Logical Volume Lv_root successfully resized

[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 = 23//Here be patient, enlarge, longer
Performing a on-line resize of/dev/mapper/volgroup-lv_root to 94757888 (4k) blocks.
The filesystem on/dev/mapper/volgroup-lv_root is now 94757888 blocks long.

[Root@localhost openfire]# Df-h
FileSystem Size Used Avail use% mounted on
/dev/mapper/volgroup-lv_root 356G 48G 308G 14%/
Tmpfs 1.9G 72K 1.9G 1%/DEV/SHM
/DEV/SDA1 485M 40M 420M 9%/boot
/dev/mapper/volgroup-lv_home 99G 19G 75G 20%/home

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.