Verify A Partition is Aligned in Linux With RAID and LVM

Verification is a tricky one. My first thought was to do a series of direct-IO 4KB reads from the media and watch the blinkin-lights. If every xth read causes two drives to flash, it’s a sign of misalignment (4kb read just spanned a RAID stripe boundary). However, you’re 3000 odd miles away from the hardware so that won’t work for you.

I’m assuming your RAID stripe width is larger than the 4KB sector size. The test I thought of a bit ago is to do a stride read/write test. This is where you read/write every x 4KB sectors. Vary the offset and you can change where in the RAID stripe you’re testing. If certain offsets show different performance, I’d consider that a sign that the specific offset is spanning a RAID stripe for a 4KB operation. That would verify that XFS is aligning properly in the RAID config.

Verifying the RAID stripes are aligned correctly could be done with the same kind of stride test and keep an eye on the ‘iostat’ values for the individual drives. If you get the stride size right, you should only see activity on two drives at any given time. If the same test shows activity on all four drives, then you’ve got proof that something is misaligned.

I know for sure the storage benchmark IOZONE has the ability to do a stride test, and I’d be very surprised if the more common IOMETER couldn’t do that. The ability to use direct-IO and bypass caching and write-combining is critical to these kinds of tests, though.

Leave a Comment