Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LVM For VM Disks (+100% Disk Performance Over Raw File-Based Images)

Featured Replies

I've been experimenting with LVM-backed VM storage as a middle ground between file-based images and direct device passthrough. I wanted better performance than img files but didn't want to sacrifice snapshots or lose an entire NVMe device to a single VM. The I/O performance improvement over regular img files is pretty substantial - my Windows VM feels much more responsive now.

The interesting thing is that while it looks like more layers: VM → qemu → LVM → loop device → file → filesystem → storage

It actually performs better than direct file access because you get proper block device I/O with better caching and alignment.

Setup process:

  1. Create storage file: truncate -s 100G vdisk-lvm.img

  2. Mount via loop device: losetup /dev/loop4 vdisk-lvm.img

  3. Initialize LVM: pvcreate /dev/loop4 && vgcreate vm-storage /dev/loop4

  4. Create logical volume: lvcreate -L 90G -n windows vm-storage

  5. Update VM XML to point to /dev/vm-storage/windows instead of the img file

The bonus is you get LVM snapshots, which are really handy for things like Windows updates where you want an easy rollback option.

I set up some User Scripts to handle the loop device mounting automatically when the array starts/stops.

Benchmarks (all using NVME + Real World test, the disk image sits on a Samsung 990 Pro NVMe drive, encrypted XFS format):

Using raw image file, "typical" setup:

<disk type='file' device='disk'>
   <driver name='qemu' type='raw' cache='none' io='native' discard='unmap' iothread='1'/>
   <source file='/mnt/primary/domains/Windows/vdisk1.img'/>

image.png

Using LVM mounted

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none' io='native' discard='unmap' iothread='1'/>
  <source dev='/dev/vm-storage/windows' index='1'/>

image.png

My question is: why isn't this approach discussed more often in VM guides or forums? Is there some downside I'm not seeing, or is it just the perceived complexity that keeps people using raw/qcow2 files?

The performance improvement seems worth the slightly more involved setup. It's not native NVME speeds, but you retain snapshot flexibility.

Edited by jch

  • jch changed the title to LVM For VM Disks (+100% Disk Performance Over Raw File-Based Images)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.