System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

decomissioning a volume group

SOLVED
Go to solution
khilari
Regular Advisor

decomissioning a volume group

hi guys, just wondering how do you decomission a volume group......... lets say if there are 100 + disks how do get them back,,rather than vgreduce if i do a vgexport on it will i get the disks back and then i have to reinitialize them....
Thanks
8 REPLIES
sujit kumar singh
Honored Contributor

Re: decomissioning a volume group

hi the best thing and the best approcah is using a vgexport with the -s option and -m option.

the -s option adds one entry called the VGID to the map file.

So that just as you will be vgimport -ing that VG using this Map File and -s option, the LVM will search all the possible disks in the system . will match that with the VGID in tha map file and shall import those PVs that match the VGID as mentioned in the map file.

alternatively you can also use vgexport with -f that shall create a list of the PVs and add that in the file which you can later on use with the map file and -f of the vgimport.



so u can do a Preview export first and then the real vgexport


do like this for say VG /dev/vgXX

#vgexport -p -v -s -m /tmp/vgXX.map /dev/vgXX
#vgexport -p -v -m /tmp/vgXX.map.alt -f /tmp/vgXX.pvlist /dev/vgXX

preserve all these files that is /tmp/vgXX.map ,/tmp/vgXX.map.alt and /tmp/vgXX.pvlist



do the real vgexport.



regards
sujit
sujit kumar singh
Honored Contributor

Re: decomissioning a volume group

Hi

please visit the man pages of the commands vgimport and vgexport for that

#man vgimport
#man vgexport

at later time say when you wish to import these VGs, like say that disks of the vgXX that you had exported had not created a new VG using pvcreate etc, then you can fully reimport them as folllws.


#mkdir /dev/vgXX
#mknod /dev/vgXX/group c 64 0xYY0000
make sure that thsii minor no 0xYY0000 is unique in the system.

#vgimport -v -s -m /tmp/vgXX.map /dev/vgXX

or

#vgimport -v -m /tmp/vgXX.map/alt -f /tmp/vgXX.pvlist


mark that these files had got created at the timeof the vgexport as done in my earlier post, /tmp/vgXX.map, /tmp/vgXX.map.alt and /tmp/vgXX.pvlist


Also note that the -s and -f option of the vgexport command are mutually exclusive.


regards
sujit
Ganesan R
Honored Contributor

Re: decomissioning a volume group

Hi,

If you want to decommission a volume group follow the steps.

1. Stop the app's / process using the filesystems.
2.Unmount all the lv's

3. Deactivate the vg -> vgchange

4. export the vg -> vgexport

Now the VG has gone. You can use those disks on any other server. But remember that the data and lvm structure is still there on the disks. You can import in any other server if you wise. when you run pvcreate with -f option the lvm headers will be overwritter.

You can also run pvremove command to remove the lvm structures once you exported.

Hope this helps.
Best wishes,

Ganesh.
sujit kumar singh
Honored Contributor

Re: decomissioning a volume group

Hello Sir,



please have a look at the following thread and assign the points.

You have a huge responses made to your questions as unassigned for points.

http://forums1.itrc.hp.com/service/forums/helptips.do?#33


assigning points always helps you get better responses.


Regards
sujit
Avinash20
Honored Contributor

Re: decomissioning a volume group

"100 + disks how do get them back,,rather than vgreduce if i do a vgexport on it will i get the disks back and then i have to reinitialize them...."

Yes you have to .. via pvcreate -f
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Avinash20
Honored Contributor

Re: decomissioning a volume group

vgexport will delete the vg from the server.
The disk will still have the data and the LVM

If you like to use it, you could do that.

If you like to use for some other vg's you need to reintilize each disk with pvcreate -f and use it.
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Armin Kunaschik
Esteemed Contributor
Solution

Re: decomissioning a volume group

The fastest way is "vgexport".

The "right" way to decommission a volume group goes like this:
- remove all logical volumes with "lvremove -f"
- remove every disk (except the last) with vgreduce
- vgremove the volume group
- rm -r /dev/
- pvremove every disk

Why to do it like this?
You remove any information that could confuse you or the OS in the future.
In SAN environments with lots of shared disks it's very important to not catch the wrong disk. If you're used to use "pvcreate -f" every time this will go wrong some time. But if you clean the disks after usage there is no "-f" necessary.

Beside that you prevent "funny" situations:
- a XP LUN (56GB) was assigned, and not properly cleaned up
- the same Cu:Ldev is assigned with different size (say 14GB) to another host.
- "pvcreate" (without -f) does not work because there is already a VGID on the disk
- not doing anything, the disks is 14GB in size, the PV is 56GB, is added with 56GB to the volume group and you get write errors if you try to use these 56GB.

So in short:
- remove every possible information from the disks when decommissioning volume groups
- do not rely on present information on the disk (but don't use "pvcreate -f" without thinking)

My 2 cents,
Armin

PS: Assign points if you find answers useful!
And now for something completely different...
Sani
Frequent Advisor

Re: decomissioning a volume group

Hi ,

I think you got the answer for your question.

No wonder..

I am having 255 disks(max pv) in volume group and i am doing vgexport/vgimport as daily operation.