Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   raid1 disk format? (http://www.linux-archive.org/centos/104113-raid1-disk-format.html)

Les Mikesell 06-10-2008 04:49 PM

raid1 disk format?
 
If you have a disk with several partitions set up as members of a raid1
md devices, can you make a dd image of that disk to replace its matching
drive with identical partitions or are there differences between the
mirrored partitions?


--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Ross S. W. Walker" 06-10-2008 04:59 PM

raid1 disk format?
 
Les Mikesell wrote:

> If you have a disk with several partitions set up as members of a raid1
> md devices, can you make a dd image of that disk to replace its matching
> drive with identical partitions or are there differences between the
> mirrored partitions?

you can 'dd' the MBR and then re-add the partitions to the raid for
resyncing with 'mdadm'.

# dd if=/dev/sda of=/dev/sdb bs=512 count=1
# mdadm /dev/md0 --add /dev/sdb1
# mdadm /dev/md1 --add /dev/sdb2

If you want to really make sure you got everything you could dd the
whole first track with:

# dd if=/dev/sda of=/dev/sdb bs=512 count=63

-Ross

__________________________________________________ ____________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Scott Silva 06-10-2008 05:33 PM

raid1 disk format?
 
on 6-10-2008 9:59 AM Ross S. W. Walker spake the following:

Les Mikesell wrote:

If you have a disk with several partitions set up as members of a raid1
md devices, can you make a dd image of that disk to replace its matching
drive with identical partitions or are there differences between the
mirrored partitions?


you can 'dd' the MBR and then re-add the partitions to the raid for
resyncing with 'mdadm'.

# dd if=/dev/sda of=/dev/sdb bs=512 count=1
# mdadm /dev/md0 --add /dev/sdb1
# mdadm /dev/md1 --add /dev/sdb2

If you want to really make sure you got everything you could dd the
whole first track with:

# dd if=/dev/sda of=/dev/sdb bs=512 count=63

-Ross


Or sfdisk -d /dev/sdX | sfdisk /dev/sdY
where x is source and y is the target.
This will work across drives that have slight geometry differences.

--
MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Les Mikesell 06-10-2008 06:20 PM

raid1 disk format?
 
Scott Silva wrote:


If you have a disk with several partitions set up as members of a
raid1 md devices, can you make a dd image of that disk to replace its
matching drive with identical partitions or are there differences
between the mirrored partitions?


you can 'dd' the MBR and then re-add the partitions to the raid for
resyncing with 'mdadm'.

# dd if=/dev/sda of=/dev/sdb bs=512 count=1
# mdadm /dev/md0 --add /dev/sdb1
# mdadm /dev/md1 --add /dev/sdb2

If you want to really make sure you got everything you could dd the
whole first track with:

# dd if=/dev/sda of=/dev/sdb bs=512 count=63

-Ross


Or sfdisk -d /dev/sdX | sfdisk /dev/sdY
where x is source and y is the target.
This will work across drives that have slight geometry differences.


What I was hoping to do was to take the grub setup, the partitioning
info and the contents in one shot and have the disks pair automatically
when booted. They didn't - but I think the other parts worked.


Now, is there a way to change the uuid on a running raid1 set? I'd
prefer that if the split and re-paired disks ever find their way back to
the same machine that they not sync again.


--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Ross S. W. Walker" 06-10-2008 06:50 PM

raid1 disk format?
 
Les Mikesell wrote:

> Scott Silva wrote:
> >
> >>> If you have a disk with several partitions set up as members of a
> >>> raid1 md devices, can you make a dd image of that disk to replace its
> >>> matching drive with identical partitions or are there differences
> >>> between the mirrored partitions?
> >>
> >> you can 'dd' the MBR and then re-add the partitions to the raid for
> >> resyncing with 'mdadm'.
> >>
> >> # dd if=/dev/sda of=/dev/sdb bs=512 count=1
> >> # mdadm /dev/md0 --add /dev/sdb1
> >> # mdadm /dev/md1 --add /dev/sdb2
> >>
> >> If you want to really make sure you got everything you could dd the
> >> whole first track with:
> >>
> >> # dd if=/dev/sda of=/dev/sdb bs=512 count=63
> >>
> >> -Ross
> >>
> > Or sfdisk -d /dev/sdX | sfdisk /dev/sdY
> > where x is source and y is the target.
> > This will work across drives that have slight geometry differences.
>
> What I was hoping to do was to take the grub setup, the partitioning
> info and the contents in one shot and have the disks pair automatically
> when booted. They didn't - but I think the other parts worked.
>
> Now, is there a way to change the uuid on a running raid1 set? I'd
> prefer that if the split and re-paired disks ever find their way back to
> the same machine that they not sync again.

'mdadm' writes a listing of the devices in the array to the md
superblock and orders them by number,major,minor. You cannot add
another device to the array with the same tuple.

If you dd the first sector of the drive though you will duplicate
the partition table and grub boot loader to the other drive. Then
md-device-mapper will take care of copying the data over.

-Ross

__________________________________________________ ____________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Les Mikesell 06-11-2008 05:41 PM

raid1 disk format?
 
Ross S. W. Walker wrote:


If you have a disk with several partitions set up as members of a
raid1 md devices, can you make a dd image of that disk to replace its
matching drive with identical partitions or are there differences
between the mirrored partitions?

you can 'dd' the MBR and then re-add the partitions to the raid for
resyncing with 'mdadm'.

# dd if=/dev/sda of=/dev/sdb bs=512 count=1
# mdadm /dev/md0 --add /dev/sdb1
# mdadm /dev/md1 --add /dev/sdb2

If you want to really make sure you got everything you could dd the
whole first track with:

# dd if=/dev/sda of=/dev/sdb bs=512 count=63

-Ross


Or sfdisk -d /dev/sdX | sfdisk /dev/sdY
where x is source and y is the target.
This will work across drives that have slight geometry differences.
What I was hoping to do was to take the grub setup, the partitioning
info and the contents in one shot and have the disks pair automatically
when booted. They didn't - but I think the other parts worked.


Now, is there a way to change the uuid on a running raid1 set? I'd
prefer that if the split and re-paired disks ever find their way back to
the same machine that they not sync again.


'mdadm' writes a listing of the devices in the array to the md
superblock and orders them by number,major,minor. You cannot add
another device to the array with the same tuple.


Isn't this updated at detect time so the device minor's should always be
different?



If you dd the first sector of the drive though you will duplicate
the partition table and grub boot loader to the other drive. Then
md-device-mapper will take care of copying the data over.


I'm curious as to why 2 complete dd'd copies don't pair at boot. One
comes up running and it does work to mdadm --add the partner partitions
and after the resync they do automatically pair at boot.


--
Les Mikesell
lesmikesell@gmail.com

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Scott Silva 06-11-2008 06:06 PM

raid1 disk format?
 
on 6-11-2008 10:41 AM Les Mikesell spake the following:

Ross S. W. Walker wrote:


If you have a disk with several partitions set up as members of a
raid1 md devices, can you make a dd image of that disk to replace
its matching drive with identical partitions or are there
differences between the mirrored partitions?

you can 'dd' the MBR and then re-add the partitions to the raid for
resyncing with 'mdadm'.

# dd if=/dev/sda of=/dev/sdb bs=512 count=1
# mdadm /dev/md0 --add /dev/sdb1
# mdadm /dev/md1 --add /dev/sdb2

If you want to really make sure you got everything you could dd the
whole first track with:

# dd if=/dev/sda of=/dev/sdb bs=512 count=63

-Ross


Or sfdisk -d /dev/sdX | sfdisk /dev/sdY
where x is source and y is the target.
This will work across drives that have slight geometry differences.
What I was hoping to do was to take the grub setup, the partitioning
info and the contents in one shot and have the disks pair
automatically when booted. They didn't - but I think the other parts
worked.


Now, is there a way to change the uuid on a running raid1 set? I'd
prefer that if the split and re-paired disks ever find their way back
to the same machine that they not sync again.


'mdadm' writes a listing of the devices in the array to the md
superblock and orders them by number,major,minor. You cannot add
another device to the array with the same tuple.


Isn't this updated at detect time so the device minor's should always be
different?



If you dd the first sector of the drive though you will duplicate
the partition table and grub boot loader to the other drive. Then
md-device-mapper will take care of copying the data over.


I'm curious as to why 2 complete dd'd copies don't pair at boot. One
comes up running and it does work to mdadm --add the partner partitions
and after the resync they do automatically pair at boot.


Are they dd copies of the different nodes (IE.. dd copy of sda paired with dd
copy of sdb)?



--
MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Ross S. W. Walker" 06-11-2008 06:45 PM

raid1 disk format?
 
Les Mikesell wrote:

<snip>

> > 'mdadm' writes a listing of the devices in the array to the md
> > superblock and orders them by number,major,minor. You cannot add
> > another device to the array with the same tuple.
>
> Isn't this updated at detect time so the device minor's
> should always be
> different?
>
> > If you dd the first sector of the drive though you will duplicate
> > the partition table and grub boot loader to the other drive. Then
> > md-device-mapper will take care of copying the data over.
>
> I'm curious as to why 2 complete dd'd copies don't pair at boot. One
> comes up running and it does work to mdadm --add the partner partitions
> and after the resync they do automatically pair at boot.

Gosh darn it Les your just too damn inquisitive!

Well for the sake of the truth, the whole truth, and you know the rest.

Let me dig around here, hmmm, ok, not here, ok here we go:

/usr/src/kernels/2.6.18-53.1.21.el5-x86_64/include/linux/raid/md_p.h

Ok, looking at the comments, it seems...

/*
* RAID superblock.
*
* The RAID superblock maintains some statistics on each RAID configuration.
* Each real device in the RAID set contains it near the end of the device.
* Some of the ideas are copied from the ext2fs implementation.
*
* We currently use 4096 bytes as follows:
*
* word offset function
*
* 0 - 31 Constant generic RAID device information.
* 32 - 63 Generic state information.
* 64 - 127 Personality specific information.
* 128 - 511 12 32-words descriptors of the disks in the raid set.
* 512 - 911 Reserved.
* 912 - 1023 Disk specific descriptor.
*/

The last part of the superblock contains a disk specific descriptor,
identifier (whatever), and the middle contains a list of all the
disk descriptors participating in the RAID set. (there can only be
12 disks max in a raid set? that's news to me, maybe the comment
is old, if you combine the reserved area you can get 24 disks).

>From this we can observe that when the disks are identified as
auto-raid and their superblocks are read it tells them what RAID
they belong to and their order in the array.

What happens if a duplicate descriptor is encountered? And how
does it determine which disk is the "official" disk?

I have yet to find those answers, but let me hypothesis that it
ejects either a) the disk with the oldest timestamp, or b) the
disk with the odd checksum out of the array.

To find out the real truth will need some detailed MD RAID docs
which I am having trouble finding or the sources which I cannot
be bothered/don't have time to download and audit right now.

-Ross

__________________________________________________ ____________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Les Mikesell 06-12-2008 06:36 AM

raid1 disk format?
 
Scott Silva wrote:



I'm curious as to why 2 complete dd'd copies don't pair at boot. One
comes up running and it does work to mdadm --add the partner
partitions and after the resync they do automatically pair at boot.


Are they dd copies of the different nodes (IE.. dd copy of sda paired
with dd copy of sdb)?


No - what was sda was dd'd twice with the dups put in sda and sdb.

--
Les Mikesell
lesmikesell@gmail.com



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Scott Silva 06-12-2008 05:07 PM

raid1 disk format?
 
on 6-11-2008 11:36 PM Les Mikesell spake the following:

Scott Silva wrote:



I'm curious as to why 2 complete dd'd copies don't pair at boot. One
comes up running and it does work to mdadm --add the partner
partitions and after the resync they do automatically pair at boot.


Are they dd copies of the different nodes (IE.. dd copy of sda paired
with dd copy of sdb)?


No - what was sda was dd'd twice with the dups put in sda and sdb.

That is why it didn't work. The superblock knows which drive it was on, and
knows if there are dupes.


--
MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


All times are GMT. The time now is 10:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.