1835694 Members
2825 Online
110082 Solutions
New Discussion

pvcreate and used disks

 
SOLVED
Go to solution
Chris Fadrowski
Super Advisor

pvcreate and used disks

I am taking a Jamaica off one server and placing it on another. Question is, do i have to do lvreduce first on the logical volumes, then vgreduce on the volume group then a pvcreate -f ? or can i just do a pvcreate -f and skip. I don't want to connect this JBOD to the new server unless all LVM data is removed. Is there a safe way to do this?
5 REPLIES 5
Christopher McCray_1
Honored Contributor

Re: pvcreate and used disks

Hi,

The pvcreate -f will blow away everything on the disk. You should be safe.

Enjoy,
Chris
It wasn't me!!!!
Sandip Ghosh
Honored Contributor

Re: pvcreate and used disks

Its always better to do lvreduce and vgreduce on the existing server. After connecting to the new server just do pvcreate -f.

Sandip
Good Luck!!!
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: pvcreate and used disks

Hi Chris:

If you are truly removing this JBOD and your volume groups in question are all located on these disks, then your easist method is to simply do a vgexport /dev/vgxx for each volume group. You do this on your old box. This will clean up /etc/lvmtab and remove /dev/vgxx/*.

Man vgexport for details.

You can then do a pvcreate -f for each disk and start build your new volume groups.
If it ain't broke, I can fix that.
S.K. Chan
Honored Contributor

Re: pvcreate and used disks

Example to get rid of an existing VG so that you can physically move all the disks in that VG to another system.
1) umount all related FS
2) lvremove all related lvols
3) vgreduce till one disks is left
4) vgremove
Or you can also do vgexport (the fastest way)
Werner Worf
New Member

Re: pvcreate and used disks

Hi Chris,

if there is one or more complete volume groups on this Jamaica, the easiest way is probably just unmounting all the filesystems, do a 'vgchange -a n' on all the volume groups on that Jamaica and then remove the complete volume groups with vgexport.

Then on the new server do either a vgimport to import the old volume groups again (then you should also create a mapfile with the vgexport on the original server) or do 'pvcreate -f' to create new volume groups and logical volumes.

Regards,
Werner