Operating System - HP-UX
1756640 Members
2600 Online
108849 Solutions
New Discussion юеВ

Re: vgremove vs. vgreduce

 
Chris Fadrowski
Super Advisor

vgremove vs. vgreduce

In what circumstance should either one of these be used? and what is the difference. Should they be used together?

I want to eliminate a filesystem . It has a alternate path. Is this correct?

umount /j04a
lvremove /dev/vg**/lvol**
vgreduce /dev/vg**/c10t3d3 (alternate path)
vgreduce /dev/vg**/c12t3d3 (primary path)
vgremove /dev/vg**

7 REPLIES 7
harry d brown jr
Honored Contributor

Re: vgremove vs. vgreduce

That works for me, but make sure you get a good backup first?

live free or die
harry
Live Free or Die
Deshpande Prashant
Honored Contributor

Re: vgremove vs. vgreduce

Hi
Remove all but one physical volume belonging to VG by using vgreduce and then get rid of VG with last PV using vgremove.
If you want to keep the VG name,group file and add other disks, you may reduce all PVs using vgreduce and then continue to extend VG on new PVs.

Thanks.
Prashant.
Take it as it comes.
James R. Ferguson
Acclaimed Contributor

Re: vgremove vs. vgreduce

Hi Chris:

'vgremove' removes the *last* physical volume of a volume group and all knowledge of it.

'vgreduce' removes a physical volume, *but* leaves the volume group intact. 'vgreduce' cannot be used to remove the *last* physical volume, as this is done with 'vgremove'.

One common use of 'vgreduce' is to swap alternate (pv) links. If you 'vgreduce' the primary link, then the alternate link becomes the primary one. If you then use 'vgextend' to add back the original primary (physical volume) it becomes the new alternate link, completing the swap.

The snippet of shell you have posted will remove (destroy) the filesystem, logical volume(s) AND the volume group represented by "**" -- BUT PLEASE don't use wildcards for that!

Regards!

...JRF...
Sanjay_6
Honored Contributor

Re: vgremove vs. vgreduce

Hi Chris,

If you want to remove the VG completely, just unmount all the filesystems of that VG, remove all entries for that Vg in /etc/fstab and do a "vgexport /dev/vg_name" . This will remove all the info for that VG from the system and you don't have to do a vgreduce and vgremove.

vgreduce is to reduve a disk / disk path from the VG configuration, vgremove is to remove the VG completely. Do a man "vgremove" and "vgreduce" for more info.

Hope this helps.

Regds
A. Clay Stephenson
Acclaimed Contributor

Re: vgremove vs. vgreduce

vgreduce is more typically used to remove alternate paths and remove disks from a VG but leaving others in place. If you truly want to remove a volume group, the easiest method is to use vgexport /dev/vgxx. The remove all the disks from /etc/lvmtab and also remove the /dev/vgxx entries.
If it ain't broke, I can fix that.
Chris Fadrowski
Super Advisor

Re: vgremove vs. vgreduce

so then it would look like this;

umount /j04a
lvremove /dev/vg21/lvol121
vgreduce /dev/vg21/c13t1d1 (alternate link)
vgremove /dev/vg24

eliminate the vgreduce /dev/vg21/c9t2d2 (primary path) statment.
Sanjay_6
Honored Contributor

Re: vgremove vs. vgreduce

Hi Chris,

If you want to remove the VG completely with all LV's in it,

Do this,

umount /j04a
vgexport /dev/vg24

Here /j04a is the only filesystem on this VG and you want to remove the primary as well as the secondary path to the VG. Remember there is no recovery from this.

Hope this helps.

Regds