Centos system extended VolGroup-lv_root partition
The following operations are completed through actual operations.
The following example shows how to allocate 5g of the home space to the root space.
[Root @ localhost ~] # Df-h
File system capacity in use available % mount point
/Dev/mapper/VolGroup-lv_root
75 GB 50G 22G 70%/
Tmpfs 3.9G 88 K 3.9G 1%/dev/shm
/Dev/sda1 485 M 30 M 430 M 7%/boot
/Dev/mapper/VolGroup-lv_home
20G 174 M 19G 1%/home
[Root @ localhost ~] # Umount/home
[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: 158/1310720 files (0.0% non-contiguous), 126581/5242880 blocks
[Root @ localhost ~] # Resize2fs-p/dev/mapper/VolGroup-lv_home 15G
Resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on/dev/mapper/VolGroup-lv_home to 3932160 (4 k) blocks.
Begin pass 3 (max = 160)
Scanning inode table xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The filesystem on/dev/mapper/VolGroup-lv_home is now 3932160 blocks long.
[Root @ localhost ~] # Mount/home
[Root @ localhost ~] # Df-h
File system capacity in use available % mount point
/Dev/mapper/VolGroup-lv_root
75 GB 50G 22G 70%/
Tmpfs 3.9G 88 K 3.9G 1%/dev/shm
/Dev/sda1 485 M 30 M 430 M 7%/boot
/Dev/mapper/VolGroup-lv_home
15G 170 M 14G 2%/home
[Root @ localhost ~] # Lvreduce-L 15G/dev/mapper/VolGroup-lv_home
WARNING: switching active and open logical volume to 15.00 GiB
This may destroy your data (filesystem etc .)
Do you really want to reduce lv_home? [Y/n]: y
Cing Cing logical volume lv_home to 15.00 GiB
Logical volume lv_home successfully resized
[Root @ localhost ~] # Vgdisplay
--- Volume group ---
VGName VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 3
Open LV 3
MaxPV 0
CurPV 1
ActPV 1
VGSize 99.51 GiB
PESize 4.00 MiB
Total PE 25474
Alloc PE/Size 24194/94 .51 GiB
Free PE/Size 1280/5 .00 GiB
CxzV5u-cG1f-HvPd-pE8c-eKrR-dBjN-H07k3I VGUUID
[Root @ localhost ~] # Lvextend-L + 5.00G/dev/mapper/VolGroup-lv_root
Extending logical volume lv_root to 80.57 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_rootis mounted on/; on-line resizing required
Old desc_blocks = 5, new_desc_blocks = 6
Ming an on-line resize of/dev/mapper/VolGroup-lv_root to 21121024 (4 k) blocks.
The filesystem on/dev/mapper/VolGroup-lv_root is now 21121024 blocks long.
[Root @ localhost ~] # Df-h
File system capacity in use available % mount point
/Dev/mapper/VolGroup-lv_root
80G 50G 27G 66%/
Tmpfs 3.9G 88 K 3.9G 1%/dev/shm
/Dev/sda1 485 M 30 M 430 M 7%/boot
/Dev/mapper/VolGroup-lv_home
15G 170 M 14G 2%/home