Optimization XFS on Linux guest in Hyper-V (VHDX)

Solution 1:

I understand that your backing storage may change and you may not have knowledge of the underlying hardware. The following is pretty safe for me in virtualized environments:

Today, my XFS creation and mount options look like:

mkfs.xfs -f -l size=256m,version=2 -s size=4096 /dev/sdX

Where "sdX" is the device name. That's a 256 Megabyte log and a 4k sector size.

Mount options are typically:

noatime,logbufs=8,logbsize=256k,nobarrier

Those are no access-time, no write barriers, and modified log buffer/block sizes.

Using a modern OS, make sure that your partitions are aligned. Using fdisk, change your display units to sectors. Heed the warning:

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

A properly aligned partition under RHEL6:

Disk /dev/zd32: 644.2 GB, 644245094400 bytes
13 heads, 12 sectors/track, 8065969 cylinders, total 1258291200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 8192 bytes
I/O size (minimum/optimal): 8192 bytes / 8192 bytes
Disk identifier: 0x04d26b4d

     Device Boot      Start         End      Blocks   Id  System
/dev/zd32p1            2048  1258291199   629144576   83  Linux