When a huge capacity is allocated to the home directory and you want to combine it with the root volume!
[root@cmst301 ~]# lvdisplay -C
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_cmst301 -wi-ao---- 197.68g
lv_root vg_cmst301 -wi-ao---- 50.00g
lv_swap vg_cmst301 -wi-ao---- 7.83g
[root@cmst301 ~]# cp -rp /home /home_bk
/dev/mapper/vg_cmst301-lv_home /home ext4 defaults 1 2
current situation
[root@cmst301 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
50G 6.0G 41G 13% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 477M 78M 374M 18% /boot
/dev/mapper/vg_cmst301-lv_home
195G 416M 185G 1% /home
Unmount
[root@cmst301 ~]# umount /home
Verification
[root@cmst301 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
50G 5.0G 42G 11% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 477M 78M 374M 18% /boot
[root@cmst301 ~]# lvremove /dev/vg_cmst301/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume "lv_home" successfully removed
[root@cmst301 ~]# lvextend -L +200G /dev/mapper/vg_cmst301-lv_root
Size of logical volume vg_cmst301/lv_root changed from 247.49 GiB (63357 extents) to 247.59 GiB (63382 extents).
Logical volume lv_root successfully resized.
[root@cmst301 ~]# resize2fs /dev/mapper/vg_cmst301-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_cmst301-lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 16
Performing an on-line resize of /dev/mapper/vg_cmst301-lv_root to 64903168 (4k) blocks.
The filesystem on /dev/mapper/vg_cmst301-lv_root is now 64903168 blocks long.
[root@cmst301 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_cmst301-lv_root
244G 5.0G 227G 3% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 477M 78M 374M 18% /boot
Recommended Posts