linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to grow RAID1 mirror on top of LVM?
@ 2008-03-13 11:21 Anton Altaparmakov
  2008-03-25  5:36 ` Neil Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Anton Altaparmakov @ 2008-03-13 11:21 UTC (permalink / raw)
  To: linux-raid

Hi,

We have Software RAID1 (MD) mirrors on top of LVM volumes so that we  
can grow the LVM volumes if we need one of the mirrors to grow and  
then use mdadm --grow to grow the mirror followed by using xfs_growfs  
to grow the xfs file system mounted on the mirror.  Thus we can extend  
the size of the mirrored file system without having to unmount it  
which is great.  This is what should happen in an ideal world anyway.

In reality it does not work.  )-:  This is perhaps because mdadm does  
not realize the underlying devices have grown (using lvextend) and  
therefore running:

mdadm --grow /dev/md3 --size max

Does not do anything.

And if I do:

mdadm /dev/md3 --fail /dev/vg/volume2
mdadm /dev/md3 --remove /dev/vg/volume2
mdadm /dev/md3 --add --write-mostly /dev/vg/volume2

This fails because MD complains that no superblocks are found on the  
array or something like that.  )-:  Perhaps it has noticed that the  
devices are bigger and now cannot find the MD super block as it is no  
longer at the end of the device or something like that, not sure.

The only working way I have found to do what we want is to --fail & -- 
remove one device, then grow it with lvextend, then add it back to the  
mirror.  BUT this causes a full resync because it does not detect that  
the device was part of the mirror before and no resync is thus  
needed.  Again, I assume because the MD superblock is now in the  
middle of the volume instead of at the end.

I then have to wait for the resync to finish and then I have to remove  
the other mirrored device with --fail & --remove, then lvextend that,  
and then I can add it back to the mirror which AGAIN triggers a full  
resync as before.

I then have to wait for the resync to finish and then I finally can  
grow the mirror using:

mdadm --grow /dev/md3 --size max

And it works this time.

As a small shortcut, I can do the mdadm --grow after the first resync  
is complete (see above), after breaking the mirror for the second  
time, then the md3 device is grown with just one member device.  Then  
I add the extended other mirror target to the array with --add and  
that then does a full resync on the already grown mirror.

So to grow a raid mirror takes ages because of the resync times when  
you have large arrays!

Is there a better way to do this?  I am hoping someone will tell me to  
use option blah to utility foo that will do this for me without having  
to break the mirror twice and resync each time.  (-;

If not, please consider this a feature request for mdadm.  (-:  It  
should have an option to detect that the underlying device has grown  
and thus write a new superblock  (or move the old one or whatever) at  
the end of the newly grown device instead of complaining that it does  
not exist.  Or something!  As it is, it is incredibly time consuming  
and inefficient.  )-:

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/


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

end of thread, other threads:[~2008-05-06 12:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 11:21 How to grow RAID1 mirror on top of LVM? Anton Altaparmakov
2008-03-25  5:36 ` Neil Brown
2008-03-25  8:00   ` Anton Altaparmakov
2008-04-28 14:25   ` Lars Täuber
2008-04-28 15:09     ` David Lethe
2008-04-29  7:55       ` Lars Täuber
2008-04-29 13:21         ` David Lethe
2008-05-02  3:14     ` Neil Brown
2008-05-02  7:23       ` Lars Täuber
2008-05-02 15:06       ` Russ Hammer
2008-05-04 11:20         ` Neil Brown
2008-05-05  7:10           ` Lars Täuber
2008-05-06 12:34           ` Russ Hammer

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).