Operating System - HP-UX
1831338 Members
3102 Online
110024 Solutions
New Discussion

Re: Creating a logical volume from shell?

 
SOLVED
Go to solution
rmueller58
Valued Contributor

Creating a logical volume from shell?

I am working on adding multiple logical volumes, I can use SAM however I'd prefer to create them from the shell.

I've got multiple volume groups with available space, I have to setup informix databases using RAW space,

how can I create the logical volume below
/dev/vg## without having to go into SAM?
15 REPLIES 15
curt larson_1
Honored Contributor

Re: Creating a logical volume from shell?

you would use the lvcreate command
see the lvcreate man page for possible options that you'll need to use
rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

Curt,
it is pretty cryptic.

From the man page I can see HOW to create one, but on how to point to the Volume Group.. If it is created by default in the correct VG will it work OK?
Jeff Schussele
Honored Contributor
Solution

Re: Creating a logical volume from shell?

Hi rex,

Use the following

lvcreate -L XXXXX -n lv_name /dev/vg_name

where XXXXX=size in MB. If you're going to want a mirror then add -m 1 If you want it striped then add -i x -I YYY where x=number of disks in the stripe (stripe count) & YYY=stripe size in KB (must be power of 2)

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

Thanks I'll give it a shot..
Marc Smith
Occasional Advisor

Re: Creating a logical volume from shell?

Maybe this is better:

lvcreate -L -n

IIRC, you can leave out the -n switch and it'll create it with a lvol## format.

Then you can check it with:

lvdisplay -v /dev//

If you're not creating raw volumes, you need to do this:

newfs -F vxfs /dev//

Then add it to you fstab and mount it.

Jeff Schussele
Honored Contributor

Re: Creating a logical volume from shell?

Since you're wanting raw volumes then you can skip the next step of filesystem creation.
You just start using /dev/vg_name/lv_name
But you should consider putting *commented* entries in the /etc/fstab as a reminder or a placeholder if you will for those LVs you've created in those VGs because they'll never show up in a bdf output & can become forgotten over time.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Creating a logical volume from shell?

Marc's correct - you don't *need* the -n lv_name. It will give you the next lvolX value by default.
BUT I hate that. I want my lv_name to tell me just what the heck that LV's for. I want it to have meaning - not just another number. Just my preference.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Marc Smith
Occasional Advisor

Re: Creating a logical volume from shell?

Wow...I don't know how I missed where you said you wanted raw volumes...Oh well, It's Friday. ;)
rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

Ok,

I am starting to get confused so let me run this past you all.

for example if I use:
lvcreate -L 1048576 -n plvdbs /dev/vg02

It will create the RAW logical called plvdbs since I am not creating a VXFS?

Marc Smith
Occasional Advisor

Re: Creating a logical volume from shell?

Yep. It's the newfs command that creates the filesystem. You will have a raw volume as long as you don't run newfs.

Sorry for the confusion.
rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

cool..

We are heading in an upgrade and need to parallel 22 informix spaces.. I will script it and be done with it..
Patrick Wallek
Honored Contributor

Re: Creating a logical volume from shell?

What size are you looking for?

The '-L 1048576' will create a 1,048,576 MB = 1,024 GB = 1 TB Volume. Do you want 1 TB?

rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

no.. 1 Gb. or 512m for the most of them
Patrick Wallek
Honored Contributor

Re: Creating a logical volume from shell?

You must remember then that you specify the size with the -L option in MB. So if you want 1 GB (1,024 MB) then it is '-L 1024' and if you want 512 MB then it is '-L 512'.
rmueller58
Valued Contributor

Re: Creating a logical volume from shell?

Thanks Patrick for clarifying the size..
And Mark and Jeff for the assist..