Resize LVM space and merge /home partition back to / Print

  • 25

# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_static2062266459-lv_root
50G 47G 150M 100% /
# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_static2062266459-lv_home
56G 154M 53G 1% /home
# cd /var/yum/cache
# rm -rf *
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_static2062266459-lv_root
50G 47G 176M 100% /
# cd /var/log
# gzip *-2016*
#df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_static2062266459-lv_root
50G 47G 284M 100% /
# rsync -av /home/ /home2
sending incremental file list
created directory /home2
./
kvm/
lost+found/
solusvm/
solusvm/kvm/
solusvm/kvm/iso -> /home/solusvm/xen/iso
solusvm/kvm/template/
solusvm/xen/
solusvm/xen/hvmtemplate/
solusvm/xen/iso/
solusvm/xen/template/
solusvm/xen/template/centos-5.3-x86.tar.gz

sent 106864737 bytes received 73 bytes 42745924.00 bytes/sec
total size is 106851324 speedup is 1.00
# ls -lash /|grep home
4.0K drwxr-xr-x. 5 root root 4.0K Aug 20 06:30 home
4.0K drwxr-xr-x 5 root root 4.0K Aug 20 06:30 home2
# umount /home
# nano -w /etc/fstab <----commented out /home entry
# lvremove /dev/vg_static2062266459/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume "lv_home" successfully removed

# vgdisplay    <--- to show amount of space to extend by

# lvextend -L+56.95G /dev/mapper/vg_static2062266459-lv_root
Rounding size to boundary between physical extents: 56.95 GiB
Size of logical volume vg_static2062266459/lv_root changed from 50.00 GiB (12800 extents) to 106.95 GiB (27380 extents).
Logical volume lv_root successfully resized
# resize2fs /dev/mapper/vg_static2062266459-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_static2062266459-lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 7
Performing an on-line resize of /dev/mapper/vg_static2062266459-lv_root to 28037120 (4k) blocks.
The filesystem on /dev/mapper/vg_static2062266459-lv_root is now 28037120 blocks long.
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_static2062266459-lv_root
106G 47G 54G 47% /
# gunzip /var/log/*-2016* <---this was done to free space since you have logrotate set to not gzip logs when rotated. if you set them to be gzipped it would then be able to manage the .gz files but since you have space now it should be fine as it is.

Was this answer helpful?

« Back

["\r\n