Optimales Raid-Array auf Centos 6

1738
Mark Elthof

Ich habe 4x2TB-Festplatten und möchte ein leistungsfähiges RAID5-Array erstellen (Server ist ein HP N40L-Microserver mit 8 GB RAM, der von einer 64 GB-SSHD bootet). Das Betriebssystem ist Centos 6.3, x86_64.

Ich habe das Raid-Array mit diesem Befehl erstellt:

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 

Wenn ich dann mache:

mdadm --examine /dev/sda1 

... Mir wurde gesagt, dass "Chunk Size" 512K beträgt (anscheinend ist dies der neue Standardwert von mdadm).

Jetzt möchte ich das Array mit XFS formatieren. Mir wird gesagt (bei http://www.mythtv.org/wiki/Optimizing_Performance#Optimizing_XFS_on_RAID_Arrays ), dass "sunit" gleich meiner Chunk-Größe ist, ausgedrückt als eine Anzahl von 512-Byte-Blöcken. In meinem Fall 512KB = 1024 512-Byte-Blöcke. In ähnlicher Weise ist "swidth" die Anzahl der effektiven Festplatten in meinem Array. In meinem Fall habe ich 4 Festplatten in RAID 5, also 3 effektive Platten, und 3x1024 = 3072. Daher formatierte ich mein neues Array mit dem Befehl:

mkfs.xfs -b size=4096 -d sunit=1024,swidth=3072 /dev/md0 

Ich habe jetzt zwei Fragen. Der obige Befehl gab mir diesen Fehler:

mkfs.xfs -b size=4096 -d sunit=1024,swidth=3072 /dev/md0 log stripe unit (524288 bytes) is too large (maximum is 256KiB) log stripe unit adjusted to 32KiB [...] 

... und ich möchte wissen, ob das bedeutet, dass ich etwas falsch gemacht habe oder ob ich auf irgendeine Weise mit einem suboptimalen Dateisystem enden werde oder ob ich diesen Fehler aus irgendeinem Grund einfach ignorieren kann.

Die zweite Frage ist einfach, ob ich die XFS-Parameter richtig berechnet habe oder ob ich den falschen Baum vollständig aufgebellt habe (wenn es hilft, speichert das Array zum größten Teil große Musik- und Videodateien). Habe ich beispielsweise "Stückgröße" und "Streifengröße" verstanden? Ist die Blockgröße von 4096 in meinem mkfs-Befehl optimal? Und so weiter.

Ich würde mich über einen Ratschlag freuen.

2

1 Antwort auf die Frage

1
suprjami

XFS doesn't support stripe units larger than 256k, so just re-make your RAID array with a 256k stripe. This is the --chunk parameter of mdadm.

A 4k block size might be too small for your intended usage. If you were storing lots of small files then 4k would probably be more ideal. XFS can go right up to 64k blocks. It's quicker to read and write contiguous blocks, but you lose some space to overhead of larger block sizes.

You can only allocate in blocks, so select your block size based on the size of the files you expect to be dealing with. With a 4k block size, a file of size 1kb takes up 4kb of space (1 block), and a file of size 65kb takes up 68kb of space (17 blocks). With a 64kb block size, a file of size 1kb takes up 64kb (one block) and a file of size 65kb takes up 128kb (2 blocks).

If you're dealing in small files then you'll waste a lot of space with a large block size. If you're dealing in hundreds-of-gigabyte video files then you probably don't care about 64kb here or there, and the performance advantage of the larger block size makes more of a difference.

One other thing to understand is Allocation Groups. Each AG gets a separate IO thread. The XFS allocator tries to put each directory in a different AG. A basic theory is one AG per physical device.

Have a read of the XFS documentation and come to understand how the filesystem is built:

Make some educated guesses and decide what factors are most important to you. Get some files which represent your production data (or a copy of the actual production data) and run some benchmarks on what is important to you. Pick a metric like how quickly does your video or audio software read and write files based on different block sizes? How does having multiple audio/video engineers concurrently accessing files affect throughput with different AGs?

XFS is designed for massive hundreds-of-terabytes filesystems, living on SANs worth more than a house, storing massive uncompressed media files like professional movie studios would need. If you're using this to store your pirated music and TV shows on a cheap Linux box then just use ext4, it'll be much easier to troubleshoot and fix if you ever run into problems.