Scenario: Example remove Logical Volume that mount in /cache
System: CentOS/RHEL 6 or 7
Steps:
– Check partition df -h
– Unmount /cache partition.
– Check df -h again to make sure /cache already unmounted
– Check logical volume path that we will remove.
– Edit /etc/fstab and remove or comment the logical volume path that we will remove.
– Type vgs
to check Volume Group size before remove logical volume.
– Remove logical volume type command:
# lvremove /dev/vg_squid/lv_cache
– Type vgs
again to make sure free size should be increased.
Putty output:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_squid-lv_root
4.7G 2.3G 2.2G 52% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 477M 134M 318M 30% /boot
/dev/mapper/vg_squid-lv_cache
9.5G 22M 9.0G 1% /cache
/dev/mapper/vg_squid-lv_opt
4.7G 292M 4.2G 7% /opt
/dev/mapper/vg_squid-lv_var
9.5G 239M 8.8G 3% /var
[root@localhost ~]# umount /cache/
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_squid-lv_root
4.7G 2.3G 2.2G 52% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 477M 134M 318M 30% /boot
/dev/mapper/vg_squid-lv_opt
4.7G 292M 4.2G 7% /opt
/dev/mapper/vg_squid-lv_var
9.5G 239M 8.8G 3% /var
[root@localhost ~]# lvdisplay | grep Path
LV Path /dev/vg_squid/lv_var
LV Path /dev/vg_squid/lv_root
LV Path /dev/vg_squid/lv_cache
LV Path /dev/vg_squid/lv_swap
LV Path /dev/vg_squid/lv_opt
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_squid 1 5 0 wz--n- 39.51g 6.27g
[root@localhost ~]# vi /etc/fstab
[root@localhost ~]# lvremove /dev/vg_squid/lv_cache
Do you really want to remove active logical volume lv_cache? [y/n]: y
Logical volume "lv_cache" successfully removed
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_squid 1 4 0 wz--n- 39.51g 16.04g
[root@localhost ~]#