Running VMs from NFS Datastores
Due to the 4K cluster size used by Linux servers, guest operating systems running from NFS datastores must have properly aligned partitions (at an exact multiple of 4KB). This is much more important than for iSCSI volumes, since the performance penalty from iSCSI, accessible in 512-byte sectors, affects only a small proportion of requests. For NFS, improper alignment will affect every write request.
Effect of Missalignment
For every random write (sequential performance will not be affected due to coallescing of sequential IO), ESX(i) NFS client requests the write using byte addressing, hence providing no penalty.
However, where the write is not against a 4KB boundary (or is less than 4KB), the underlying Linux kernel in the NFS server then performs a read-update-write procedure. This has the effect of providing spindle latency to writes and reduces the controller queue depth to around 1 IO, reducing performance of the array to that of a single drive.
Testing using IOMeter in a Windows VM running from a datastore provided by Debian NFS using a Dell PowerEdge 2950 Server with 6x SAS 15k disks (RAID-5) on a Perc 6i RAID controller with 256MB battery-backed write cache, 4K random write performance with 32 outstanding IOs is:
- 850 IOPS at 37ms on an aligned partition
- 200 IOPS at 160ms on a misaligned partition
Aligning Partitions in Windows
Windows prior to Vista and 2008 aligns to 63 sectors (31.5K) and hence should not be run from NFS without correcting this. Although the boot partition cannot be easily aligned, it should have minimal impact on performance provided that the VM has sufficient RAM assigned to avoid paging.
Data partitions need to be (re)created manually using diskpart:
create partition primary align=64
Aligning Partitions in Linux
Partitions must be created manually to ensure correct alignment.
- fdisk /dev/sdb (sda is first SCSI/SAS disk, sdb is second and so on, hda is the first IDE disk)
- u (to change units to sectors)
- n (for new partition)
- p (for primary)
- 1 (for first primary partition)
- 128 (to specify a starting sector of 128, i.e. 64K aligned
- [enter] (to accept default end cylinder using entire drive)
- w (to write table to disk)
Designed by sketchbooks.co.kr / sketchbook5 board skin