Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After some search I assume lvm2 restriping, as in take all extents of an active LV and redistribute them evenly across all current PVs in the VG, is not possible?

For example:

  • 1 Volume Group with 6 Physical Volumes HDD-based and 1 Physical Volume SSD-based.
  • A new LV is created exclusively on the SSD PV, using lvcreate options, to cope with high write IOPS.
  • Later, IOPS decline and the LV hogs valuable SSD space, so it shall be moved to the 6 Physical Volumes, striped to keep up with medium write IOPS.

(having a mix of SSD and HDD in the same VG is basically a fun thing to do, because pvmove can move LVs online from SSD to HDD and back, but unfortunately it can't stripe while moving)

The offline case is straight forward: create a new striped LV across the HDDs, dd all content from old to new, rename, online again. But is there a way to do this online?

Closest thing I could come up with is write a bash script running pvmove to scatter the extents, but that wouldn't be the same (since extent size is a whopping 4 MiB opposed to typical stripe size of 64 KiB).

share|improve this question
    
How many disks at which size are at your disposal? Do you want to do this online? How big is your maintenance window, how big is your current data? –  Nils Oct 20 '11 at 21:28
    
I already moved the LV in question offline, so this is more a hypothetical question. Just added an example to clear things up. –  korkman Oct 21 '11 at 11:03
    
So see my answer as hypothetical, too. ;-) How long were you offline for your move? –  Nils Oct 21 '11 at 21:48
    
50 GB management volume, non-production anyways. I'm just curious :-) –  korkman Oct 22 '11 at 10:33

2 Answers 2

up vote 1 down vote accepted

Since you clarified your setup I would once again have gone through the md-layer.

  1. Create a degraded Raid 1 with mdadm which consists of your original LV (on SSD)
  2. Remount that md-device instead of the LV
  3. Add the LV consisting of the 6 HDs to that raid, let it settle
  4. remove the SSD-LV from the md-device (thus degrading the md raid 1 again)
  5. Optional: umount md-device, mount HD-LV instead.

    1. and 5. will propably lead to a short downtime (if remount does not work online).

But: md-raid1 mirroring is way faster than pvmove - and will lead to the new layout almost without service interruption.

share|improve this answer
    
Interesting approach. I wonder if a similar one realized with LVM mirroring, or even more low-level dm-mirror would work without interruption? Anyways, I take this as a "no" to my original question: no re-striping without workarounds. –  korkman Oct 22 '11 at 10:27
    
BTW I have drbd in place on top of LVM, so in fact I can re-stripe without downtime. Only that one volume didn't have drbd. –  korkman Oct 22 '11 at 10:29
    
How did you do that with drbd? Did you change the backend device online? Or did you change the secondary side and then switched over? –  Nils Oct 23 '11 at 21:03
    
Come to speak of it, I didn't try that yet. I'd go for "drbdadm down /dev/drbdX" on the secondary, create a new LV, let primary overwrite secondary, put primary in diskless mode, then sync back secondary to primary. –  korkman Oct 23 '11 at 21:13
    
BTW - you could propably do the above steps online if you assign the md-device to your VG and then pvmove to that md. –  Nils Oct 24 '11 at 20:54

I'm afraid your best approach would be to do a full dump of the LVs within the VG; destroy the VG; recreate the VG with the new striping parameters;recreate the LVs; restore the LVs from the dump.

share|improve this answer
    
VG recreation is not necessary for new striping parameters, only LV recreation, provided the VG contains all PVs. –  korkman Oct 22 '11 at 11:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.