1833415 Members
3162 Online
110052 Solutions
New Discussion

Create 1 vg on 2 disks

 
SOLVED
Go to solution
Scott G. Gallup
Advisor

Create 1 vg on 2 disks

I am in need of some assistance with creating a volume group that spans two disks.
The system is a K460 running HP-UX 11.0. The two disks are /dev/dsk/c0t4d0 and /dev/dsk/c0t5d0. Each are 8678 mbytes. I would like to make the two disks into one volume group with all available disk space in this one volume group (for database tables - I don't care about anything that may be currently on the disks).
I can create vg's on a single disk with no problem but I looking for advice and commands for creating volume groups with more than one disk. Any and all help will be appreciated.
I will be away from email for a couple of days but will assign points as soon as possible. Thank you
8 REPLIES 8
Ted Ellis_2
Honored Contributor
Solution

Re: Create 1 vg on 2 disks

run the pvcreate command on each disk:

pvcreate /dev/dsk/cxtxdx

to create the volume group with both disks:

1. mkdir /dev/vgxx (if not alread done)
2. cd /dev/vgxx
3. mknod group c 64 0x0x0000 (note the second x should be substituted with the number of your volume group)... you may have done this already as well
4. vgcreate /dev/vgxx /dev/dsk/c0t4d0 /dev/dsk/c0t5d0

you will get both disks in the new volume group

if you already created the volume group with one disk and want to add the other one

vgextend /dev/vgxx /dev/dsk/cxtxdx (the disk you want to add)

Ted
A. Clay Stephenson
Acclaimed Contributor

Re: Create 1 vg on 2 disks

This is very easy. All that you need to do is first run a pvcreate on each disk. Yiu will probably need the -f option to force reuse of these disks.

You next run a vgcreate using one of the disks. Next do a vgchange -a y /dev/vgxx to activate the VG followed by a vgextend command to include the other disk.

You are now ready to create logical volumes using the lvcreate command and then followed by a newfs command to create the file system.

Man pvcreate, vgcreate, vgchange, vgextend, lvcreate, and newfs for details OR simply do all this from SAM->Disks and Filesystems. Sam will perform all these steps for you.

Regards, Clay




You can then follow this up
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Create 1 vg on 2 disks

Hi:

Do this:

# mkdir /dev/vgXX
# mknod /dev/vgXX/group c 64 0x0N0000

Note the minor number 'N' in 'mknod' must be unique. By convention is matches the convention used for the volume group name. Thus, if the volume group were "VG03" then 'N' would be '3'. You can do:

# ls -l /dev/vg*/group

...to discern what minor numbers have already been used.

# pvcreate /dev/dsk/c0t4d0
# pvcreate /dev/dsk/c0t5d0
# vgcreate /dev/vgXX /dev/dsk/c0t4d0 /dev/dsk/c0t5d0

Note that you may want to specify non-default values for 'pe_size', 'max_pe', 'max_pv' and/or 'max_lv' during the volume group creation since they cannot be changed later. Look at the man pages for 'vgcreate'.

Regards!

...JRF...
MANOJ SRIVASTAVA
Honored Contributor

Re: Create 1 vg on 2 disks

Also if the disks were a part of earlier volume group you may eb suing pvcreate -f instead of pvcreate the rest of the steps are same


mkdir /dev/vgnew
mknod /dev/vgnew/group c 64 0x300000 (300000 in unique0

pvcreate -f /dev/rdsk/c0t4d0
pvcreate -f /dev/rdsk/c0t5d0


vgcreate /dev/vgnew /dev/dsk/c0t4d0 /dev/dsk/c0t5d0


and then create the LV etc


Manoj Srivastava
Tom Danzig
Honored Contributor

Re: Create 1 vg on 2 disks

I you already know how to create a vg with one disk, adding additional disks to the vg is simple. To add /dev/dsk/c0t5d0 to a vg:

vgextend vgname /dev/dsk/c0t5d0

Use pvcreate -f on the disk prior to adding to vg. In the future, to create a vg with multiple disks, add the disk device name to the end of the vgcreate command:

vgcreate vg01 /dev/dsk/c0t4d0 /dev/dsk/c0t5d0
James R. Ferguson
Acclaimed Contributor

Re: Create 1 vg on 2 disks

Hi (again) Scott:

The necessity to use the 'f'orce option of 'pvcreate' occurs when the physical disk still has a Volume Group Identifier (VGID) in its Physical Volume Reserved Area (PVRA). This will be the case for a disk that was once part of a volume group that was 'vgexport'ed. Since this is the quickest way to destroy a volume group, many people stumble on the need to force a 'pvcreate' to ignore the VGID information.

If a volume group is destroyed with a 'vgremove' then the VGID is erased at that time and a simple (unforced) 'pvcreate' suffices.

Either a 'vgexport' or a 'vgremove' of a volume group eliminates all references to the physical disk from '/etc/lvmtab'. In addition, the 'vgexport' also removes the device files for the volume group in '/dev/vg*' which is quite convenient.

Personally, I always do a 'pvcreate -f' at the time I destroy a volume group's physical volume(s). In that way when I do a simple 'pvcreate' later, I *really* pay attention if I get the message "The physical volume already belongs to a volume group". Then, in that case I know I probably don't have the disk I want.

Regards!

...JRF...
Leif Halvarsson_2
Honored Contributor

Re: Create 1 vg on 2 disks

Hi
This is described in an example in the man pages for vgcreate (man vgcreate).

A more "user friendly" method is to use SAM.
Start SAM, select "Disk and File systems", select "Volume Groups", select Actions/Create, Select "New Volume Group Name, and last, "Select Disks".


Scott G. Gallup
Advisor

Re: Create 1 vg on 2 disks

Thank you to everyone for there assistance. I really didn't expect so many responses so quickly.

I believe that I'll be able to handle it from here.

Again, thanks.

Scott