LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   resync in Partitionable RAID 5. (https://www.linuxquestions.org/questions/linux-general-1/resync-in-partitionable-raid-5-a-373163/)

FinalFantasy 10-14-2005 07:09 PM

resync in Partitionable RAID 5.
 
Hello,

I got three disks and have a RAID 5 on them.

mdadm -C -l 5--auto=p -c 1024 -p ls -n 3 /dev/md_d0 /dev/sd{a,c,c}

and /proc/mdstat shows

md_d0: active raid5 sdc[3] sdb[1] sdc[0]
xxxx blocks..........balabala....

Say I have two partitions on the md_d0 and they are md_d0p1 and md_d0p2.

Now, I want to know, in case md_d0p1 gets dirty, does the resync occur on the whole md_d0 or just md_d0p1?

Do I make my question clear? I am not sure whether I got the right point or not.


Regards,
William

MensaWater 10-14-2005 10:05 PM

Basically you have data bits and a parity bit spread across the 3 drives. If a data bit is seen to be bad then it will use the remaining data bit and the partiy bit to recreate the missing data bit. If a parity bit goes bad it will use the two data bits to recalculate the parity and recreate that.

The parity is spread across the disks so that your block of data might have data data parity and your next data parity data and your next parity data data etc...

Typically the only time you really see any kind of "resync" is if one of the drives goes bad and gets replaced. After you replace the bad drive it will rebuild all the missing bits on the replaced drive which as noted above will be some data and some parity.

In that case all your partitions would be affected because some part of each of them will be spread across the 3 drives. The only way to avoid this would be to have a separate RAID set comprised of completely different drives than the first RAID set.

Note by "bit" above I just mean a piece (block/stripe) rather than the technical term "bit".

FinalFantasy 10-14-2005 10:12 PM

Thanks for the reply.

Talking like disk replacement. I know that will activate the resync for the whole disk.

But, for example, I only mount the first partition md_d0p1, and in the middle of an operation I press reset button. Now what will happen to md_d0p2? will it be excluding from resyncing or the resync will happen to the whole md_d0?

MensaWater 10-15-2005 08:43 AM

Resync deals with making data and parity bits agree. So although it might "resync the whole disk" in point of fact the only writes ought to be for the data or parity bits that are incorrect. It depends much on implementation.

Of course the above assumes your theoretical "reset" only corrupted one of the 3 bits for a given piece of data. If it was disruptive enough to harm 1 bit on 1 disk there is no reason to assume it wouldn't disrupt 2 bits on 2 disks and if they're the same stripe you're hosed because it doesn't have enough information to recreate that stripe.

However GENERALLY reset/hard power downs are more likely just to cause the filesystem (a structure laid out on top of disks or RAID sets) to just mark the filesystem as needing an fsck. If you have a non-journaling filesystem and corrupt the superblock and don't have any copies that are uncorrupted then you're hosed even if the RAID 5 itself is still intact. The number of times I've seen a power off event corrupt a filesystem to the point of irrecoverability in 15 years of Unix/Linux administration can be counted on one hand. In fact recently I had a laptop get fried by a lightning strike and simply moving its hard drive to another laptop got me up and going in short order because the drive itself was unaffected. You are more likely to experience a whole disk failure than one bad bit of data and usually its a mechanical/electrical failure within the drive itself rather than an external event.

Having said that though you really do NOT want to be doing a reset or leaving your system off UPS. If its important enough to you to have 3 disks and RAID 5 its probably important enough to do basic power protection. The UPS not only allows you to survive low power or power outage situations but usually has line conditioning to avoid power spikes.

FinalFantasy 10-15-2005 09:02 AM

Thanks for the advice.

I am just a fan and like to try new stuff. I just bought some new drives and this is the best time to try RAID.:).


All times are GMT -5. The time now is 03:42 AM.