Operating System - HP-UX
1834299 Members
2080 Online
110066 Solutions
New Discussion

Need to move a physical volume to a volume group

 
SOLVED
Go to solution
Steven Gray
New Member

Need to move a physical volume to a volume group

I have a physical volume(/dev/dsk/c0t8d0)with nothing on it. I created it with the pvcreate command, then put a volume group and a logical volume on it, then put a filesystem on it. But now I want to put this volume group into my vg00 volume group which is running out of space. I did a "vgextend /dev/vg00 /dev/dsk/c0t8d0", but I get a message saying "The physical volume "/dev/dsk/c0t8d0" is already recorded in the /etc/lvmtab file.
I am under the impression that I can move a physical volume into a volume group even if that disk does have data on it. Am I doing something wrong? or does the disk have to be clean of data. All I am trying to do is to increase the vg00 volume group by moving my other drive into it. I want to keep the data on that drive.
Thank you
13 REPLIES 13
Stefan Farrelly
Honored Contributor

Re: Need to move a physical volume to a volume group

you can only pvmove a disk within the SAME VG. As yours are not in the same VG you must vgexport it from the VG its in, then vgextend vg00 to add it in there, then you can pvmove some stuff in vg00 to the new pv.
Im from Palmerston North, New Zealand, but somehow ended up in London...
harry d brown jr
Honored Contributor

Re: Need to move a physical volume to a volume group


You could:

backup your filesystem
remove the LV
remove the new VG that is on the disk
then pvcreate it again
then vgextend vg00 with the new disk
create your LV
restore your filesystem to the new LV

live free or die
harry
Live Free or Die
S.K. Chan
Honored Contributor
Solution

Re: Need to move a physical volume to a volume group

It seems the LVM definition for c0t8d0 is still known to the system, that is why you cannot re-use it on vg00. Assuming c0t8d0 is used to create vg08 and has no data on it, what you can do is ..
# vgchange -a n /dev/vg08
==> Deactivate vg08.
# vgexport /dev/vg08
==> Export vg08, this is a quick way to remove vg08 from the OS.
# strings /etc/lvmtab
==> Double check and you should not see vg08 anymore.

Now to re-use that disk on vg00 ..
# pvcreate -f /dev/rdsk/c0t8d0
==> Force it with "-f".
# vgextend /dev/vg00 /dev/dsk/c0t8d0
...
continue with the rest of the steps ..
Steve Steel
Honored Contributor

Re: Need to move a physical volume to a volume group

Hi


You need to remove the physical volume from the already created volume group before adding it to another.

vgextend - extend an LVM volume group by adding physical volumes

They must not already be in another vg.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
S.K. Chan
Honored Contributor

Re: Need to move a physical volume to a volume group

I'm sorry .. I thought .. "c0t8d0 with nothing on it" .. meaning it's ok to blow it away. The answer is you can't, you would have to backup the data and restore it back once you got c0t8d0 included in vg00. Use the same steps as given but backup your data first.
A. Clay Stephenson
Acclaimed Contributor

Re: Need to move a physical volume to a volume group

You have to play by the rules. First you need to do an lvremove to remove the LVOL and then a vgreduce to remove this PV from the old VG. You can then use vgextend to add this disk to another VG.
If it ain't broke, I can fix that.
John Poff
Honored Contributor

Re: Need to move a physical volume to a volume group

Hi,

You might be thinking of the 'pvmove' command. It will move PEs from one disk to another, but the disks have to be in the same volume group. You'll have to follow these other suggestions to be able to use this disk in your vg00.

JP
James R. Ferguson
Acclaimed Contributor

Re: Need to move a physical volume to a volume group

Hi Steven:

If you want to add /dev/dsk/c0t8d0 to vg00, you will first need to eliminate it as a member of its current volume group. If, too, there is a logical volume with a filesystem on it that you want to preseve, you are going to have to back that data up and restore it. If you don't want to maintain the data currently present, you don't have to do anything special.

If /dev/dsk/c0t8d0 is the *only* disk comprising the volume group (call it vgXX), then do:

# vgexport /dev/vgxx
# pvcreate -f /dev/dsk/c0t8d0
# vgextend vg00 /dev/dsk/c0t8d0

If /dev/dsk/c0t8d0 is only one member of more than one disk comprising the volume group, do:

# lvremove /dev/vgXX/lvolX #...for every logical volume on /dev/dsk/c0t8d0
# vgreduce vgXX /dev/dsk/c0t8d0
# pvcreate -f /dev/dsk/c0t8d0
# vgextend vg00 /dev/dsk/c0t8d0

In either case, if there is data you want to save, backup that data beforehand and restore it afterwards. Remember to update your 'etc/fstab' apppropriately.

Regards!

...JRF...
Steven Gray
New Member

Re: Need to move a physical volume to a volume group

I am attempting to deactivate the volume group /dev/vgsteve which is on /dev/dsk/c0t8d0, but when I run vgchange -a n /dev/vgsteve I get the error message " Couldn't deactivate volume group "/dev/vgsteve": Device busy

Sorry for the trouble
S.K. Chan
Honored Contributor

Re: Need to move a physical volume to a volume group

Do you still have the logical volume in vgsteve mounted as filesystem ? If yes you've got to umount it first before you can deactivate a VG.
James R. Ferguson
Acclaimed Contributor

Re: Need to move a physical volume to a volume group

Hi Steven:

Before you can run 'vgchange -a n vgXX' you must unmount all filesystems on logical volumes of the volume group.

Make sure, too, that you are not CD'ed into a mountpoint. You won't be able to unmount it.

You can use 'fuser' to display users of a mountpoint that is giving you trouble and/or use 'fuser' to kill processes holding files open on a mountpoint.

Regards!

...JRF...
Sanjay_6
Honored Contributor

Re: Need to move a physical volume to a volume group

Hi Steven,

A PV will belong to only one VG. So if you have already created a vg on the disk and you now want to move the pv to another vg, you have to remove the current vg on the disk and then extend the other vg to this disk. Doing this will erase all data on the pv. so take a backup of the data on the disk, remove the lv and the vg and then extend vg00 to include this pv and recreate lv and restore data. There is no other way.

Hope this helps.

Regds
Aren M. Parisi
Occasional Advisor

Re: Need to move a physical volume to a volume group

Don't forget the PE number limitation is set in vg00 (MAX PE PER PV), if you have a 4GB limit, and your vg08 disk is 9GB you will only be able to use 4GB of it!