1823369 Members
2743 Online
109654 Solutions
New Discussion юеВ

remove vg

 
brian_31
Super Advisor

remove vg

i have a volume group which i have to remove (vgtemp)(about 180G)and attach those disks to another vg (tsp). what would a clean way to do this. there are no volumes using the vgtemp VG.

Thanks

brian
7 REPLIES 7
Peter Godron
Honored Contributor

Re: remove vg

Brian,
using SAM :
delete the vg (vgtemp)
extend vg tsp by adding the now free disks

The warning that the disks have an existing filessytem can be ignored.
James R. Ferguson
Acclaimed Contributor

Re: remove vg

Hi Brian:

# vgchange -an /dev/vgtemp
# vgexport /dev/vgtemp

Regards!

...JRF...
Tim Nelson
Honored Contributor

Re: remove vg

Two ways:

if you have no need to save any data in this volume group then just remove the volume group.
first remove any disk devices from the group if there are more than 1:
vgreduce /dev/vgtemp /dev/dsk/cxtxdx /dev/dsk/cytydy
Then remove the volume group:
vgremove /dev/vgmisc

If you wish to keep the structure so you can import with new name or to another server then:
vgchange -a n /dev/vgtemp
vgexport -m /tmp/vgmisc.map /dev/vgtemp

you can then use the map file to import with new name or to another server.

DCE
Honored Contributor

Re: remove vg


Brian,

You have a couple of potential issues:

1. the default number of disks in a vg is 16. If you used this the default when you vcreated vg(tsp), then the additional disks you are adding to the vg will only will only work if the toal number of disks in the vg is 16 or less

2. Hopefully the disk are the same size (or smaller than the disks currently in vg(tsp). If not, there is the possibility that the vg might not be able to fully utilize the space on the disks, due PE size and max PE's set during vg creation........

brian_31
Super Advisor

Re: remove vg

ok . i will do this.. brfore removing i will do a vgdisplay -g vgtemp and capture all disks and then add those disks to the existing VG. thanks

brian
Roland Piette
Regular Advisor

Re: remove vg

Brian,

You also need to use pvcreate command with -f option on each freed disk before to do a vgxtend on another vg.

Roland
Ralph Grothe
Honored Contributor

Re: remove vg

The -f switch shouldn't be necessary if you pvremove-d the PVs from the former VG.
Here's what I usually do when I don't need to care for any data left on the disks
(let's assume we've got a current backup)


# vgdisplay -v vgXX|awk '/LV Name/{print$NF}'|xargs -n1 lvremove -f
Logical volume "/dev/vgXX/lvol1" has been successfully removed.
Volume Group configuration for /dev/vgXX has been saved in /etc/lvmconf/vgXX.conf
Logical volume "/dev/vgXX/lvol2" has been successfully removed.
Volume Group configuration for /dev/vgXX has been saved in /etc/lvmconf/vgXX.conf
Logical volume "/dev/vgXX/lvol3" has been successfully removed.
Volume Group configuration for /dev/vgXX has been saved in /etc/lvmconf/vgXX.conf
Logical volume "/dev/vgXX/lvol4" has been successfully removed.
Volume Group configuration for /dev/vgXX has been saved in /etc/lvmconf/vgXX.conf


# vgdisplay -v vgXX|awk '/PV Name/{print$NF}'|sed -n 2,\$p|while read pv;do vgreduce vgXX $pv && pvremove /dev/rdsk/${pv##*/};done
Volume group "vgXX" has been successfully reduced.
Volume Group configuration for /dev/vgXX has been saved in /etc/lvmconf/vgXX.conf
The physical volume associated with "/dev/rdsk/c2t0d0" has been removed.


# vgdisplay -v vgXX|awk '/PV Name/{print$NF}'
/dev/dsk/c1t0d0
# vgremove vgXX
Volume group "vgXX" has been successfully removed.
# pvremove /dev/rdsk/c1t0d0
The physical volume associated with "/dev/rdsk/c1t0d0" has been removed.
# rm -rf /dev/vgXX


Now there should be no doubt about any stale associations of PV memberships thanks to the explicit pvremove.
Thus I can newly create the used PVs without requiring the -f switch and an uneasy fealing of inadvertent data corruption due to a typo.

# pvcreate /dev/rdsk/c1t0d0
Physical volume "/dev/rdsk/c1t0d0" has been successfully created.
# echo $?
0


Admittedly, a bit more circuitous than a mere vgexport...
Madness, thy name is system administration