1752716 Members
5796 Online
108789 Solutions
New Discussion юеВ

lvreduce with many disks

 
achduliebe
Occasional Contributor

lvreduce with many disks

Need some help, for some reason I have encountered this issue and I can not wrap my head around a solution.

The issue I'm having involves a storage migration. I have a volume group with quite a few 100GB LUNs. All of these luns make up one logical volume. I need to mirror that logical volume to new 3Par disks. No issues there, my issue comes in the splitting off of the old LUNs (original luns). 

The problem is that when I do the lvreduce to break off the original disks, I don't have enough characters on the command line to accomodate all of the disks I need to split off.

How do I split off (lvreduce) a large number of disks?

Hopefully that makes some sense.

Thanks,

Bryan

5 REPLIES 5
achduliebe
Occasional Contributor

Re: lvreduce with many disks

Ok, well I did a bit more digging and found this post:

/t5/LVM-and-VxVM/lvreduce-m-0-multiple-PV-s/td-p/5083917

So basically what I was missing was adding "\" to continue the input line. I don't know why I could not pull that out of my head, as many times as I have used that...

As an FYI, here is what the command would look like:

lvreduce -m 0 /dev/vgXX/lvolYY /dev/disk/disk## /dev/disk/disk## \

/dev/disk/disk## /dev/disk/disk## \

/dev/disk/disk## /dev/disk/disk## \

/dev/disk/disk##

 

Steven Schweda
Honored Contributor

Re: lvreduce with many disks

> [...] I don't have enough characters on the command line [...]

   For some shell or other (which?)?  Using some terminal/emulator?
What, exactly, do you think limits what, exactly?

> [...] adding "\" to continue the input line. [...]

  Or just keep typing past (whatever you think is) the end of the line?

> [...] can not wrap my head around [...]

   It's a line-wrap question, not a head-wrap question.

Bill Hassell
Honored Contributor

Re: lvreduce with many disks

This is a common misunderstanding about line lengths. Your terminal emulator (SecureCRT, Reflection, PuTTY, xterm...) provides an artificial line length that may be 80 or 100 or more characters. But the right end of the screen is meaningless to the shell which is limited to about 250 characters for an input line. And vi is limited to about 4000 characters on a single line.

Or for lvreduce, you can issue the command several times to remove a few LUNs at a time.



Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: lvreduce with many disks

> [...] the shell which is limited to about 250 characters for an input
> line. [...]

   This depends on which "the shell" you use.  Around here, for example:

rux# uname -a
HP-UX rux B.11.31 U ia64 1678555272 unlimited-user license

And "/bin/sh" stops accepting input at 250 characters, so a command like
"echo <blah, blah, ...> is stopped at a point like this (as seen on an
80-character-wide terminal):

1 123456789 123456789 123456789 123456789 123456789 2 123456789 123456789 123456
789 123456789 123456789 3 123456789 123456789 123456789 123456789 123456789 4 12
3456789 123456789 123456789 123456789 123456789 5 123456789 123456789 123456789
12345

("echo " + 245 characters = 250 characters.)

But GNU bash has no such (low) limit:

1 123456789 123456789 123456789 123456789 123456789 2 123456789 123456789 123456
789 123456789 123456789 3 123456789 123456789 123456789 123456789 123456789 4 12
3456789 123456789 123456789 123456789 123456789 5 123456789 123456789 123456789
123456789 123456789 6 123456789 123456789 123456789 123456789 123456789 7 123456
789 123456789 123456789 123456789 123456789 8 123456789 123456789 123456789 1234
56789 123456789 9 123456789 123456789 123456789 123456789 123456789 A 123456789
123456789 123456789 123456789 123456789 B 123456789 123456789 123456789 12345678
9 123456789 C 123456789 123456789 123456789 123456789 123456789 D 123456789 1234
56789 123456789 123456789 123456789 E 123456789 123456789 123456789 123456789 12
3456789 F 123456789 123456789 123456789 123456789 123456789

("echo " + 779 characters = 784 characters, with no end in sight.)

rux# $0 --version
$0 --version
GNU bash, version 3.2.0(1)-release (ia64-hp-hpux11.31)
Copyright (C) 2005 Free Software Foundation, Inc.

   But certainly, using backslash-escaped line breaks, and writing a
script instead of trying to enter such a long line manually (even
employing the new copy+paste technology which I used) makes more sense.

Torsten.
Acclaimed Contributor

Re: lvreduce with many disks

do a

man lvmpvg

this will help you.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!