[mdlug] Linux VMs - virtual disk best practices

Dan Pritts danno at dogcheese.net
Fri Mar 22 10:35:50 EDT 2013


On Mar 22, 2013, at 1:14 AM, Aaron Kulkis <akulkis00 at gmail.com> wrote:

> Michael ORourke wrote:
>> Which brings up the next logical question: how do you know if your virtual disks needs re-aligning?
>> 
> 
> 
> You should properly align the storage when you set up the system.
> 
> Re-alignment is what is done after someone not-quite-competent has set up the system.
> 
> How do you know?  You basically have to wade through the disk, volume, and partition
> data and look to see if proper boundary numbers are used.
> Currently, divisibility by 4 is ALWAYS a good thing.


I don't know a way to detect bad alignment other than seeing poor performance, or wading in like Aaron suggests doing in the first place.

In practice, though, I have not seen issues with virtual *disks* being out of alignment.  Could be an issue though, in a linux hypervisor environment where your virtual disks are on a local filesystem that is not on a properly aligned partition.

So really, the biggest problem that you are likely to see is partition alignment; whether it is the alignment of the filesystem that holds the virtual disks, or the alignment of the partitions on the virtual disks.  the old DOS default that we inherited was to start on the 63rd 512B sector; that's not so good.  

This is an issue on modern individual hard disks too; new large disks use 4KB sectors.  Make sure any filesystems you create use 4K or larger block sizes, and that your filesystems end up on 4K boundaries.  

The current rule of thumb for partition layout is to have your first partition start at 1MB into the disk.  That seems pretty safe to me.  Doesn't really fix any issues on the underlying storage, though. 

You might look at your raid striping.  In RAID0/4/5/6/10 systems, how big is the chunk on each disk?  How many disks are there?  Ideally, you'd want each virtual disk to start on a raid stripe boundary.  So if you have 128K stripe width and a 6-disk raid5, take away a parity disk, mutliply 5x128K, you want to have boundaries on multiples of 640KB.  I have never bothered to do this, myself, but in theory it might be worth it.  You would ideally also want to tell your filesystem about this geometry.  XFS has mount options that will let you tell it this info; dunno about others.

Ideally you would tune your stripe width for your expected I/O patterns too.  I do not know enough about that to make any intelligent suggestions.  I guess the smaller your expected average I/O the smaller your stripe width should be.  

danno


More information about the mdlug mailing list