* Re: mdadm: which device set as source to mirror?
[not found] ` <17188.44497.481437.390441@cse.unsw.edu.au>
@ 2005-09-11 23:07 ` Changsen Xu
2005-09-11 23:39 ` Neil Brown
2005-09-11 23:22 ` Changsen Xu
1 sibling, 1 reply; 3+ messages in thread
From: Changsen Xu @ 2005-09-11 23:07 UTC (permalink / raw)
To: Neil Brown, linux-raid
Thanks for your quick response.
It won't matter if I want to use 2 blank partitions to build RAID1;
But now I wish to use mdadm to backup my /home partition, which
already has tons of files on it;
If mdadm happens to choose the other blank partition as source
to do mirroring, all my data on /home will be lost;
Hardware RAID always allows me to choose which partition/drive
to be used as source.
Regards,
On Mon, 2005-09-12 at 08:21 +1000, Neil Brown wrote:
> On Sunday September 11, xucs007@yahoo.com wrote:
> > Dear Neil Brown,
> >
> > I'm trying to learn how to use your great mdadm,
> > one thing I'm not quite sure, and couldn't find
> > any clue in your man page, is,
> >
> > During create or assemble mode, for RAID1, which
> > device mdadm uses as source to make the mirroring?
> > Is there any differences to determine it
> > for situations of same-size devices and different-size
> > devices (>1% differences) ?
>
> I think it copies from the smallest numbered working drive (i.e. drive
> 0 if that is working, else drive 1, etc). However it really
> shouldn't matter to you. If you are doing something that depends on
> having the right answer to this, you are probably doing it the wrong
> way.
>
> If you would like to discuss it further, I suggest explaining what you
> want to do, and why you think you need to know this, to
> linux-raid@vger.kernel.org.
>
> NeilBrown
>
--
Changsen Xu
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: mdadm: which device set as source to mirror?
2005-09-11 23:07 ` mdadm: which device set as source to mirror? Changsen Xu
@ 2005-09-11 23:39 ` Neil Brown
0 siblings, 0 replies; 3+ messages in thread
From: Neil Brown @ 2005-09-11 23:39 UTC (permalink / raw)
To: Changsen Xu; +Cc: linux-raid
On Sunday September 11, xucs007@yahoo.com wrote:
> Thanks for your quick response.
>
> It won't matter if I want to use 2 blank partitions to build RAID1;
>
> But now I wish to use mdadm to backup my /home partition, which
> already has tons of files on it;
You probably don't want to do that. Normally a raid1 array created by
mdadm is slightly smaller than the original device, to allow room for
some metadata. If you create a raid1 using a device with an existing
filesystem, you will probably corrupt that filesystem - though it may
be possible to 'resize' it a few hundred Kilobytes smaller first.
>
> If mdadm happens to choose the other blank partition as source
> to do mirroring, all my data on /home will be lost;
If this really is something you want to do (e.g. you do shrink the
filesystem first, or you use --build to make an array without metadata
(not recommended unless you really know what you are doing)), then
the thing to do is create the array with only one active device, and
one 'missing' device. Thus the data on the active device will have to
be the data using in the array. Then you hot-add the drive that you
want data to be copied on to.
When you hot-add a spare to an array, you can be certain that data
will be copied ONTO it, not OFF OF it.
However the recommended approach is to create a degraded array using
the new drive, make a filesystem there-on, copy the data, and once you
are sure the data is safe, add the original drive as a spare to the
new array.
e.g. assuming sda1 has your /home and sdb1 is the same size:
mdadm --create /dev/md1 --level=1 -n2 missing /dev/sdb1
mkfs /dev/md1
mount /dev/md1 /mnt
cp -a /home /mnt
# convince yourself that the copy was successful
umount /mnt
umount /home
mount /dev/md1 /home
# convince yourself again that /home is good
mdadm /dev/md1 --add /dev/sda1
# update /etc/fstab and /etc/mdadm.conf as required
>
> Hardware RAID always allows me to choose which partition/drive
> to be used as source.
Probably because customers ask for it and hardware manufacturers think
it is good to give customers what they want.
I prefer to tell customers what they need :-)
NeilBrown
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mdadm: which device set as source to mirror?
[not found] ` <17188.44497.481437.390441@cse.unsw.edu.au>
2005-09-11 23:07 ` mdadm: which device set as source to mirror? Changsen Xu
@ 2005-09-11 23:22 ` Changsen Xu
1 sibling, 0 replies; 3+ messages in thread
From: Changsen Xu @ 2005-09-11 23:22 UTC (permalink / raw)
To: Neil Brown, linux-raid
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Software-RAID-HOWTO.html#ss7.6
Look, RAIDTOOLS clearly stated source is "raid-disk 0", but your
current mdadm has no specifications on this matter. Maybe
one more command line switch, such as "--source /dev/hdb3",
can be added to your next release?
Regards,
On Mon, 2005-09-12 at 08:21 +1000, Neil Brown wrote:
> On Sunday September 11, xucs007@yahoo.com wrote:
> > Dear Neil Brown,
> >
> > I'm trying to learn how to use your great mdadm,
> > one thing I'm not quite sure, and couldn't find
> > any clue in your man page, is,
> >
> > During create or assemble mode, for RAID1, which
> > device mdadm uses as source to make the mirroring?
> > Is there any differences to determine it
> > for situations of same-size devices and different-size
> > devices (>1% differences) ?
>
> I think it copies from the smallest numbered working drive (i.e. drive
> 0 if that is working, else drive 1, etc). However it really
> shouldn't matter to you. If you are doing something that depends on
> having the right answer to this, you are probably doing it the wrong
> way.
>
> If you would like to discuss it further, I suggest explaining what you
> want to do, and why you think you need to know this, to
> linux-raid@vger.kernel.org.
>
> NeilBrown
>
--
Changsen Xu
^ permalink raw reply [flat|nested] 3+ messages in thread