[SOLVED] How to delete a logical volume and resize existing one with the freed-up space in Oracle Linux 7.5?

Issue

There are two issues that are being addressed here. Let's address them one by one.

Issue 1 = How to delete a logical volume in Oracle Linux 7.5? 

Solution

Step 1. Find the logical volumes that exists in your installation:

[root@localhost oracle]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.2G 0 5.2G 0% /dev
tmpfs 5.2G 0 5.2G 0% /dev/shm
tmpfs 5.2G 9.5M 5.2G 1% /run
tmpfs 5.2G 0 5.2G 0% /sys/fs/cgroup
/dev/mapper/ol-root 50G 49G 1.5G 98% /
/dev/sda1 1014M 312M 703M 31% /boot
/dev/mapper/ol-home 294G 40M 294G 1% /home
tmpfs 1.1G 32K 1.1G 1% /run/user/1000
/dev/sr1 56M 56M 0 100% /run/media/kk/VBox_GAs_5.2.18
/dev/sr0 56M 56M 0 100% /run/media/kk/VBox_GAs_5.2.181
tmpfs 1.1G 0 1.1G 0% /run/user/0

Step 2. Identify the logical volume that you wish to delete and unmount it:

[root@localhost ~]# umount /home

Step 3. Now simply delete the logical volume:

[root@localhost ~]# lvremove /dev/mapper/ol-home
Do you really want to remove active logical volume ol/home? [y/n]: y
Logical volume "home" successfully removed
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.2G 0 5.2G 0% /dev
tmpfs 5.2G 0 5.2G 0% /dev/shm
tmpfs 5.2G 9.3M 5.2G 1% /run
tmpfs 5.2G 0 5.2G 0% /sys/fs/cgroup
/dev/mapper/ol-root 50G 49G 1.1G 98% /
/dev/sda1 1014M 312M 703M 31% /boot
tmpfs 1.1G 12K 1.1G 1% /run/user/42
tmpfs 1.1G 0 1.1G 0% /run/user/0

Step 4. Check whether the logical volume has been deleted.

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.2G 0 5.2G 0% /dev
tmpfs 5.2G 0 5.2G 0% /dev/shm
tmpfs 5.2G 9.3M 5.2G 1% /run
tmpfs 5.2G 0 5.2G 0% /sys/fs/cgroup
/dev/mapper/ol-root 50G 49G 1.1G 98% /
/dev/sda1 1014M 312M 703M 31% /boot
tmpfs 1.1G 12K 1.1G 1% /run/user/42
tmpfs 1.1G 0 1.1G 0% /run/user/0

Now that the logical volume is deleted, the next issue to work on is how to allocate the freed-up space to another logical volume?

Issue 2. How to allocate the freed-up space to another logical volume?

Step 5. ​Use the below mentioned command to allocate 100% freed-up space to another logical volume "/dev/mapper/ol-root"

[root@localhost ~]# lvextend -l +100%FREE -r /dev/mapper/ol-root
Size of logical volume ol/root changed from 50.00 GiB (12800 extents) to 343.68 GiB (87983 extents).
Logical volume ol/root successfully resized.
meta-data=/dev/mapper/ol-root isize=256 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 90094592

Environment

+ Oracle Linux 7.5 (x86-64)


Resize Oracle Linux 7.5 Logical Volume
[SOLVED] How to disable firewall in Oracle Linux 7...
[SOLVED] Installing gparted in Oracle Linux 7.5 us...