I have 4 2.5" 7.2k drives lying about and I'd like to build some RAID arrays for a bit of VM storage on my KVM lab box.

There are 2x 320GB drives and 2x 500GB drives. I'm looking to create a RAID 10 array using 4x 320GB partitions. Then the remaining 180GB on the 500GB drives I'll build into a RAID 5 partition with another spare drive. I realise that performance will take a hit because half of the drives in the RAID 10 array will be used by another array and using non-matched drives is also not-optimal but this is solely for a lab/test environment.

Initially I thought I would just create 4 matching partitions, create the RAID 10 array, LVM on top and done. But I started looking into all this sector alignment business and now I don't really know where to start.

The 320GB drives report Sector size (logical/physical): 512 bytes / 512 bytes
The 500GB drives report Sector size (logical/physical): 512 bytes / 4096 bytes

So there are the following variables that I would need to take into account: partition start/alignment, RAID stripe size, RAID superblock position (?), LVM PV --dataalignment, then alignment of any file systems in my LVs.

Is anyone able to run through what I'd need to do in this specific case to get optimal alignment/sector/stripe size?

Please try and ignore the fact that the mixed drives mean the whole thing isn't optimal to start with, as I said, this is a test/lab environment.

  • Just align everything to 4k blocks. – Zoredache Feb 14 '14 at 1:01
  • Ok, yes. But things like the RAID superblock being at the beginning of the partition and the LVM meta data which can push things off further... do I need to factor those in? And how do I factor those in? – batfastad Feb 14 '14 at 1:27

In short, you don't need to worry about it as long as you aren't using really old software. Partitioning tools were patched years ago to align partitions to 1 MiB boundaries so they will be properly aligned. mdadm and lvm also will automatically take care of the alignment.

| improve this answer | |
  • Ok, so I really don't need to bother with askubuntu.com/a/19572 and the LVM alignment here... tytso.livejournal.com/2009/02/20 Is there any definitive documentation to support this? – batfastad Feb 14 '14 at 11:31
  • @benbradley, the official lvm docs I suppose. The raid array exposes its stripe width in sysfs via the optimal_io_size attribute, and lvm uses that as the default --dataalignment value. Oh, and fyi, if you want a better performing raid10 array, use the offset layout with a large ( 8M ) chunk size. You get the sequential read performance of raid0. – psusi Feb 14 '14 at 15:02
  • Ok this is interesting, thanks for the info. 8M does seem large though, most docs I've read on this over the last couple of days only mention chunk sizes of <=1024K – batfastad Feb 16 '14 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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