ICT-Freak.nl has a nice post on hot-adding & hot-removing VMDKs from a Linux virtual machine. However, like most guides out there, it doesn’t mention the number one thing you need to do for optimal disk I/O: align your partitions.
Logical Block Addressing is a common addressing scheme for disks on PCs. However, under this scheme the master boot record causes partitions to start at a block that isn’t a power of 2. This isn’t a huge deal for individual disks, but for shared storage where a LUN is actually striped across many different disks a single read or write by the guest OS causes twice as much I/O on the storage array. The misaligned partition has blocks that straddle the stripes on the array, and instead of reading a single stripe the array has to read from, or write to, two stripes. This isn’t a big problem on one or two VMs, but when hundreds of VMs have misaligned I/O the effect is crippling.
The fix for the blog post in question is just another set of fdisk commands. After creating the partition, but before exiting fdisk:
Command (m for help): x Expert command (m for help): b Partition number (1-4): 1 New beginning of data (63-401624, default 63): 128 Expert command (m for help): w Expert command (m for help): q
Ta-dum! You get all your I/O performance. Giving Mr. Fokkema the benefit of the doubt it’s possible he doesn’t need to do this in his example setup. You might need to do it in your production setup, though, and you should follow the instructions of your disk array vendor. Chances are that if you’re using shared storage this is an important step for you. Don’t overlook it!