Skip to content
strozfriedbergPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Latest commit

 

History

419 Commits

Folders and files

Repository files navigation

vmdk-rs

This project has been relocated to the imagereader-rs workspace: https://github.com/strozfriedberg/imagereader-rs. This version is archived; please see the workspace project for updates.


vmdk-rs is a Rust library to read data from the VMware Virtual Disk (VMDK) files. This project is in active development and should be considered beta quality, with no known issues.

Supported extent file formats

  • raw (flat)
  • VMDK3 COWD (sparse)
  • VMDK4 (sparse)
  • SESPARSE
  • flat types: monolithicFlat, 2GbMaxExtentFlat, vmfsThin
  • sparse types: monolithicSparse, 2GbMaxExtentSparse, vmfsSparse, streamOptimized

Supported format features

  • grain compression
  • data markers
  • zeroed grain table entries
  • delta links (snapshots)

Usage example

Read from a VMDK in Rust:

    use vmdk::vmdk_reader::VmdkReader;

    let vmdk_reader = VmdkReader::open(&vmdk_path).unwrap();

    let mut buf: Vec<u8> = vec![0; 1048576];
    let mut offset = 0;
    while offset < vmdk_reader.total_size {
        let read = vmdk_reader.read_at_offset(offset, &mut buf).unwrap();
        if read == 0 {
            break;
        }

        // do something with buf[..read]

        offset += read as u64;
    }

Read from a VMDK in C:

    #include "vmdkrs.h"

    VmdkError* err = nullptr;
    VmdkHandle* handle = vmdk_open(vmdk_path, &err);
    if (err) {
        printf("%s\n", err->message);
        vmdk_free_error(err);
        return;
    }

    char buf[4096];
    uint64_t offset = 0;
    while (offset < handle.image_size) {
        uintptr_t r = vmdk_read(handle, offset, buf, sizeof(buf), &err);
        if (err) {
            printf("%s\n", err->message);
            vmdk_free_error(err);
            return;
        }

        // do something with buf[..r]

        offset += r;
    }

    vmdk_close(handle);

Comparison with other VMDK libraries

vmdk-rs libvmdk go-vmdk
VMDK3 (COWD) ✅ ✅
VMDK4 ✅ ✅
FLAT extents ✅ ✅ ✅
VMFS extents ✅ ✅ ✅
VMFSSPARSE extents ✅ ✅
VMFSRAW extents ✅ ✅
VMFSRDM extents ✅ ✅
SPARSE extents ✅ ✅ ✅
SESPARSE extents ✅
ZERO extents ✅
grain compression ✅ ✅
data markers ✅ ✅
zeroed grain table entries ✅ ✅
embedded descriptors ✅ ✅
delta links (snapshots) ✅ ✅
read from local filesystem ✅ ✅ ✅
read from S3 ✅

Copyright

Copyright 2025–6, LevelBlue. vmdk-rs is licensed under the Apache License, Version 2.0.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages