You can use lvremove command to remove a logical volume.
On server, we have volume group with 2 logical volumes.
root@server2:~# lvdisplay --- Logical volume --- LV Path /dev/pve/data LV Name data VG Name pve LV UUID nE67m1-2onL-R7AO-48m3-nU8j-pXWd-3QNj5Q LV Write Access read/write LV Creation host, time server2.hostonnet.com, 2015-12-12 16:18:13 -0500 LV Status available # open 1 LV Size 93.65 GiB Current LE 23975 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0 --- Logical volume --- LV Path /dev/pve/vm LV Name vm VG Name pve LV UUID Wtcyaq-xzvT-TXtj-Iuk2-2dWP-9o0P-Wbb4Zv LV Write Access read/write LV Creation host, time server2.hostonnet.com, 2015-12-12 16:18:13 -0500 LV Status available # open 1 LV Size 1.70 TiB Current LE 445906 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:1 root@server2:~#
I want to remove Logical Volume /dev/pve/vm.
To do this, we need to umount the logical volume.
root@server2:~# df Filesystem 1K-blocks Used Available Use% Mounted on udev 10240 0 10240 0% /dev tmpfs 13173672 9288 13164384 1% /run /dev/md2 20186312 1708296 17454072 9% / tmpfs 32934180 24960 32909220 1% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 32934180 0 32934180 0% /sys/fs/cgroup /dev/mapper/pve-vm 1825539164 32928 1825506236 1% /vm /dev/mapper/pve-data 97296108 61268 92324760 1% /var/lib/vz tmpfs 100 0 100 0% /run/lxcfs/controllers cgmfs 100 0 100 0% /run/cgmanager/fs /dev/fuse 30720 12 30708 1% /etc/pve root@server2:~#
We found, the logical volume /dev/pve/vm mounted as /vm
/dev/mapper/pve-vm 1825539164 32928 1825506236 1% /vm
Lets umount it.
root@server2:~# umount /dev/mapper/pve-vm root@server2:~# df -h Filesystem Size Used Avail Use% Mounted on udev 10M 0 10M 0% /dev tmpfs 13G 9.1M 13G 1% /run /dev/md2 20G 1.7G 17G 9% / tmpfs 32G 25M 32G 1% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 32G 0 32G 0% /sys/fs/cgroup /dev/mapper/pve-data 93G 60M 89G 1% /var/lib/vz tmpfs 100K 0 100K 0% /run/lxcfs/controllers cgmfs 100K 0 100K 0% /run/cgmanager/fs /dev/fuse 30M 12K 30M 1% /etc/pve root@server2:~#
We run df -h after umount to verify the logial volume is unmounted.
Now, we can remove the logical volume with lvremove command.
root@server2:~# lvremove /dev/pve/vm Do you really want to remove active logical volume vm? [y/n]: y Logical volume "vm" successfully removed root@server2:~#
Lets verify it is gone by running lvdisplay command.
root@server2:~# lvdisplay --- Logical volume --- LV Path /dev/pve/data LV Name data VG Name pve LV UUID nE67m1-2onL-R7AO-48m3-nU8j-pXWd-3QNj5Q LV Write Access read/write LV Creation host, time server2.hostonnet.com, 2015-12-12 16:18:13 -0500 LV Status available # open 1 LV Size 93.65 GiB Current LE 23975 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0 root@server2:~#
Now we only have one logical volume.
If you check the volume group with vgdisplay, you will see disk space used by the logical volume is FREE now.
root@server2:~# vgdisplay --- Volume group --- VG Name pve System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 1.80 TiB PE Size 4.00 MiB Total PE 470906 Alloc PE / Size 23975 / 93.65 GiB Free PE / Size 446931 / 1.70 TiB VG UUID mGJc2S-HWVj-kj5q-Dau6-h7XZ-X4sR-Afkgod root@server2:~#
Free PE / Size 446931 / 1.70 TiB