1833038 Members
2410 Online
110049 Solutions
New Discussion

Re: VG Question

 
SOLVED
Go to solution
Diadina Cotte
Advisor

VG Question

Hi
I was trying to create a new physical c0t0d2 and logical volume and I got this error msg.

#pvcreate /dev/rdsk/c0t0d2
pvcreate: The physical volume already belongs to volume group.

How do I check what vg's are mounted on c0t0d2?

thanks!
Coffee please ;-)
37 REPLIES 37
Jeff Schussele
Honored Contributor

Re: VG Question

Hi Diadina,

Try
pvdisplay -v /dev/dsk/c0t0d2

Also check the
/etc/lvmtab
file to see if it's allocated to any VGs on *this* system.

Note: On shared arrays this drive may be in a VG on ANOTHER system. So you need to check *all* systems connected to the array.

If there are actually NO systems currently using it - use
pvcreate -f /dev/rdsk/c0t0d2
To force the initialization.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
harry d brown jr
Honored Contributor

Re: VG Question

pvdisplay -v /dev/dsk/c0t0d2 | more

Note the use of the block device "dsk" and not "rdsk".

live free or die
harry
Live Free or Die
MANOJ SRIVASTAVA
Honored Contributor

Re: VG Question

Hi Diadina Cotte

Do a strings on /etc/lvmtab | more to know where does this disk belong to .Inc ase you are sure that this disk is a new disk ( ioscan and diskinfo) and doesnt belong to any vg then you can just rename lvmtab to lvmtab.old and recreate the lvmtabb using vgscan -a . The again do a strigns on the lvmtab.

In case you dont find it there then just do a pvcreate -f /dev/rdsk/c0t0d2 ( force option)
vgcreate /dev/vgxx /dev/dsk/c0t0d2

and you are good to get going.


All the best.


Manoj Srivastava
Patrick Wallek
Honored Contributor

Re: VG Question

You can see if c0t0d2 belongs to a VG by doing a

# strings /etc/lvmtab | grep c0t0d2

If you get results, then that disk already belongs to a VG. Too see all VGs and their disks do a

# strings /etc/lvmtab > /tmp/lvmtab.temp

# cat /tmp/lvmtab.temp

If c0t0d2 does not belong to any VGs, just put the '-f' option on your pvcreate command.

# pvcreate -f /dev/dsk/c0t0d2

This will force the pvcreate on that device.

You will get that error if that device was EVER a part of a VG.
S.K. Chan
Honored Contributor

Re: VG Question

To find out if c0t0d2 is configured in any of your existing VGs you can do ..
# strings /etc/lvmtab
OR
# vgdisplay -v |grep dsk
If you don't see c0t0d2 in the above 2 cases it's more likely that the disk was previously used in a VG. To reuse it do ..
# pvcreate -f /dev/rdsk/c0t0d2
Be very sure before you run pvcreate with -f option.
Dave Chamberlin
Trusted Contributor

Re: VG Question

Hi,
Use SAM. Choose "Disks and File systems", then "Disk Devices". This will take several seconds, but will list each disk in your system and show which volume group each is in, as well as other useful info.
PIYUSH D. PATEL
Honored Contributor

Re: VG Question

Hi,

pvdisplay -v /dev/dsk/c0t0d2 |more

Check in the /etc/lvmtab file also whether the disk is present or not.
#strings /etc/lvmtab

If it is not present then you can forcefully create the vg by using.

pvcreate -f /dev/rdsk/c0t0d2

Piyush
Bill McNAMARA_1
Honored Contributor

Re: VG Question

recall too that you can have a disk in use that is not managed by lvm..

Check your /etc/fstab for all filesystem locations/ logical configurations.

As mentioned pvcreate -f will blowaway the disk LVM headers..
make sure you're selecting the right disk by blinking it's leds:

dd if=/dev/dsk/c0t0d2 of=/dev/null

Later,
Bill
It works for me (tm)
James R. Ferguson
Acclaimed Contributor

Re: VG Question

Hi:

There is a LVM header on the disk you are attempting to 'pvcreate'.

You can attempt to match the device to one present in /etc/lvmtab.

Do 'strings /etc/lvmtab'. If your disk does *not* appear there, then either you have attached a disk from another system or you have 'lvreduce'ed filesystems that were on the disk (as it belonged to a volume group) and 'vgreduce'd the disk (as it belonged to a volume group.

If you are truly sure that you want to 'pvcreate' this disk, do:

# pvcreate -f /dev/rdsk/cXtYdZ

Regards!

...JRF...
Diadina Cotte
Advisor

Re: VG Question

Hi I did a more on the lvmtab:
root@apache:/etc#>more lvmtab
^CM-h^E/dev/vg00
wM-f;U1M-WyB^A/dev/dsk/c0t4d0
/dev/vg03
wM-f;U5*M-[u^A/dev/dsk/c0t0d0
/dev/vg04
wM-f;U5*M-\M-!^A/dev/dsk/c2t1d1
/dev/vg05
wM-f;U56-^Q^A/dev/dsk/c0t8d0
/dev/vg06
wM-f;U56-W^A/dev/dsk/c0t9d0

then enforce the pvcreate
using dsk

root@apache:/dev#>pvcreate -f /dev/dsk/c0t0d2
pvcreate: "/dev/dsk/c0t0d2": not a character device.
root@apache:/dev#>

enforce the pvcreate
using rdsk

root@apache:/dev#>pvcreate -f /dev/rdsk.c0t0d2
Couldn't stat physical volume "/dev/rdsk.c0t0d2":
pvcreate: Couldn't open physical volume "/dev/rdsk.c0t0d2":
No such file or directory
root@apache:/dev#>


....but I got this msg. Whats the difference between /dsk and /rdsk ??

Coffee please ;-)
S.K. Chan
Honored Contributor
Solution

Re: VG Question

The pvcreate command expect "character" device file to be used (ie rdsk) or "raw" whereas other commands like pvdisplay can use "block" device file (dsk).
It should be run like so ..

# pvcreate -f /dev/rdsk/c0t0d2

You got a typo in your last "pvcreate" command.
Jeff Schussele
Honored Contributor

Re: VG Question

Hi (again)

Use the strings command on /etc/lvmtab file - it's a binary file...
strings /etc/lvmtab

dsk => block device (many bytes at once)
rdsk => character device - bytes one after the other.

As a general rule low-level stuff is rdsk & higher level stuff is dsk

Use
pvcreate -f /dev/rdsk/c0t0d2

That should work.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
James R. Ferguson
Acclaimed Contributor

Re: VG Question

Hi (again):

Just a note...

You indicated that you used 'more' to view the '/etc/lvmtab' file. You should use the 'strings' command since this file is a binary (not ascii text) file. Your results will be much more readable:

# strings /etc/lvmtab

Regards!

...JRF...
PIYUSH D. PATEL
Honored Contributor

Re: VG Question

Hi,

/dev/rdsk/c0t0d2 is the raw device ( character device - charcter one after another) and /dev/dsk/c0t0d2 is a block device(many bytes together).

With pvcreate you have to use the raw device.

Piyush
Diadina Cotte
Advisor

Re: VG Question

yep typo... oh my
root@apache:/dev#>pvcreate -f /dev/rdsk/c0t0d2
Physical volume "/dev/rdsk/c0t0d2" has been successfully created.
root@apache:/dev#>mkdir /dev/vg07
root@apache:/dev#>mknod /dev/vg07 /dev/rdsk/c0t0d2
mknod: arg count
usage: mknod name b|c major minor
mknod name p
root@apache:/dev#>


...well i was going to do this now:

# pvcreate /dev/rdsk/c0t0d2

# mkdir /dev/vg07
# mknod /dev/vg07/group c 64 0x070000

# vgcreate /dev/vg07 /dev/rdsk/c0t0d2

# lvcreate -L size /dev/vg07
# lvcreate -L size /dev/vg07
# lvcreate -L size /dev/vg07

Creates 3 logical volumes lvol1, lvol2 and lvol3

# newfs -F vxfs /dev/vg07/rlvol1
# newfs -F vxfs /dev/vg07/rlvol2
# newfs -F vxfs /dev/vg07/rlvol3

# mount /dev/vg07/lvol1 /extern01
# mount /dev/vg07/lvol2 /extern02
# mount /dev/vg07/lvol3 /extern03

I got stuck in the mknod command
suggestions?
:-(
Coffee please ;-)
Tal Drigov_1
Occasional Advisor

Re: VG Question

Hi,

The devices indeed belongs to an exiting Volume group.
if it's still included in the system you can check via the command:

"strings /etc/lvmtab | grep -i c0t0d2".

if it's not there, then you can force pvcreate by adding the option "-f".

Good Luck.

T.
Two words lead the world....HP
Diadina Cotte
Advisor

Re: VG Question

Yep another tipo here ...
Coffee please ;-)
Tal Drigov_1
Occasional Advisor

Re: VG Question

Hey Again,

Where did you got stuck ?
You create the group file via mknod once.

What are you trying to do ?
Just to create a simple VG ? (with lvols)
Two words lead the world....HP
Jeff Schussele
Honored Contributor

Re: VG Question

Suspect that the minor # (0x07...) is already in use.

Check the /dev/vg... dirs for it already being used.

Note that you may have to increase the
maxvgs
kernel parameter is it defaults to 10 IF you already have 10 VGs defined.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
PIYUSH D. PATEL
Honored Contributor

Re: VG Question

Hi,

You can create the group file for vg07 thro mknod command.

# mknod /dev/vg07/group c 64 0x070000

It creates a group file with Major No. 64 - That is for the volume group and Minor no. 7 - for vg07

Piyush
Jon Finley
Honored Contributor

Re: VG Question

Try the following:

strings /etc/lvmtab | more

and/or

# pvdisplay -v /dev/dsk/c0t0d2 | grep VG
VG Name /dev/vg00
VGDA 2
# pvdisplay -v /dev/dsk/c0t0d2 | grep current | grep 00000
00000 current /dev/vg00/lvol1 00000
00064 current /dev/vg00/lvol2 00000
00320 current /dev/vg00/lvol3 00000
00384 current /dev/vg00/lvol4 00000
00512 current /dev/vg00/lvol5 00000
00602 current /dev/vg00/lvol6 00000
00858 current /dev/vg00/lvol7 00000
01114 current /dev/vg00/lvol8 00000
#


Then, if the disk is NOT in any volume group use:
pvcreate -f /dev/rdsk/c0t0d2
to initialize the disk for lvm.

Jon
"Do or do not. There is no try!" - Yoda
James R. Ferguson
Acclaimed Contributor

Re: VG Question

Hi:

Stuck on 'mknod'? Make sure that your minor number is unique. Do:

ls -l /dev/vg*/group

In your case, make sure that vg07 (minor=07) doesn't already exist. Then:

# mknod /dev/vg07/group c64 0x070000

Regards!

...JRF...
Tal Drigov_1
Occasional Advisor

Re: VG Question

hey Diadina!,


Here's the procedure for creating the VG.

1. pvcreate /dev/rdsk/c0t0d2
2. mkdir /dev/vg07
3. mknod /dev/vg07/group c 64 0x070000
4. vgcreate /dev/vg07 /dev/dsk/c0t0d2
5. lvcreate -L size /dev/vg07
6. newfs -F vxfs /dev/vg07/rlvol?
7. mount /dev/vg07/lvol? /mount_point


if you got stuck on the mknod command, what is the exact error message ?
try checking if the inode is available (0x070000) by: 'll /dev/*/group" and see if the 0x070000 inode is note
taken.

T.
Two words lead the world....HP
S.K. Chan
Honored Contributor

Re: VG Question

# pvcreate /dev/rdsk/c0t0d2
# mkdir /dev/vg07
# mknod /dev/vg07/group c 64 0x070000
==> Yes this is the correct syntax. If you have problem at this stage, it's probably due to the minor number "0x070000" already being used in an existing VG. Check it with ..
# ls /dev/vg*/group
..assuming all your VG names start with "vg". Use another minor number in you mknod if 0x070000 is used already.

The rest of your steps looks good. You want to also edit /etc/fstab file to make the mount points permanent (ie mounts everytime the system boots up).