Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am recreating some RAID5 disks as RAID6 with mdadm. There is no data on the drives that I care about.

Setting up RAID takes a while to setup the shape - I accept that when there there is data that needs to be striped and parity calculated, however with these drives, they are empty - or at least I want them to be considered empty.

So is there a way to skip the parity calculation and tell mdadm to just set up the superblocks and be done, or otherwise, what exactly is it spending all this time on when there is no data to move around?

md3 : active raid6 sdf3[5] sde3[4] sdd3[3] sdc7[2] sdb3[1] sda3[0]
      1953114112 blocks super 1.2 level 6, 512k chunk, algorithm 2 [6/6] [UUUUUU]
      [>....................]  resync =  1.3% (6790144/488278528) finish=409.3min speed=19604K/sec

Note that I am not talking about --assume-clean where you are rebuilding an array from a pre-existing set of disks that contain a RAID array that you know is correct. I am talking about an array that should be considered empty, not considered correctly striped.

So lets say for the sake of this question that the devices have been pre-populated with zeros.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You can use --assume-clean but unless you are using raid5 ( not raid6 ) and the disks actually are full of zeros, the first time it runs a parity check, it will come up with errors that will need corrected, so you should not do this. You don't need to wait for the resync to finish before you can start using the array; it will chug along in the background until it is done.

share|improve this answer
    
Thanks psusi - this doesn't address the question. –  Paul Jun 18 '12 at 23:13
2  
@Paul, umm.. yes, it does. There is no such thing as "empty" there is only in sync, or not in sync. –  psusi Jun 19 '12 at 2:17
    
It doesn't address the question I am asking. The xor of a block of zeros is zero. So if I could tell mdadm that the space can be considered empty, it could create parity very quickly. The parity would only need to be calculated properly when a specific block is written to, at which point it doesn't matter that it was "wrong" previously. I could even actually zero the disk. –  Paul Jun 19 '12 at 3:09
1  
@Paul, again, there is no such thing as "empty". Generally yes, it won't matter that the parity on stripes that have never been written is wrong, which is why you can get away with --assume-clean, even when the disks are not full of zeroes, but the wrong parity will be detected and corrected when mdadm does a parity check. –  psusi Jun 19 '12 at 3:18
2  
@Paul, the meaning of "empty" is not well defined. Most people use it to mean they have not put any files or a filesystem on the device, and do not know or care what it currently contains. If you know the disks are all full of zeros, then --assume-clean is what you want. It will take your word for it that the disks are all zeroed and not recompute the parity, and as you mention, a parity of zero will be correct for data disks of all zeros, at least for raid5 ( not for raid6 ). –  psusi Jun 19 '12 at 3:35

You can't do this with a software or hardware RAID. All checksums need to be written on the disks, which takes time. You can do it later, but then the parts of the disk that isn't written to, will have to do that before you can use them.

This is basicly because the RAID system and file systems doesn't know a thing about each other. ZFS has a sollution for this, but there the RAID parts are deep integrated with the file system. So the RAID subsystem actually knows what parts of the disks are used to store data on and which can be used later and then write the check sums to them.

You can add throughput speed to the software RAID or you start using the RAID before all checksums are written, and let the software RAID handle this for you later. Witch is what @psusi wrote.

share|improve this answer
    
I understand how RAID works, I am trying to understand what takes place with checksums on an empty disk. Checksums need to be calculated every time something is written to disk, so calculating them before any data is present doesn't make much sense - "doing it later" is sensible when there is nothing there. There isn't a file system to consider in this scenario. –  Paul Jun 19 '12 at 1:10
4  
There's always data present. It might not be important or meaningful, but every sector always has a value. (Zero is a value too!) The RAID implementation doesn't know which sectors contain important data, so it has to treat them all as important and calculate their parity. –  Wyzard Jun 19 '12 at 4:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.