Operating System - HP-UX
1823250 Members
3229 Online
109648 Solutions
New Discussion юеВ

LVM Question: lvcreate command

 
SOLVED
Go to solution
LG Porter
Frequent Advisor

LVM Question: lvcreate command

After extending a existing volume (vg01) with several new physical disks (c2t1d0, c3t0d0), I would like to create a logical volume to one of the new disk so that the file system will use only that disk. Using the lvcreate command, what is the correct syntax to create a logical volume to a specific disk?
6 REPLIES 6
Victor_5
Trusted Contributor

Re: LVM Question: lvcreate command

The syntax is
lvcreate -L size -n lv_name vg_name

man lvcreate for more.

Since you have a couple of pv in your vg01, pv, lv and vg are all from logical point, I don't think you can do it.

S.K. Chan
Honored Contributor
Solution

Re: LVM Question: lvcreate command

First you would create your LV without specifying the size. Then you would lvextend it with the size you wanted to the PV(disk) that you want it to reside.
EX:

# lvcreate -n lvol4 /dev/vg01
# lvextend -L 800 /dev/vg01/lvol4 /dev/dsk/c2t1d0

Check it afterwards ..

# lvdisplay -v /dev/vg01/lvol4 | more
# pvdisplay -v /dev/dsk/c2t1d0
Victor_5
Trusted Contributor

Re: LVM Question: lvcreate command

I think S.K. Chan is correct, pls ignore my first post, sorry for about it.
Tom Geudens
Honored Contributor

Re: LVM Question: lvcreate command

Hi,
As an extra "add-on"
If some (part of) the logical volume doesn't end up where you want it, use pvmove to replace it. It's slow, but it works ONLINE. I consider it as one of the best LVM tools around.

Regards,
Tom
A life ? Cool ! Where can I download one of those from ?
Roger Baptiste
Honored Contributor

Re: LVM Question: lvcreate command


To add to SK's post, the size for L would be in Megabytes.

Here is a LVM quick reference link:
http://us-support2.external.hp.com/cki/bin/doc.pl/sid=51ed1c020f23f4057b/screen=ckiDisplayDocument?docId=200000058994424

cheers
-raj
Take it easy.
Bill Hassell
Honored Contributor

Re: LVM Question: lvcreate command

Create the lvol the same size as the disk. However, to force the lvol to a specific disk, use lvcreate with no length option. This creates a zero-length which you can extend using lvextend. lvextend can specify exactly which disk to use for the lvol.

Before you extend the lvol, use vgdisplay -v to determine the number of free extents on the desired disk. Then use lvextend -l free-extent-num /dev/vgXX/lvolYY /dev/dsk/WhatEver and recheck with vgdisplay. Once allocation is correct, then you can create the filesystem and mount the lvol.


Bill Hassell, sysadmin