0

We have SW MD RAID1 on a RHEL5. RAID devices come from multipath currently.

# pvs -v --segments
    Scanning for physical volume names
  PV                              VG        Fmt  Attr PSize   PFree   Start SSize  LV                 Start Type   PE Ranges                              
  /dev/md0                        foovg    lvm2 a--   20.00G      0      0   5119 barrootlv              0 linear /dev/md0:0-5118                        
  /dev/md1                        foovg    lvm2 a--   20.00G  20.00G     0   5119                        0 free                                          
  /dev/md12                       foovg2   lvm2 a--   32.00G      0      0   8191 baru03db2lv            0 linear /dev/md12:0-8190                       
  /dev/md13                       foovg2   lvm2 a--   32.00G  15.99G     0   4097 baru03db2lv         8191 linear /dev/md13:0-4096                       
  /dev/md13                       foovg2   lvm2 a--   32.00G  15.99G  4097   4094                        0 free                                          
  /dev/md14                       foobarvg2 lvm2 a--   32.00G   7.00G     0   6400 baru06foobarelv        0 linear /dev/md14:0-6399                       
  /dev/md14                       foobarvg2 lvm2 a--   32.00G   7.00G  6400   1791                        0 free                                          
  /dev/md15                       foobarvg2 lvm2 a--   32.00G  32.00G     0   8191                        0 free                                          
  /dev/md2                        foovg    lvm2 a--   20.00G  20.00G     0   5119                        0 free                                          
  /dev/md24                       foovg5   lvm2 a--   32.00G   6.99G     0   5120 baru10db5lv            0 linear /dev/md24:0-5119                       
  /dev/md24                       foovg5   lvm2 a--   32.00G   6.99G  5120      2 baru10eprinttlv    24574 linear /dev/md24:5120-5121                    
  /dev/md24                       foovg5   lvm2 a--   32.00G   6.99G  5122   1280 baru10db5lv         5120 linear /dev/md24:5122-6401                    
  /dev/md24                       foovg5   lvm2 a--   32.00G   6.99G  6402   1789                        0 free                                          
  /dev/md27                       foobarvg5 lvm2 a--   64.00G  13.99G     0  12800 baru010archlv          0 linear /dev/md27:0-12799                      
  /dev/md27                       foobarvg5 lvm2 a--   64.00G  13.99G 12800      1 baru10eprfoobarelv  8191 linear /dev/md27:12800-12800                  
  /dev/md27                       foobarvg5 lvm2 a--   64.00G  13.99G 12801   3582                        0 free                                          
  /dev/md28                       foovg6   lvm2 a--  128.00G      0      0  32767 baru11db6lv            0 linear /dev/md28:0-32766                      
  /dev/md29                       foovg6   lvm2 a--   64.00G   1.99G     0  15873 baru11db6lv        32767 linear /dev/md29:0-15872                      
  /dev/md29                       foovg6   lvm2 a--   64.00G   1.99G 15873    510                        0 free                                          
  /dev/md30                       foobarvg6 lvm2 a--   32.00G      0      0   8191 baru011archlv          0 linear /dev/md30:0-8190                       
  /dev/md31                       foobarvg6 lvm2 a--    8.00G      0      0   2047 baru011archlv       8191 linear /dev/md31:0-2046                       
  /dev/md5                        foovg    lvm2 a--   20.00G  20.00G     0   5119                        0 free                                          
  /dev/md6                        foovg    lvm2 a--   80.00G  80.00G     0  20479                        0 free                          

Question: (just one example would be enough) how can we convert these devices to LVM mirrors online? To reach the same functionality, as with RAID1.

Assumption (but how*? and is it OK? will there be enough space?):

1. - disassemble one side of the given RAID1 device. 
2. - put the disk/partition of the disassembled RAID1 device to the given VG. 
3. - move the segments of the remaining side of the given RAID1 to the newly (one of the old side of the raid1) added disk in the VG. 
4. - remove the last remaining side in the given raid1 and put it in the VG as mirror. 

*what are the commands?

  • Remember Lt. Murphy in your plans: 0) Back up all the data. ... 5) realize that in step one you grabbed a few extra devices, or the wrong set of devices. 6) blow it all away and start from scratch. Oh, you DID validate your backups first, right? – Petro Dec 4 '15 at 18:45
  • Your assumption is about right. The wonderful thing about mirroring storage systems that can operate in degraded mode is that moving between them is comparatively painless. Backups, though, are a must. – Tom Hunt Dec 4 '15 at 20:19
1

You have the right idea. The specific commands are:

1) mdadm -fr /dev/mdxx /dev/sdXX 2) pvcreate /dev/sdXX and vgextend vgname /dev/sdXX 3) pvmove /dev/mdxx 4) mdadm --stop /dev/mdxx and pvcreate /dev/sdXX ( the other drive ) and vgextend vgname /dev/sdXX, and finally lvconvert -m 1 vg/lv for each lv you want mirrored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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