LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Destory or remove Logical Volumes and disk. (https://www.linuxquestions.org/questions/linux-server-73/destory-or-remove-logical-volumes-and-disk-4175436762/)

busi386 11-12-2012 08:22 AM

Destory or remove Logical Volumes and disk.
 
Hello All

I am a redhat newbie.

I manage to create a logical volume. I was also able to mount it.

Now how do I destroy or remove it?

I know enough to start with umount -f /APP1

but what do i do after that?
Push comes to shove, its just a virtual disk, so I could simply remove it from virtual box. but i want to get practice on how to properly remove PV and VG

[root@CENTOS /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.2G 3.9G 5.3G 43% /
tmpfs 709M 88K 709M 1% /dev/shm
/dev/sda1 640M 62M 546M 11% /boot
/dev/sda3 2.0G 212M 1.7G 12% /home
/dev/mapper/volume_group_1-APP1
2.0G 67M 1.9G 4% /APP1


[root@CENTOS /]# vgs
VG #PV #LV #SN Attr VSize VFree
volume_group_1 2 1 0 wz--n- 15.99g 13.99g
[root@CENTOS /]#

catkin 11-12-2012 08:38 AM

From the lvm man page ...

lvremove — Remove a logical volume

pvremove — Remove a physical volume.

vgremove — Remove a volume group.

busi386 11-12-2012 09:30 AM

If I may trouble you a bit more...

for some reason I am unable to remove the logical volume APP1.
I do know its there because it warns me that its about to be removed when I attempt to remove the volume group.
Any ideas? I am just trying to increase my understanding. If i really want to get rid of it, the vgremove would do the trick.


[root@CENTOS /]# vgs
VG #PV #LV #SN Attr VSize VFree
volume_group_1 2 1 0 wz--n- 15.99g 13.99g

[root@CENTOS /]# lvremove APP1
Volume group "APP1" not found
Skipping volume group APP1

[root@CENTOS /]# lvremove /APP1
"/APP1": Invalid path for Logical Volume

[root@CENTOS /]# vgremove volume_group_1
Do you really want to remove volume group "volume_group_1" containing 1 logical volu es? [y/n]: yes

Do you really want to remove active logical volume APP1? [y/n]: n
Logical volume APP1 not removed

[root@CENTOS /]# vgs
VG #PV #LV #SN Attr VSize VFree
volume_group_1 2 1 0 wz--n- 15.99g 13.99g

[root@CENTOS /]# lvremove APP1
Volume group "APP1" not found
Skipping volume group APP1

[root@CENTOS /]# lvremove APP1
Volume group "APP1" not found
Skipping volume group APP1

[root@CENTOS /]#

catkin 11-12-2012 11:26 AM

I don't have access to a system with LVM now so cannot test but believe the command is
Code:

lvremove /dev/<VG name>/<LV name>
If so, in your case it would be
Code:

lvremove /dev/volume_group_1/APP1

busi386 11-12-2012 11:43 AM

Thank you.


I have to play around with it a bit more. I did have some ZFS training fore solaris but I forgot it.
I figure that I can play around with LVM as there is not that much of a difference.


out of curiosity, I took a look at the disk management gui. Its soo easy to use.
Such a thing really did not exist in solaris.
As an administrator, which should I be using. My last job we used ssh for everything.

But RHEL is a different beast. I wonder should I just use the gui and make life easier on myself?
At the moment I am unemployed, but that wont be for long because there is a huge demand for unix folks.

What are redhat admins using?

*******************************************************
[root@CENTOS ~]# vgs
VG #PV #LV #SN Attr VSize VFree
volume_group_1 2 1 0 wz--n- 15.99g 13.99g

[root@CENTOS ~]# lvremove /volume_group_1/APP1
"/volume_group_1/APP1": Invalid path for Logical Volume

[root@CENTOS ~]# lvremove /dev/volume_group_1/APP1
Do you really want to remove active logical volume APP1? [y/n]: y
Logical volume "APP1" successfully removed

[root@CENTOS ~]# vgremove volume_group_1
Volume group "volume_group_1" successfully removed
[root@CENTOS ~]# vgs
No volume groups found

[root@CENTOS ~]#

catkin 11-12-2012 12:09 PM

I vaguely recall an LQ thread, maybe three years ago (dunno if it was RH), about a GUI for LVM management and people writing that it was not reliable so better to use the commands directly. Maybe the GUI tool has matured since then. But, if you are contemplating professional use, consider that a) many servers are "headless" and administered solely from the command prompt via ssh and b) GUI admin tools rarely have the full functionality of the underlying commands. Either way, experience of the commands is an asset.


All times are GMT -5. The time now is 06:09 PM.