Operating System - HP-UX
1748137 Members
3677 Online
108758 Solutions
New Discussion юеВ

lvreduce -m 0 multiple PV's

 
Bob Manocchia
Regular Advisor

lvreduce -m 0 multiple PV's

I need to remove 16 Physical Volumes using lvreduce. I tried doing it 4 at a time since I cannot specify all 16 in one command (too long). The result from lvdisplay -v is show below:

--- Distribution of logical volume ---
PV Name LE on PV PE on PV
/dev/dsk/c6t0d4 4 4
/dev/dsk/c6t0d5 4 4
/dev/dsk/c6t0d6 4 4
/dev/dsk/c6t0d7 4 4
/dev/dsk/c6t1d0 4 4
/dev/dsk/c6t1d1 4 4
/dev/dsk/c6t1d2 4 4
/dev/dsk/c6t1d3 4 4
/dev/dsk/c6t1d4 4 4
/dev/dsk/c6t1d5 4 4
/dev/dsk/c6t1d6 4 4
/dev/dsk/c6t1d7 4 4
/dev/dsk/c12t0d1 2 2
/dev/dsk/c12t0d2 2 2
/dev/dsk/c12t0d3 2 2
/dev/dsk/c12t0d4 2 2
/dev/dsk/c12t0d5 1 1
/dev/dsk/c12t0d6 1 1
/dev/dsk/c12t0d7 1 1
/dev/dsk/c12t1d0 1 1
/dev/dsk/c12t1d1 2 2
/dev/dsk/c12t1d2 2 2

--- Logical extents ---
LE PV1 PE1 Status 1
00000 /dev/dsk/c12t0d1 00000 current
00001 /dev/dsk/c12t0d2 00000 current
00002 /dev/dsk/c12t0d3 00000 current
00003 /dev/dsk/c12t0d4 00000 current
00004 /dev/dsk/c6t0d4 00008 current
00005 /dev/dsk/c6t0d5 00008 current
00006 /dev/dsk/c6t0d6 00008 current
00007 /dev/dsk/c6t0d7 00008 current
00008 /dev/dsk/c6t1d0 00008 current
00009 /dev/dsk/c6t1d1 00008 current
00010 /dev/dsk/c6t1d2 00008 current
00011 /dev/dsk/c6t1d3 00008 current
00012 /dev/dsk/c6t1d4 00008 current
00013 /dev/dsk/c6t1d5 00008 current
00014 /dev/dsk/c6t1d6 00008 current
00015 /dev/dsk/c6t1d7 00008 current

I want to remove all the extents from the c6 disks and keep the c12 disks. Is there any way to accomplish this.

Thanks
11 REPLIES 11
Mike Shilladay
Esteemed Contributor

Re: lvreduce -m 0 multiple PV's

Hi Bob,

Are you trying to reduce the mirror or trying to move the extents?

To remove the mirror copy from an lvol, based on the reverse of the mirror sequence, the command

lvreduce -m 0 /dev//

If you wish to move extents, from one device to another (must be in the same volume group, you will need the to use the pvmove command.

e.g. Move the physical extents for logical volume /dev/vg01/lvol1 that are currently on /dev/dsk/c1t0d0 to /dev/dsk/c2t0d0:

pvmove -n /dev/vg01/lvol1 /dev/dsk/c1t0d0 /dev/dsk/c2t0d0

Mike.
Steven E. Protter
Exalted Contributor

Re: lvreduce -m 0 multiple PV's

Shalom,

Make a list of the logical volumes you wish to reduce and the disks in a file, lets say colon delimted.

/dev/vg01/lvolname:/dev/dsk/c12t0d4
filename list

read -r fn
do
DL=$fn
LVN=$(echo $fn | awk -F: '{print $1}'
DSN=$(echo $fn | awk -F: '{print $2}'
# may be okay
lvreduce -m 0 $LVN
# more precise
lvreduce -m 0 $LVN $DSN

done < list

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
Torsten.
Acclaimed Contributor

Re: lvreduce -m 0 multiple PV's

How about the first couple of lines from your lvdisplay output?

Is the LVOL really mirrored?

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!   
Bob Manocchia
Regular Advisor

Re: lvreduce -m 0 multiple PV's

That lvol looks corrupt since all the extents as spread across two different disk frames. I am trying to move lvols from from disk frame to another via mirroring but ther are 16 PV's on the old disk frame I wish to remove. Below is one I haven't touched yet:

00000 /dev/dsk/c6t0d0 00012 current /dev/dsk/c12t0d1 00007 current
00001 /dev/dsk/c6t0d1 00012 current /dev/dsk/c12t0d2 00007 current
00002 /dev/dsk/c6t0d2 00012 current /dev/dsk/c12t0d3 00007 current
00003 /dev/dsk/c6t0d3 00012 current /dev/dsk/c12t0d4 00007 current
00004 /dev/dsk/c6t0d4 00012 current /dev/dsk/c12t0d5 00006 current
00005 /dev/dsk/c6t0d5 00012 current /dev/dsk/c12t0d6 00006 current
00006 /dev/dsk/c6t0d6 00012 current /dev/dsk/c12t0d7 00006 current
00007 /dev/dsk/c6t0d7 00012 current /dev/dsk/c12t1d0 00006 current
00008 /dev/dsk/c6t1d0 00012 current /dev/dsk/c12t1d1 00006 current
00009 /dev/dsk/c6t1d1 00012 current /dev/dsk/c12t1d2 00006 current
00010 /dev/dsk/c6t1d2 00012 current /dev/dsk/c12t0d1 00008 current
00011 /dev/dsk/c6t1d3 00012 current /dev/dsk/c12t0d2 00008 current
00012 /dev/dsk/c6t1d4 00012 current /dev/dsk/c12t0d3 00008 current
00013 /dev/dsk/c6t1d5 00012 current /dev/dsk/c12t0d4 00008 current
00014 /dev/dsk/c6t1d6 00012 current /dev/dsk/c12t0d5 00007 current
00015 /dev/dsk/c6t1d7 00012 current /dev/dsk/c12t0d6 00007 current

I want to remove the c6 PV's and keep the c12 PV's
Bob Manocchia
Regular Advisor

Re: lvreduce -m 0 multiple PV's

Torsten: I ran lvreduce -m 0 /dev/vg/lvol /dev/dsk/c6t0d0 /dev/dsk/c6t0d1 /dev/dsk/c6t0d2 /dev/dsk/c6t0d3. I removed those mirrors but allocated the remaining c6 extents to the c12 extents.
Mike Shilladay
Esteemed Contributor

Re: lvreduce -m 0 multiple PV's

Hi Bob,

Steve's answer looks good to solve your problem, specifically remove the mirrored extents from c6 disks.

eg

lvreduce -m 0 /dev// /dev/dsk/

Mike.
Bob Manocchia
Regular Advisor

Re: lvreduce -m 0 multiple PV's

I'll need to build a script to remove the c6 PV's all at once overcoming the limitation of typing it on the command line.
Bob Manocchia
Regular Advisor

Re: lvreduce -m 0 multiple PV's

To repair the damage done by specifying just 4 PV's of the 16 on the lvreduce -m 0 command, I think I need to use pvmove as follows:

pvmove -n /dev/vg/lvol
What your take.
Mike Shilladay
Esteemed Contributor

Re: lvreduce -m 0 multiple PV's

Bob,

Your take looks correct, but it took several reads to visualise your predicamant.

However, I would suggest that as a precaution that you always have a backup of the data before you start moving data around on disks.

Mike.