Skip to contentSkip to conversation

partitioned raid 5 and proper partition alignment

DISCUSSION Matthias Dahl 2 participants 4 messages Aug 8, 2009 MD RAID

lore
Share & tools
lore
#0 lore raw

Hello everyone.

I've really looked around everywhere but it is hard to find any decent information about partitioned software raid 5. If someone could please help me out that would be great. Thanks a lot in advance...

I am trying to partition a raid 5 but I cannot figure out the partition alignment. My raid has 3 disks and a chunk size of 64kib, thus a total stripe width of 192kib (data + parity). I am using sfdisk w/ sector units and I currently align everything to the stripe width size:

dreamgate ~ # sfdisk -l -uS /dev/md_d0

Disk /dev/md_d0: 485990272 cylinders, 2 heads, 4 sectors/track Units = sectors of 512 bytes, counting from 0

Device Boot Start End #sectors Id System

/dev/md_d0p1           384 314572799  314572416  83  Linux
/dev/md_d0p2     314572800 629145599  314572800  83  Linux

/dev/md_d0p3 629145600 3887922175 3258776576 83 Linux
/dev/md_d0p4 1 383 383 83 Linux

The problem is I cannot figure out how to deal with sector 0 which usually contains the mbr and partition table. So does the striping begin w/ sector 0 or w/ sector 1 because sector 0 is handled specially?

If sector 0 is not handled specially and striping starts there, my partitions above are properly aligned otherwise they are off exactly 512 byte.

Like I said, if someone could give me a hint, I'd really appreciate it.

Thanks a lot in advance,
matthew.

#1 lore raw
Quoted 10 lines · Matthias Dahl

Hello everyone.

I've really looked around everywhere but it is hard to find any decent information about partitioned software raid 5. If someone could please help me out that would be great. Thanks a lot in advance...

I am trying to partition a raid 5 but I cannot figure out the partition alignment. My raid has 3 disks and a chunk size of 64kib, thus a total stripe width of 192kib (data + parity). I am using sfdisk w/ sector units and I currently align everything to the stripe width size:

But each stripe only holds 128k of data. You have to align to that.

Quoted 6 lines

dreamgate ~ # sfdisk -l -uS /dev/md_d0

Disk /dev/md_d0: 485990272 cylinders, 2 heads, 4 sectors/track Units = sectors of 512 bytes, counting from 0

Device Boot Start End #sectors Id System

Quoted 8 lines
/dev/md_d0p1           384 314572799  314572416  83  Linux
/dev/md_d0p2     314572800 629145599  314572800  83  Linux

/dev/md_d0p3 629145600 3887922175 3258776576 83 Linux
/dev/md_d0p4 1 383 383 83 Linux

The problem is I cannot figure out how to deal with sector 0 which usually contains the mbr and partition table. So does the striping begin w/ sector 0 or w/ sector 1 because sector 0 is handled specially?

No, nothing special about sector 0. And the actual MBR would go to the component devices of your raid. Depending on the metadata version you use that could overwrite your metadata.

Quoted 7 lines

If sector 0 is not handled specially and striping starts there, my partitions above are properly aligned otherwise they are off exactly 512 byte.

Like I said, if someone could give me a hint, I'd really appreciate it.

Thanks a lot in advance,
matthew.

MfG
Goswin

#2 lore raw

Hi.

Quoted 1 line · On Saturday 08 August 2009 09:56:59 you wrote:

But each stripe only holds 128k of data. You have to align to that.

I beg to differ. There are two data chunks and one parity chunk, thus a whole stripe is 192k long if you've a 64k chunk size. If you align to 128k and you put e.g. ext4 on it with the correct fs stride and stripe-width settings, you'll probably end up with worse performance since you start in the middle of a stripe even though properly aligned to a chunk boundary. Or am I totally on the wrong track here...?!

Quoted 1 line

No, nothing special about sector 0.

So sector 0 gets striped like all the others meaning that it counts to the first 192k stripe? So in order to get everything properly stripe aligned it was correct to leave a 196.096 byte span free after sector 0.

Best regards,
matthias.

#3 lore raw
Quoted 4 lines · Matthias Dahl

Hi.

On Saturday 08 August 2009 09:56:59 you wrote:

Quoted 8 lines
Quoted 1 line

But each stripe only holds 128k of data. You have to align to that.

I beg to differ. There are two data chunks and one parity chunk, thus a whole stripe is 192k long if you've a 64k chunk size. If you align to 128k and you put e.g. ext4 on it with the correct fs stride and stripe-width settings, you'll probably end up with worse performance since you start in the middle of a stripe even though properly aligned to a chunk boundary. Or am I totally on the wrong track here...?!

Yes you are. The filesystem will never ever see the parity block of a stripe. It only ever sees the 128k data. Writing 128k data will write a full stripe of 192k to disk.

MfG
Goswin