Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i create LVM across the disks

Status
Not open for further replies.

nani3456

Vendor
Feb 4, 2004
56
US
Hi,

Can you pl tell me how to create logical volume across hard disks.

This is how i follow to create logical volumes for one disk.
"
mklv -y'<lvm name>' <voulme group> <No. of pp> <physical volume>

mklv -y'db2_pop' datavg 3 hdisk1
"

But i need to do across hard disks,(My voulme group is shared across 5 disk with 128 pp size.and lot of them are free)
I am configuring on a new box, is there any file to be edited and do we need to add any thing any where else...some thing like that..
I tried by giving like this
mklv -y'db2_pop' datavg 3 hdisk1 hdisk2 hdisk3
but it is not creating like this.

can any body help me doing this through command line or smit.

Help is appreciated.
Thanks in advance



 

Do you actually *have* to spread it across disks? The LVM will automatically use all disks neccessary to accomodate the LV.
You can however, use 'chlv' to specify how you want you LV laid out and after that run reorgvg.

Cheers
 
You have to stripe the disk.

'-S64K' fo example for a striping size of 64k

When creating a striped logical volume using the -S flag, you must specify two or more physical volumes or use the -u flag.
When creating a striped logical volume, the number of partitions must be an even multiple of the striping width.

 
striping has its place, but speaking for myself, not a lot of need for it.

What's happening is that you are telling the OS to create the LV on only one disk when you create it:

mklv -y name vgname 1 hdiskname

leave the hdiskname off the mklv command and the LVM will create the LV whereever it wants and will consider creating it across multiple PVs.
 
Set the inter-physical volume allocation policy to "Maximum" by adding the "-e x" to your command line, like so:

mklv -e x -y'db2_pop' datavg 3 hdisk1 hdisk2 hdisk3

This will allocate one logical partition on each of the hdisks to your new logical volume, provided they each have one available. You only need to list the hdisks on the command line if there are others in the volume group that you don't want involved. Otherwise, leave the hdisks off and mklv will spread the new logical volume out across as many physical volumes as it can.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Or, if you want to specify the disks where you want the logical volume to go (very important if you are laying out filesystems for a database), you can do this:

mklv -y'<lvm name>' <volume group> <No. of pp> <physical volume1, physicalvolume2, physicalvolume3>

mklv -y'db2_pop' datavg 3 hdisk1, hdisk2, hdisk3

I would recommend this rather than letting the system determine where your logical volumes go.
 
I know when we were playing with sybase we actually mapped the locations on the disk. You can do this by creating a map file and then specifying it when creating the logical volume. If you want more info on that drop me a note. I have some scripts that will make it a lot easier.

Here is the way I would do this.

Say you have 3 disks and you want to create a logical volume that will span the 3 equally, or nearly so. This also assumes that your VG spans at least these three disks. Say an LV with 20 physical partitions.

mklv -y'db2_pop' -e'x' -u'3' datavg hdisk1 hdisk2 hdisk3

Okay. explanation:
-e:
inter-physical volume allocation policy. Tells the system that you want to use 3 disks and spread em out over those three as evenly as possible. This is the IMPORTANT option for spanning across multiple disks in a controlled fashion.

-u:
This sets the uppper bounds for the logical volume. It means I cannot use more than 3 disks for this LV.

This "should" create a logical volume with the following characteristics.
hdisk1: 7 physical partitions
hdisk2: 7 physical partitions
hdisk3: 6 physical partitions

Now the nice part about doing this. If you want to increase the size of the LV in the future, say by another 10 physical partitions.

extendlv datalv 10 hdisk1 hdisk2 hdisk3

Now you have
hdisk1: 10 physical partitions
hdisk2: 10 physical partitions
hdisk3: 10 physical partitions

Good luck.

Icehawk55
 
bi,

Without the '-e x' switch, the lvm will use the minimum number of physical volumes possible. Listing the hdisks only limits the pool from which it selects. It will put all three partitions on the first of the hdisks with three partitions free.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top