1 / 38

Impact of Disk Alignment in Virtualized Environments

Impact of Disk Alignment in Virtualized Environments. Grant Cohoe. Why should you care?. Performance Misalignment causes more IO’s than you need Shared Storage issues. Understand Your Stuff. Hard Disk Geometry Sector Size (Logical & Physical) Operating System What does it want?

olesia
Download Presentation

Impact of Disk Alignment in Virtualized Environments

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Impact of Disk Alignment in Virtualized Environments Grant Cohoe

  2. Why should you care? • Performance • Misalignment causes more IO’s than you need • Shared Storage issues

  3. Understand Your Stuff • Hard Disk Geometry • Sector Size (Logical & Physical) • Operating System • What does it want? • What does it do by default? • Sometimes silly things…

  4. Layers VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  5. VMFS Disk Geometry/Partitions VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  6. Terminology • Sectors • Units of disk storage • Partition • Logical group of sectors • Track • Ring of sectors on a single side of a platter • Cylinder • 3D track (all platters at one track location) VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  7. Master Boot Record (MBR) • That thing that boots your OS • First 512 bytes of the disk • 440 bytes of bootloader • 32 bytes of partition information • 4 primary partitions - max size 2TB 440 (Boot loader) 32 START VMFS 512 VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  8. Master Boot Record (MBR) • DOS Compatibility • Cannot span cylinders (because DOS was silly) • Number of sectors per cylinder = 63 • 63 – 1 (MBR) = 62 sectors before first usable • This is deprecated MBR LBA-1 LBA-62 63 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  9. Master Boot Record (MBR) • 1MB Alignment • Align all partitions to 1MB • 1MB = 1048576B / 512B sectors = 2048 (1st Sector) • Improves performance • Ensures compatibility for 4K “Advanced Format” • This is new standard (Windows Vista) MBR LBA-1 LBA-2047 2048 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  10. Resulting Disk • 512B MBR – • Alignment Space – • 1st Partition Starting Sector – • This is good! MBR 2048 2049 2050 2051 2052 2053 2054 2055 … 16777215 MBR 2048 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  11. VMFS Logical Volume Management (LVM) VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  12. Terminology • Physical Volume • Container of data stored as a partition on disk • Logical Volume • Virtualized storage structure stored as data in a PV • pe_start • LV offset within a PV VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  13. LVM Physical Volumes (LVM PV) • pe_start specifies the start of LV data • Very intelligent. Usually not a problem • Needs to be aligned to your sectors! VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  14. LVM Physical Volumes (LVM PV) • Bad • pe_start does not line up with a sector • Going to hurt performance later pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  15. LVM Physical Volumes (LVM PV) • Good • As long as pe_start is a multiple ofyour sector size (usually 512B)you’re good! pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  16. LVM Physical Volumes (LVM PV) • PE Size • Physical Extent – LVM “block” size • Usually default is fine • Multiple of sector size (512) VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  17. Resulting Volume • LV starting point aligned (pe_start) • PV aligned to sectors on disk Logical Volume pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  18. VMFS Host File System VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  19. Host File System • Not much to do here • RAID would be a different story… • Ext is good at picking sane defaults • Block size • Smallest unit of data for the filesystem VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  20. Resulting Filesystem Filesystem Logical Volume pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059

  21. VMFS VMDK Geometry & Partitions VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  22. VMDK Geometry/Partitions • Same principles as host disks • DOS compatibility sucks • 1MB alignment is good • Performance impact is bigger MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  23. VMFS VM File System VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  24. VM File System • Don’t use RAID/LVM in VMs • Unless you really need it for some reason • Or if you did a P2V VM File System MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  25. VMFS VM Alignment VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  26. Perfectly Aligned VM VM File System 2054 MBR 2048 2049 2050 2051 2052 2053 Filesystem Logical Volume pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  27. Perfectly Aligned VM VM FS Block 4096 VMDK Sectors 512 512 512 512 512 512 512 512 4096 Host FS Block 1024 1024 1024 1024 LVM PE* 512 512 512 512 512 512 512 Host Disk Blocks 512 VMFS VMDK Geometry/Partitions Host File System LVM * PE shown as 1K for example Disk Geometry/Partitions

  28. Misaligned VM 4096 512 512 512 512 512 512 512 512 4096 4096 1024 1024 1024 1024 1024 1024 1024 1024 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 • VM disk image sits across two Host FS blocks, thus requiring more reads of the host disks to get all data • 4096B of VM data requires 8192B of host disk data to read VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  29. End Goal VM File System MBR 2048 2049 2050 2051 2052 2053 Filesystem Filesystem Filesystem Filesystem Filesystem Logical Volume pe_start PV Data Region Physical Volume MBR 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 VMFS VMDK Geometry/Partitions Host File System LVM Disk Geometry/Partitions

  30. Questions? Grant Cohoe http://grantcohoe.com

  31. BONUS MATERIAL Modern Stuff

  32. Advanced Format Disks • 4K Sectors • Old: • New: • Much more efficient with todays data usage • 512e Emulation Mode • Lets old stuff still work with new disks • Logical (OS): • Physical (Disk): 64 65 66 67 68 69 70 71 8 64 65 66 67 68 69 70 71 8

  33. Advanced Format Disks & MBR • Regular disks (512 byte sectors) • LBA-63 • Advanced Format (4K sectors) w/ e512 • LBA-63 • PROBLEM LATER ON 75 MBR 1 62 63 64 65 66 67 68 69 70 71 72 73 74 75 MBR 1 62 63 64 65 66 67 68 69 70 71 72 73 74 9 0 4K sectors 7 8

  34. GUID Partition Table (GPT) • That new thing that boots your OS • First 17K of the disk • Lots of stuff ------------------------------> • On Disk GPT Alignment Space 2048

  35. RAID Implications • If RAID volume misaligned, entire array is affected • RAID in VMs is BAD!

  36. RAID Terminology • Data Disk • A disk that has real data (not parity) • Stripe • RAID unit of IO (“block”) • Also called “Chunk” • Stride • Amount of data from a stripe before moving to next disk • Stripe Width • Length of a stripe

  37. RAID Math • Constants • DATA_DISKS = 3 (lets say this is RAID5 with 4 disks) • BLOCK_SIZE = 4K (from the filesystem) • CHUNK_SIZE = 512K • Calculate Stride • STRIDE = CHUNK_SIZE / BLOCK_SIZE = 128K • Calculate Stripe Width • STRIPE_WIDTH = STRIDE * DATA_DISKS = 384K • What this means: • One unit of RAID IO will write 128K to the first disk then move on to the next one

  38. References • http://en.community.dell.com/techcenter/extras/w/wiki/2838.aspx • http://www.pixelbeat.org/docs/disk/ • http://computer-forensics.sans.org/blog/2010/07/28/windows-7-mbr-advanced-format-drives-e512/ • http://en.wikipedia.org/wiki/Advanced_format

More Related