Skip to contentSkip to conversation

RAID5/10 chunk size and ext2/3 stride parameter

DISCUSSION martin f krafft 2 participants 5 messages Oct 24, 2006 – Nov 17, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

I cannot find authoritative information about the relation between the RAID chunk size and the correct stride parameter to use when creating an ext2/3 filesystem.

My understanding is that (block * stride) == (chunk). So if I create a default RAID5/10 with 64k chunks, and create a filesystem with 4k blocks on it, I should choose stride 64k/4k = 16.

Is the chunk size of an array equal to the stripe size? Or is it (n-1)*chunk size for RAID5 and (n/2)*chunk size for a plain near=2 RAID10?

Also, I understand that it makes no sense to use stride for RAID1 as there are no stripes in that sense. But for RAID10 it makes sense, right?

Thanks,

Signature · 8 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
"i like wagner's music better than anybody's. it is so loud that one
 can talk the whole time without other people hearing what one says."
                                                        -- oscar wilde
#1 lore raw
Quoted 5 lines · martin f krafft

Hi,

I cannot find authoritative information about the relation between the RAID chunk size and the correct stride parameter to use when creating an ext2/3 filesystem.

you know, it's interesting -- mkfs.xfs somehow gets the right sunit/swidth automatically from the underlying md device.

for example, on a box i'm testing:

# mdadm --create --level=5 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=9157232 
blks
         =                       sectsz=4096  attr=0
data     =                       bsize=4096   blocks=293031424, imaxpct=25
         =                       sunit=16     swidth=48 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=2
         =                       sectsz=4096  sunit=1 blks
realtime =none                   extsz=196608 blocks=0, rtextents=0
# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
# mdadm --zero-superblock /dev/sd[abcd]1
# mdadm --create --level=10 --layout=f2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=262144 blocks=0, rtextents=0

i wonder if the code could be copied into mkfs.ext3?

although hmm, i don't think it gets raid10 "n2" correct:

# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
# mdadm --zero-superblock /dev/sd[abcd]1
# mdadm --create --level=10 --layout=n2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=262144 blocks=0, rtextents=0

in a "near 2" layout i would expect sunit=16, swidth=32 ... but swidth=64 probably doesn't hurt.

Quoted 3 lines

My understanding is that (block * stride) == (chunk). So if I create a default RAID5/10 with 64k chunks, and create a filesystem with 4k blocks on it, I should choose stride 64k/4k = 16.

that's how i think it works -- i don't think ext[23] have a concept of "stripe width" like xfs does. they just want to know how to avoid putting all the critical data on one disk (which needs only the chunk size). but you should probably ask on the linux-ext4 mailing list.

Quoted 7 lines

Is the chunk size of an array equal to the stripe size? Or is it (n-1)*chunk size for RAID5 and (n/2)*chunk size for a plain near=2 RAID10?

Also, I understand that it makes no sense to use stride for RAID1 as there are no stripes in that sense. But for RAID10 it makes sense, right?

yep.

-dean

#2 lore raw

also sprach dean gaudet <[email protected]> [2006.11.03.2019 +0100]:

Quoted 6 lines
Quoted 3 lines

I cannot find authoritative information about the relation between the RAID chunk size and the correct stride parameter to use when creating an ext2/3 filesystem.

you know, it's interesting -- mkfs.xfs somehow gets the right sunit/swidth automatically from the underlying md device.

i don't know enough about xfs to be able to agree or disagree with you on that.

Quoted 2 lines
# mdadm --create --level=5 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.

with 64k chunks i assume...

Quoted 6 lines
# mkfs.xfs /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=9157232 
blks
         =                       sectsz=4096  attr=0
data     =                       bsize=4096   blocks=293031424, imaxpct=25
         =                       sunit=16     swidth=48 blks, unwritten=1

sunit seems like the stride width i determined (64k chunks / 4k bzise), but what is swidth? Is it 64 * 3/4 because of the four device RAID5?

Quoted 7 lines
# mdadm --create --level=10 --layout=f2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1

okay, so as before, 16 stride size and 64 stripe width, because we're now dealing with mirrors.

Quoted 7 lines
# mdadm --create --level=10 --layout=n2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1

why not? in this case, -n2 and -f2 aren't any different, are they?

Quoted 2 lines

in a "near 2" layout i would expect sunit=16, swidth=32 ... but swidth=64 probably doesn't hurt.

why?

Quoted 4 lines

that's how i think it works -- i don't think ext[23] have a concept of "stripe width" like xfs does. they just want to know how to avoid putting all the critical data on one disk (which needs only the chunk size). but you should probably ask on the linux-ext4 mailing list.

once i understand everything...

Signature · 6 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
if you find a spelling mistake in the above, you get to keep it.
#3 lore raw
Quoted 8 lines · martin f krafft

also sprach dean gaudet <[email protected]> [2006.11.03.2019 +0100]:

Quoted 6 lines
Quoted 3 lines

I cannot find authoritative information about the relation between the RAID chunk size and the correct stride parameter to use when creating an ext2/3 filesystem.

you know, it's interesting -- mkfs.xfs somehow gets the right sunit/swidth automatically from the underlying md device.

Quoted 7 lines

i don't know enough about xfs to be able to agree or disagree with you on that.

Quoted 2 lines
# mdadm --create --level=5 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.

with 64k chunks i assume...

yup.

Quoted 10 lines
Quoted 6 lines
# mkfs.xfs /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=9157232 
blks
         =                       sectsz=4096  attr=0
data     =                       bsize=4096   blocks=293031424, imaxpct=25
         =                       sunit=16     swidth=48 blks, unwritten=1

sunit seems like the stride width i determined (64k chunks / 4k bzise), but what is swidth? Is it 64 * 3/4 because of the four device RAID5?

yup.

and for a raid6 mkfs.xfs correctly gets sunit=16 swidth=32.

Quoted 19 lines
Quoted 7 lines
# mdadm --create --level=10 --layout=f2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1

okay, so as before, 16 stride size and 64 stripe width, because we're now dealing with mirrors.

Quoted 7 lines
# mdadm --create --level=10 --layout=n2 --raid-devices=4 --assume-clean --auto=yes /dev/md0 /dev/sd[abcd]1
mdadm: array /dev/md0 started.
# mkfs.xfs -f /dev/md0
meta-data=/dev/md0               isize=256    agcount=32, agsize=6104816 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=195354112, imaxpct=25
         =                       sunit=16     swidth=64 blks, unwritten=1
Quoted 1 line

why not? in this case, -n2 and -f2 aren't any different, are they?

they're different in that with f2 you get essentially 4 disk raid0 read performance because the copies of each byte are half a disk away... so it looks like a raid0 on the first half of the disks, and another raid0 on the second half.

in n2 the two copies are at the same offset... so it looks more like a 2 disk raid0 for reading and writing.

i'm not 100% certain what xfs uses them for -- you can actually change the values at mount time. so it probably uses them for either read scheduling or write layout or both.

-dean

#4 lore raw

also sprach dean gaudet <[email protected]> [2006.11.05.0359 +0100]:

Quoted 7 lines

they're different in that with f2 you get essentially 4 disk raid0 read performance because the copies of each byte are half a disk away... so it looks like a raid0 on the first half of the disks, and another raid0 on the second half.

in n2 the two copies are at the same offset... so it looks more like a 2 disk raid0 for reading and writing.

I don't know what difference that would make on the parameters of the XFS filesystem, as determined by mkfs.

Also, I doubt you can get 4 disk RAID0 disk performance with two disks, no matter what layout you choose. There are still only two disks, so you can only ever read two blocks at once.

Thanks for the info.

Signature · 8 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
"was aus liebe getan wird,
 geschieht immer jenseits von gut und böse."
                                                 - friedrich nietzsche