[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trying to understand assemble option in mdadm please help.



Muhammad Yousuf Khan wrote:
> Gary Dale wrote:
> > Muhammad Yousuf Khan wrote:
> >> or just one thing if you please explain these commands. i think my
> >> confusion will be cleared
> >> mdadm --assemble /dev/md1 /dev/hda1
> >> mdadm --assemble /dev/md3 /dev/hda3
> >
> > The first set of commands should give you error messages unless
> > the disk devices are actually part of the array. Assemble normally
> > doesn't need to know the disk partitions that form the array, but
> > you can list them. This could be done if the superblocks were
> > damaged, for example. You need to get the order right in that case
> > or the device may not be readable.

The first command assembles an array using only one of the devices.
This emits a "degraded" array of only one of the two mirrored devices.
This is useful in specialized instances.  It isn't the typical thing
to do.  It is sometimes useful to create a degraded array with one
disk now and then later add a second disk.  This appears to be what
you are doing across the two sets of commands.

If you assemble an array with only one disk then there is no
redundancy.  If you assemble an array with only one disk then the
array will be marked degraded and later when a second disk is added
then the array must be sync'd in order to bring it into normal
operation.  That sync'ing process may take a long time.

> > The normal command would be just mdadm --assemble /dev/md1. The
> > alternative would be to relist all the constituent devices.

Agreed.  Assembling the array with a single disk into a degraded mode
isn't typical.  But it is useful for recovery data from a failed disk
on a second system used for data recovery.

> >> mdadm --add /dev/md1 /dev/hdb1
> >> mdadm --add /dev/md3 /dev/hdb3
> >>
> >> what is the difference in both command thanks. any help will be highly
> >> appreciated.
> >
> > The second set of commands should give you error messages if the disk
> > devices are already part of the array. Add puts a new drive into the array.
> > The drive will be assumed to be dirty and a re-syncing operation will
> > commence.

Yes.  But by the combination of the two sets of commands:

> >> mdadm --assemble /dev/md1 /dev/hda1
> >> mdadm --assemble /dev/md3 /dev/hda3
> >> mdadm --add /dev/md1 /dev/hdb1
> >> mdadm --add /dev/md3 /dev/hdb3

That appears to be a less efficient way of doing this:

  mdadm --assemble /dev/md1 /dev/hda1 /dev/hdb1
  mdadm --assemble /dev/md3 /dev/hda3 /dev/hdb3

If you have two disks that you are trying to assemble into a RAID1
mirror then you should assemble both devices together at once so that
the raid array may remain in sync.

Let me guess...  If you are recovering a single disk from a two disk
mirror but with one disk failed onto a second machine then (and pretty
much only then, no other time) would the combination of commands make
sense to me.

> just one last question what do you mean by build. do you mean the sync
> which shows in "cat /proc/mdstat" and show the sync status b/w the two
> partition. does this called build?

I went looking for that "build" you referenced:

Gary Dale wrote in a previous message:
> Assemble builds the arrays based on the information contained in the
> superblock.

"Build" and "assemble" are very similar in meaning in that context.
An array must first be "created".  After an array has been created
then at future system boot times it will only be assembled (or built)
and not created again.  "Create" zeros data and starts a clean empty
block of data with any previous data destroyed.  "Assemble" or "build"
does not destroy data but activates an existing array with existing
data and makes the existing data available.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: