microsoft/openvmm
Publicmirrored from https://github.com/microsoft/openvmmAvailable
Guide/src/reference/backends/storage.md
53lines · modecode
| 1 | # Storage backends |
| 2 | |
| 3 | Storage backends implement the |
| 4 | [`DiskIo`](https://openvmm.dev/rustdoc/linux/disk_backend/trait.DiskIo.html) |
| 5 | trait, the shared abstraction that all storage frontends use to read |
| 6 | and write data. A frontend holds a |
| 7 | [`Disk`](https://openvmm.dev/rustdoc/linux/disk_backend/struct.Disk.html) |
| 8 | handle and doesn't know what kind of backend is behind it — the same |
| 9 | frontend code works with a local file, a Linux block device, a remote |
| 10 | blob, or a layered composition of multiple backends. |
| 11 | |
| 12 | ## Backend catalog |
| 13 | |
| 14 | | Backend | Crate | Wraps | Platform | Key characteristic | |
| 15 | |---------|-------|-------|----------|--------------------| |
| 16 | | FileDisk | [`disk_file`](https://openvmm.dev/rustdoc/linux/disk_file/index.html) | Host file | Cross-platform | Simplest backend. Blocking I/O via `unblock()`. | |
| 17 | | Vhd1Disk | [`disk_vhd1`](https://openvmm.dev/rustdoc/linux/disk_vhd1/index.html) | VHD1 fixed file | Cross-platform | Parses VHD footer for geometry. | |
| 18 | | VhdmpDisk | `disk_vhdmp` | Windows vhdmp driver | Windows | Dynamic and differencing VHD/VHDX. | |
| 19 | | BlobDisk | [`disk_blob`](https://openvmm.dev/rustdoc/linux/disk_blob/index.html) | HTTP / Azure Blob | Cross-platform | Read-only. HTTP range requests. | |
| 20 | | BlockDeviceDisk | [`disk_blockdevice`](https://openvmm.dev/rustdoc/linux/disk_blockdevice/index.html) | Linux block device | Linux | io_uring, resize via uevent, PR passthrough. | |
| 21 | | NvmeDisk | [`disk_nvme`](https://openvmm.dev/rustdoc/linux/disk_nvme/index.html) | Physical NVMe (VFIO) | Linux/Windows | User-mode NVMe driver. Resize via AEN. | |
| 22 | | StripedDisk | [`disk_striped`](https://openvmm.dev/rustdoc/linux/disk_striped/index.html) | Multiple Disks | Cross-platform | Stripes data across underlying disks. | |
| 23 | |
| 24 | ## Decorators |
| 25 | |
| 26 | Decorators wrap another |
| 27 | [`Disk`](https://openvmm.dev/rustdoc/linux/disk_backend/struct.Disk.html) |
| 28 | and transform I/O in transit. Features compose by stacking decorators |
| 29 | without modifying the backends underneath. |
| 30 | |
| 31 | | Decorator | Crate | Transform | |
| 32 | |-----------|-------|-----------| |
| 33 | | CryptDisk | [`disk_crypt`](https://openvmm.dev/rustdoc/linux/disk_crypt/index.html) | XTS-AES-256 encryption. Encrypts on write, decrypts on read. | |
| 34 | | DelayDisk | [`disk_delay`](https://openvmm.dev/rustdoc/linux/disk_delay/index.html) | Adds configurable latency to each I/O operation. | |
| 35 | | DiskWithReservations | [`disk_prwrap`](https://openvmm.dev/rustdoc/linux/disk_prwrap/index.html) | In-memory SCSI persistent reservation emulation. | |
| 36 | |
| 37 | ## Layered disks |
| 38 | |
| 39 | A [`LayeredDisk`](https://openvmm.dev/rustdoc/linux/disk_layered/index.html) |
| 40 | composes multiple layers into a single `DiskIo` implementation. Each |
| 41 | layer tracks which sectors it has; reads fall through from top to |
| 42 | bottom until a layer has the requested data. This powers the |
| 43 | `memdiff:` and `mem:` CLI options. |
| 44 | |
| 45 | Two layer implementations exist today: |
| 46 | |
| 47 | - **RamDiskLayer** ([`disklayer_ram`](https://openvmm.dev/rustdoc/linux/disklayer_ram/index.html)) — ephemeral, in-memory. |
| 48 | - **SqliteDiskLayer** ([`disklayer_sqlite`](https://openvmm.dev/rustdoc/linux/disklayer_sqlite/index.html)) — persistent, file-backed (dev/test only). |
| 49 | |
| 50 | The [storage pipeline](../architecture/devices/storage.md) page covers |
| 51 | the full architecture: how frontends, backends, decorators, and the |
| 52 | layered disk model connect, plus cross-cutting concerns like online |
| 53 | disk resize and virtual optical media. |
| 54 | |