Linux LVM logical volume management adjust partition size
Test Machine all kinds of errors, create a directory are reported error, df looked at it, found that VolGroup-lv_root 100%, the virtual disk is full, what should I do?
1. Solution Process
# Df-h // view partitions
# Umount/home // unmount
# E2fsck-f/dev/mapper/VolGroup-lv_home // partition 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 // release space
# Vgdisplay // view the available space size
# Lvextend-L + 311.47G/dev/mapper/VolGroup-lv_root // extended lv_root virtual Partition
# Resize2fs-p/dev/mapper/VolGroup-lv_root // lv_root reset partition size
LVM (Logical Disk management), high flexibility.
2. Detailed Solution Process
[Root @ localhost ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/mapper/VolGroup-lv_root 50G 47G 16 M 100% // lv_root full
Tmpfs 1.9G 72 K 1.9G 1%/dev/shm
/Dev/sda1 485 M 40 M 420 M 9%/boot
/Dev/mapper/VolGroup-lv_home 406G 19G 366G 5%/home // lv_home space lots
[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)
Run 'e2fsck-f/dev/mapper/VolGroup-lv_home 'first. // prompt to perform disk detection first
[Root @ localhost ~] # E2fsck-f/dev/mapper/VolGroup-lv_home
E2fsck 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 1: Check the cluster Summary
/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 // reset size
Resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on/dev/mapper/VolGroup-lv_home to 26214400 (4 k) blocks.
Begin pass 2 (max = 32768)
Re-positioning block XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 2000)
Scanning inode table xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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 16 M 100%/
Tmpfs 1.9G 72 K 1.9G 1%/dev/shm
/Dev/sda1 485 M 40 M 420 M 9%/boot
/Dev/mapper/VolGroup-lv_home 99G 19G 75G 20%/home
[Root @ localhost ~] # Lvreduce-L 100G/dev/mapper/VolGroup-lv_home // release space
WARNING: switching active and open logical volume to 100.00 GiB
This may destroy your data (filesystem etc .)
Do you really want to reduce lv_home? [Y/n]: y
Cing 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 16 M 100%/
Tmpfs 1.9G 72 K 1.9G 1%/dev/shm
/Dev/sda1 485 M 40 M 420 M 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 // Free space
Vg uuid Vt2V4t-Byxs-tQqk-cY0h-IDE3-pabX-LUfkRS
[Root @ localhost ~] # Lvextend-L + 311.47G/dev/mapper/VolGroup-lv_root // Add idle space 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 // wait patiently. The more you expand, the longer the time.
Ming an on-line resize of/dev/mapper/VolGroup-lv_root to 94757888 (4 k) 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 72 K 1.9G 1%/dev/shm
/Dev/sda1 485 M 40 M 420 M 9%/boot
/Dev/mapper/VolGroup-lv_home 99G 19G 75G 20%/home
- Use LVM to create elastic disk storage-Part 1
- Expanding/downgrading LVM in Linux (Part 2)
- Recording and restoring logical volume snapshots in LVM (part 3)
- Set a streamlined resource allocation volume in LVM (part 4)
- Use fragmented I/O to manage multiple LVM disks (Part 5)
This article permanently updates the link address: