Operating System - HP-UX
1826775 Members
1508 Online
109702 Solutions
New Discussion

How to create logical volumes on specified disk device?

 
SOLVED
Go to solution
Randy Hagedorn
Regular Advisor

How to create logical volumes on specified disk device?

Hi,

I would like to create logical volumes on specefied disk devices. For example, I have a volume group that spans two disks. I want to put logical volume A on disk A and logical volume B on disk B, and dont' want Logical Volumes A and B ending up on the same disk device, for performance reasons.

Can this be done? Does this have any future concerns about future Logical Volume expansion?

Thanks,
Randy
10 REPLIES 10
RAC_1
Honored Contributor
Solution

Re: How to create logical volumes on specified disk device?

man lvcreate. If I remember syntax correctly, it as as follows.

lvcreate -L xxm /dev/vgxx /dev/dsk/cxtxdx

the way is, doing lvcreate ad extending it.

lvcreate -l 0 /dev/vg00/vgxx
lvextend -L xxxM /dev/vgxx/lvolx /dev/dsk/cxtxdx

Anil
There is no substitute to HARDWORK
Steven E. Protter
Exalted Contributor

Re: How to create logical volumes on specified disk device?

The vgcreate command requires you to include one disk device when the volume group is created.

Then use the command vgextend to extend the volume group to the second disk device.

It won't extend or include a disk that is already in a volume group.

Once a disk is removed from a volume group with the vgreduce command you are free to extend another volume group onto it. prior to vgreduce, lvremove any logical volumes on it.

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
Pedro Cosmen
Valued Contributor

Re: How to create logical volumes on specified disk device?

Hello Randy, the way RAC says is the correct, you have to create the LV's with no size (lvcreate vgxx) and the add space into the device you want (lvextend -l xxx /dev/vgxx/lvolxx /dev/dsk/cxtxd0). In future expansion you have to keep in mind this, and use the lvextend command with the indication of the appropiate device (and of course with enough sapce).

Regards.
Sanjay_6
Honored Contributor

Re: How to create logical volumes on specified disk device?

Hi Randy,

First create the lv and then extend it to the specific disk you want,

lvcreate -n lv_name /dev/vg_name
lvextend -L size_in_mb /dev/vg_name/lv_name /dev/dsk/cxtydz
newfs -F vxfs -o largefiles /dev/vg_name/rlv_name

Hope this helps.

Regds
Leif Halvarsson_2
Honored Contributor

Re: How to create logical volumes on specified disk device?

Hi,
Why not create two volume groups with one disk in each instead ?
Randy Hagedorn
Regular Advisor

Re: How to create logical volumes on specified disk device?

Leif,

Good question, but in this case,I am upgrading a K-class to an N-class and don't want to be changing the application too much at this point.

I will keep it in mind, however.

Thanks,
Randy
Steven E. Protter
Exalted Contributor

Re: How to create logical volumes on specified disk device?

There are lots of ways to get this done, few without downtime.

I did not realize until your last post you already have the application running.


You can create a volume group with as many disks as you like. The issue of keeping your application on specific disks is simple enough with a little planning.

Here is the outline.

Create the volume group, include as many disks as you like or vgextend after its built. Which way does not matter.

Then

lvcreate the logical volumes for the application.

I always go two step, lvcreate emtpy then lvextend. It gives me more control and I don't know the syntax for one stepping it anyway.

lvextend -L /dev/vg01/lvolname /dev/dsk/c1t1d0

This lets me keep control of what goes where.

I plan the logical volumes out so I know in advance what data is going where. I try and seperate data and index into different physical devices for performance reasons. Thats kind of hard to do with todays huge disks, but maybe you have smallter ones.

Anyway, thats how i keep what belongs on what disk where it should be.

Hopefully it helps.

I can write a plan if you give me device names and sizes and requirements.

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
Randy Hagedorn
Regular Advisor

Re: How to create logical volumes on specified disk device?

SEP,

I just wanted confirmation that it is possible to have control over what goes where.

To furher complicate things even more, these logical volumes will be mirrored. So, to ensure that the mirrors end up on the proper disk, I can specify which disk is the mirror when I lvextend it, right?

Thanks,
Randy
Sanjay_6
Honored Contributor

Re: How to create logical volumes on specified disk device?

Hi Randy,

Normally the way i would do it is,

lvceate -n lv_name /dev/vg_name
lvextend -L size_in_mb /dev/vg_name/lv_name /dev/dsk/cxtydz
newfs -F vxfs -o largefiles /dev/vg_name/rlv_name
lvextend -m 1 /dev/vg_name/lv_name /dev/dsk/catbdc

So i know where the primary and the mirror are sitting. We also use the -s g option if a PVG is configured. that way the primary and the mirror copies are always on seperate disks.

Hope this helps.

Regds
Steven E. Protter
Exalted Contributor

Re: How to create logical volumes on specified disk device?

Since you addressed me directly, I'll give a little example. It is contrived, but will give you the command syntax needed to fully control the job.

Scenario: You have 4 disks all with plenty of space on them. We need to create a new mirrored logical volume called lvolsep

:-)

disks:
/dev/dsk/c1t1d0
/dev/dsk/c1t2d0

/dev/dsk/c2t1d0
/dev/dsk/c2t2d0

Note there are two controller c1 and c2.

For simplicity all disks are in /dev/vg01

The ideal mirroring situation is to mirror across controllers.

lvcreate -C n -n lvolsep /dev/vg01

-C n means the volume does not have to be contiguous.

lvextend -L 1000 /dev/vg01/lvolsep /dev/dsk/c1t1d0
# Extends the unmirrored lvolsep 1000 MB to disk /dev/dsk/c1t1d0
lvextend -m 1 /dev/vg01/lvolsep /dev/dsk/c2t1d0
#mirrors to a specific disk on c2 controller

newfs -F vxfs -o largefiles /dev/vg01/rlvolsep
#lays down a filesytem on it capable of largefiles

Now a whoops.

It needed to be 2000 MB.

lvsplit /dev/vg01/lvolsep
# breaks the mirror, I find it simpler to do this way.
A copy of the logical volume is now on c2 controller caled /dev/vg01/lvolsep_copy it will need to be lvremoved.

lvextend -L 2000 /dev/vg01/lvolsep /dev/dsk/c1t1d0

lvextend -m 1 /dev/vg01/lvolsep /dev/dsk/c2t1d0
# mirror it

extendfs -F vxfs /dev/vg01/rlvolsep
#extends the vxfs filesystem.

Now I have purposely avoided using the second disk in either controller, but you can do that as well. I try whenever possible to keep my logical volumes contiguous for performance reasons.

I hope this clarified and confirmed and did not confuse.

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