linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Convert striped lv to single pv on another disk?
@ 2012-12-13 13:32 Gianluca Cecchi
  2012-12-13 15:28 ` Gianluca Cecchi
  0 siblings, 1 reply; 6+ messages in thread
From: Gianluca Cecchi @ 2012-12-13 13:32 UTC (permalink / raw)
  To: LVM general discussion and development

Hello,
I have a 300Gb LV composed by 2 150Gb each PV in striping:

lvdisplay:
  --- Logical volume ---
  LV Name                /dev/VG_TEST/LV_TEST
  VG Name                VG_TEST
  LV UUID                9LVrQr-XPSW-kuHt-eyYx-BrlE-MwQh-LcSfhN
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                299.99 GB
  Current LE             76798
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:61

lvdisplay --maps:
  --- Logical volume ---
  LV Name                /dev/VG_TEST/LV_TEST
  VG Name                VG_TEST
  LV UUID                9LVrQr-XPSW-kuHt-eyYx-BrlE-MwQh-LcSfhN
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                299.99 GB
  Current LE             76798
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:61

  --- Segments ---
  Logical extent 0 to 76797:
    Type                striped
    Stripes             2
    Stripe size         64 KB
    Stripe 0:
      Physical volume   /dev/mapper/mpath133
      Physical extents  0 to 38398
    Stripe 1:
      Physical volume   /dev/mapper/mpath134
      Physical extents  0 to 38398

I have to migrate to a single third 400Gb disk that I'm gong to
configure as a further PV of VG_TEST.
How can I pvmove a striped volume to a single one?
Thanks,
Gianluca

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Convert striped lv to single pv on another disk?
  2012-12-13 13:32 [linux-lvm] Convert striped lv to single pv on another disk? Gianluca Cecchi
@ 2012-12-13 15:28 ` Gianluca Cecchi
  2012-12-13 15:39   ` Bryn M. Reeves
  0 siblings, 1 reply; 6+ messages in thread
From: Gianluca Cecchi @ 2012-12-13 15:28 UTC (permalink / raw)
  To: LVM general discussion and development

Searching on Internet I found several methods and the one I tested (at
the moment only on loop devices) and seems ok is this one below, that
passes through creating a mirror between the initial striped lv
components and the new pv with lvconvert command and then gets rid off
the initial pvs

Just in case anyone else arrives here...
Gianluca

- working dir
cd /depot/test

- create pvs on file
[root@dep001 test]# time dd if=/dev/zero of=pv1 bs=1024k count=1024

same for pv2
# time dd if=/dev/zero of=pv1 bs=1024k count=1024

- setup loop devices
[root@dep001 test]# losetup -f /depot/test/pv1

[root@dep001 test]# losetup -f /depot/test/pv2

[root@dep001 test]# losetup -a
/dev/loop0: [fd00]:6029314 (/depot/test/pv1)
/dev/loop1: [fd00]:6029315 (/depot/test/pv2)

- create physical volumes
[root@dep001 test]# pvcreate /dev/loop0
  Writing physical volume data to disk "/dev/loop0"
  Physical volume "/dev/loop0" successfully created

[root@dep001 test]# pvcreate /dev/loop1
  Writing physical volume data to disk "/dev/loop1"
  Physical volume "/dev/loop1" successfully created

- create volume group
[root@dep001 test]# vgcreate vg_test /dev/loop0 /dev/loop1
  /dev/cdrom: open failed: No medium found
  Volume group "vg_test" successfully created

- create striped logical volume
[root@dep001 test]# lvcreate -i 2 -I 64k -n lv_test -l+100%FREE vg_test
  Logical volume "lv_test" created

[root@dep001 test]# lvs -o name,size,stripes,stripesize vg_test/lv_test
  LV      LSize #Str Stripe
  lv_test 1.99G    2 64.00K

- create third pv
[root@dep001 test]# time dd if=/dev/zero of=pvnew bs=1024k count=3076

and setup loop device
[root@dep001 test]# losetup -f /depot/test/pvnew

[root@dep001 test]# losetup -a
/dev/loop0: [fd00]:6029314 (/depot/test/pv1)
/dev/loop1: [fd00]:6029315 (/depot/test/pv2)
/dev/loop2: [fd00]:6029316 (/depot/test/pvnew)

- add new pv to vg
[root@dep001 test]# pvcreate /dev/loop2
[root@dep001 test]# vgextend vg_test /dev/loop2

- current situation
[root@dep001 test]# lvdisplay -m vg_test/lv_test
  --- Logical volume ---
  LV Name                /dev/vg_test/lv_test
  VG Name                vg_test
  LV UUID                0L3Dom-9frG-KeRU-mffe-lQaD-7UA2-AuuhNE
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.99 GB
  Current LE             510
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:4

  --- Segments ---
  Logical extent 0 to 509:
    Type striped
    Stripes 2
    Stripe size 64 KB
    Stripe 0:
      Physical volume /dev/loop0
      Physical extents 0 to 254
    Stripe 1:
      Physical volume /dev/loop1
      Physical extents 0 to 254

   [root@dep001 test]# pvs --segments -o+lv_name,seg_start_pe,segtype
/dev/loop0 /dev/loop1
  PV         VG      Fmt  Attr PSize    PFree Start SSize LV      Start Type
  /dev/loop0 vg_test lvm2 a--  1020.00M    0      0   255 lv_test     0 striped
  /dev/loop1 vg_test lvm2 a--  1020.00M    0      0   255 lv_test     0 striped


[root@dep001 test]# vgdisplay vg_test
  --- Volume group ---
  VG Name               vg_test
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               3.99 GB
  PE Size               4.00 MB
  Total PE              1021
  Alloc PE / Size       510 / 1.99 GB
  Free  PE / Size       511 / 2.00 GB
  VG UUID               KSX0eT-mrPc-gRLb-w2tI-SOuj-VlaD-SMgFcc

- create mirror with new pv
[root@dep001 test]# lvconvert -m 1 /dev/vg_test/lv_test /dev/loop2
  Insufficient suitable allocatable extents for logical volume : 510
more required
  Unable to allocate extents for mirror(s).

the problem resides on the fact that by default it tries to use
another PV as mirror log
and we have no one...
So we use in memory mirror log with "--mirrorlog core" option


[root@dep001 test]# lvconvert -m 1 --mirrorlog core
/dev/vg_test/lv_test /dev/loop2
  vg_test/lv_test: Converted: 0.2%
...
  vg_test/lv_test: Converted: 92.2%
  vg_test/lv_test: Converted: 93.5%
  vg_test/lv_test: Converted: 100.0%

- keep off the striped leg
[root@dep001 test]# lvconvert -m 0 /dev/vg_test/lv_test /dev/loop0 /dev/loop1
  Logical volume lv_test converted.

- verify new lv that is a linear one
[root@dep001 test]# lvdisplay vg_test/lv_test
  --- Logical volume ---
  LV Name                /dev/vg_test/lv_test
  VG Name                vg_test
  LV UUID                0L3Dom-9frG-KeRU-mffe-lQaD-7UA2-AuuhNE
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.99 GB
  Current LE             510
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:4

[root@dep001 test]# lvdisplay -m vg_test/lv_test
  --- Logical volume ---
  LV Name                /dev/vg_test/lv_test
  VG Name                vg_test
  LV UUID                0L3Dom-9frG-KeRU-mffe-lQaD-7UA2-AuuhNE
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.99 GB
  Current LE             510
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           253:4

  --- Segments ---
  Logical extent 0 to 509:
    Type linear
    Physical volume /dev/loop2
    Physical extents 0 to 509

- keep off the old pvs
[root@dep001 test]# vgreduce vg_test /dev/loop0 /dev/loop1
  Removed "/dev/loop0" from volume group "vg_test"
  Removed "/dev/loop1" from volume group "vg_test"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Convert striped lv to single pv on another disk?
  2012-12-13 15:28 ` Gianluca Cecchi
@ 2012-12-13 15:39   ` Bryn M. Reeves
  2012-12-13 16:11     ` Gianluca Cecchi
  0 siblings, 1 reply; 6+ messages in thread
From: Bryn M. Reeves @ 2012-12-13 15:39 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Gianluca Cecchi

On 13/12/12 15:28, Gianluca Cecchi wrote:
> Searching on Internet I found several methods and the one I tested (at
> the moment only on loop devices) and seems ok is this one below, that
> passes through creating a mirror between the initial striped lv
> components and the new pv with lvconvert command and then gets rid off
> the initial pvs

Why not just use pvmove to move the extents off the two original PVs and
onto the third? The end result is the same (and internally it's not
dissimilar - pmove creates a temporary mirror volume to do its work) but
it's less manual work and should be more robust as pvmove does
checkpointing that allows the process to be interrupted and restarted.

Regards,
Bryn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Convert striped lv to single pv on another disk?
  2012-12-13 15:39   ` Bryn M. Reeves
@ 2012-12-13 16:11     ` Gianluca Cecchi
  2012-12-13 16:38       ` Bryn M. Reeves
  0 siblings, 1 reply; 6+ messages in thread
From: Gianluca Cecchi @ 2012-12-13 16:11 UTC (permalink / raw)
  To: Bryn M. Reeves; +Cc: LVM general discussion and development

On Thu, Dec 13, 2012 at 4:39 PM, Bryn M. Reeves  wrote:
> On 13/12/12 15:28, Gianluca Cecchi wrote:
>> Searching on Internet I found several methods and the one I tested (at
>> the moment only on loop devices) and seems ok is this one below, that
>> passes through creating a mirror between the initial striped lv
>> components and the new pv with lvconvert command and then gets rid off
>> the initial pvs
>
> Why not just use pvmove to move the extents off the two original PVs and
> onto the third? The end result is the same (and internally it's not
> dissimilar - pmove creates a temporary mirror volume to do its work) but
> it's less manual work and should be more robust as pvmove does
> checkpointing that allows the process to be interrupted and restarted.
>
> Regards,
> Bryn.
>
>

I found in another thread that the resulting LV with pvmove remains a
striped one on only one disk as far as its structure is concerned...
with degraded performance...
Have you an example of pvmove command options to test to execute based
on my test?
So that I can verify with my loop devices?
Thanks
Gianluca

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Convert striped lv to single pv on another disk?
  2012-12-13 16:11     ` Gianluca Cecchi
@ 2012-12-13 16:38       ` Bryn M. Reeves
  2012-12-14 18:33         ` Stuart D Gathman
  0 siblings, 1 reply; 6+ messages in thread
From: Bryn M. Reeves @ 2012-12-13 16:38 UTC (permalink / raw)
  To: Gianluca Cecchi; +Cc: LVM general discussion and development

On 13/12/12 16:11, Gianluca Cecchi wrote:
> I found in another thread that the resulting LV with pvmove remains a
> striped one on only one disk as far as its structure is concerned...
> with degraded performance...
> Have you an example of pvmove command options to test to execute based
> on my test?
> So that I can verify with my loop devices?

Yes, you're right. You will end up with both stripes still present but
on a single disk.

The best I could do using pvmove was to move individual extents around
(!) to make the LV contiguous on-disk. Of course, this doesn't remove
the striping and inflates the number of segments since each pair of
striped extents effectively becomes a segment.

The lvconvert command also still accepts a -i <n> parameter but doesn't
do anything useful with it and doesn't report an error.

Regards,
Bryn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] Convert striped lv to single pv on another disk?
  2012-12-13 16:38       ` Bryn M. Reeves
@ 2012-12-14 18:33         ` Stuart D Gathman
  0 siblings, 0 replies; 6+ messages in thread
From: Stuart D Gathman @ 2012-12-14 18:33 UTC (permalink / raw)
  To: linux-lvm

On 12/13/2012 11:38 AM, Bryn M. Reeves expounded in part:
> On 13/12/12 16:11, Gianluca Cecchi wrote:
>> I found in another thread that the resulting LV with pvmove remains a
>> striped one on only one disk as far as its structure is concerned...
>> with degraded performance...
>> Have you an example of pvmove command options to test to execute based
>> on my test?
>> So that I can verify with my loop devices?
> Yes, you're right. You will end up with both stripes still present but
> on a single disk.
>
> The best I could do using pvmove was to move individual extents around
> (!) to make the LV contiguous on-disk. Of course, this doesn't remove
> the striping and inflates the number of segments since each pair of
> striped extents effectively becomes a segment.
>
> The lvconvert command also still accepts a -i <n> parameter but doesn't
> do anything useful with it and doesn't report an error.
>
Could you create an asymmetrical mirror - where one leg is striped and 
the other is linear?  Then you can just sync the mirror and delete the 
striped leg.   I could even see operating with such a mirror - call it 
RAID �.  Reads would prefer the striped side, and the mirror is there in 
case one of the stripes fails, while requiring only 1 additional drive 
and degrading only write performance.

RAID10 over the 3 drives is probably better, though.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-14 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 13:32 [linux-lvm] Convert striped lv to single pv on another disk? Gianluca Cecchi
2012-12-13 15:28 ` Gianluca Cecchi
2012-12-13 15:39   ` Bryn M. Reeves
2012-12-13 16:11     ` Gianluca Cecchi
2012-12-13 16:38       ` Bryn M. Reeves
2012-12-14 18:33         ` Stuart D Gathman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).