1753535 Members
7214 Online
108795 Solutions
New Discussion юеВ

questions about lvm

 
SOLVED
Go to solution

questions about lvm

I need more space in a file system.
I am trying to extend the size of a logical volume by adding a disk. (I am hoping this will add the space in the corresponding filesystem automatically - am i right?)
I get the following message when I attempt to do so using SAM.
"pvcreate: The physical volume "/dev/dsk/c0t1d0" is already recorded in the "/etc/lvmtab" file.
On the disk devices listing it shows the device as unused.

Please advise. I am new to HPUX.

thanks
11 REPLIES 11
Todd McDaniel_1
Honored Contributor
Solution

Re: questions about lvm

if you know the disk is not a part of a VG, you need to do

pvcreate -f /dev/dsk/cXtXdX

Then add it as normal.
Unix, the other white meat.
Todd McDaniel_1
Honored Contributor

Re: questions about lvm

One more thing... many times a disk that had been used in a VG and then later unused, still has its LVM header intact... you need to wipe that out to be able to use it on another VG/lvol.

do a:

pvdisplay -v /dev/dsk/cXtXdX


on the disk to make sure it is unused.
Unix, the other white meat.
Scott Palmer_1
Trusted Contributor

Re: questions about lvm

which file system are you trying to extend. Unless you have online jfs, you have to unmount the file system to extend it. if the physical volume is already there, you have to do an lvextend to get the physical disk in the logical volume group and then an extendfs to expand the file system.

Hope this helps a bit. It is not as robust as other types of unix.

regards

Scott Palmer
Sanjay_6
Honored Contributor
Jeff Schussele
Honored Contributor

Re: questions about lvm

Be very VERY careful here.
That message indicates the system thinks this drive is *already* listed as being in another VG.

strings out the file to see what VG it thinks it's in.

strings /etc/lvmtab

then vgdisplay -v the VG to verify.

vgdisplay -v /dev/vg_name

IF you pvcreate -f it you *will* destroy all data on it & that would not be a good thing if it actually is part of another VG.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: questions about lvm

I've found quite to my annoyance that pvcreate -f does NOT always clean out data structures on my drives.

Still, its supposed to so caution is warranted.

What you are probably going to need to do is vgreduce the disk out of the original volume group and then vgextend it into the new one.

If there are problems, you may need to do this:

vgexport -p -m /tmp/vg01.map vg01 #adjust for actual volume group name

then mv /etc/lvmtab /etc/lvmtab.backup

vgscan -a

vg01 probably won't be detected

vgimport -m /tmp/vg01.map vg01 /dev/dsk/c#t#d#

You may have to vary the steps based on where and how it bombs out.

A backup prior to beginning is essential.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com

Re: questions about lvm

Thanks for you input folks. This is what is happening.

************************************
DEVELOPMENT BOX
*************************************
10.60.61.74:0.0-visadr-root $ pvcreate -f /dev/rdsk/c0t10d0
pvcreate: The physical volume "/dev/dsk/c0t10d0" is already recorded in the "/etc/lvmtab" file.

10.60.61.74:0.0-visadr-root $ pvdisplay -v /dev/dsk/c0t10d0
pvdisplay: Warning: couldn't query physical volume "/dev/dsk/c0t10d0":
The specified path does not correspond to physical volume attached to
this volume group
pvdisplay: Warning: couldn't query all of the physical volumes.
pvdisplay: Couldn't retrieve the names of the physical volumes
belonging to volume group "/dev/sybasedg".
pvdisplay: Cannot display physical volume "/dev/dsk/c0t10d0".

10.60.61.74:0.0-visadr-root $ vgreduce /dev/sybdg /dev/dsk/c0t10d0
vgreduce: Physical volume "/dev/dsk/c0t10d0" does not belong
to volume group "/dev/sybdg".
********************************************
PRODUCTION BOX
********************************************
on another system i am trying to do a newfs on a device after succfully doing pvcreate -f and it wont let me.
10.60.61.74:0.0-ux01pwow-root $ pvcreate -f /dev/rdsk/c8t10d0
Physical volume "/dev/rdsk/c8t10d0" has been successfully created.
10.60.61.74:0.0-ux01pwow-root $ pvdisplay -v /dev/dsk/c8t10d0
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c8t10d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c8t10d0".
10.60.61.74:0.0-ux01pwow-root $ newfs /dev/rdsk/c8t10d0
newfs: /etc/default/fs is used for determining the file system type
mkfs (hfs): /dev/rdsk/c8t10d0 is a logical volume device.
10.60.61.74:0.0-ux01pwow-root $ pvdisplay -v /dev/dsk/c8t10d0
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c8t10d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c8t10d0".

****************************************************

The second one is the production system and I want to add that disk /dev/dskc8t10d0 to an existing filesystem. JFS not Installed.
So I will have to unmount the fileystem while i try to extend the size using SAM.

I am hoping I will not lose any information on the filesytem I am trying to extend. Please confirm.



thanks

--irfan



Juergen Tappe
Valued Contributor

Re: questions about lvm

Irfan,

there some fundamental commands missing in your last post.

Question: Which Logical Volume you want to extend? It has to be a name like :
/dev/vgXX/lvolY. In my example I assume it is /dev/vg01/lvol2 which is mounted to /xxx.
And you wnat to increase that to 4000 MB.

Here the commands I would use:

1. pvcreate /dev/rdsk/c8t10d0 # with or without -f as required
pvdisplay WILL now show an error because
the PV does not belong to a Volume Group yet!

2. vgextend /dev/vg01 /dev/dsk/c8t10d0
3. pvdisplay /dev/dsk/c8t10d0
This will work now.

4. lvextend -L <4000> /dev/vg01/lvol2 /dev/dsk/c8t10d0

5.
5a) if Online JFS is installed
fsadm -b $((4000*1024)) /xxx

or

5b) if Online JFS is NOT installed
stop any applications /processes using
it.
umount /xxx
extendfs -F vxfs /dev/vg01/rlvol2
mount /xxx
restart applications


PS: To be sure you a├В┬┤should make a backup of your filesystem before changing anything.
hope this helps.
Juerg
Working together

Re: questions about lvm

Still not able to resolve the issue on the development box.

pvcreate: The physical volume "/dev/dsk/c0t10d0" is already recorded in the "/etc/lvmtab" file.


thanks

--irfan