Skip to content

Command-line tools for streaming and manipulating vhd format data

License

Notifications You must be signed in to change notification settings

TimSmithCtx/vhd-tool

 
 

Repository files navigation

vhd-tool

Command-line tools to manipulate, transcode and stream vhd format data.

Basic command-line tool examples

To create an empty dynamic (i.e. grows on demand) vhd:

vhd-tool create filename.vhd --size 16GiB

To create an empty difference vhd:

vhd-tool create filename.vhd --size 16GiB --parent otherfile.vhd

To query all the parameters of a vhd:

vhd-tool info filename.vhd

To query a specific parameter:

vhd-tool get filename.vhd current-size

Example: incremental backup

(This is a work in progress)

When running VMs on a hypervisor like XenServer, it is important to have a backup strategy for your important virtual disks. One possibility is to perform periodic disk snapshots and archive the "deltas" (or differences) between the new snapshot and the last.

First take a snapshot (this will be the first backup):

xe vdi-snapshot uuid=<uuid>

Next download the snapshot as a single .vhd:

xe vdi-export uuid=<uuid>

This will print a filename to the terminal.

Periodically (e.g. from cron), perform a new snapshot:

xe vdi-snapshot uuid=<uuid>

Next download the differences from a previous snapshot as a single .vhd:

xe vdi-export uuid=<uuid> relative-to=<previous-uuid>

Next, to avoid using too much disk space, count the number of snapshots and delete the oldest if you have too many:

xe vdi-destroy uuid=<oldest-uuid>
vhd-tool commit filename.vhd --into older.vhd

To restore a backup onto a fresh system use:

vhd-tool stream --source filename.vhd
                --source-format vhd
                --destination http://user:password@xenserver/import_vdi
                --destination-format vhd
                --progress

About

Command-line tools for streaming and manipulating vhd format data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • OCaml 74.8%
  • Python 23.1%
  • C 1.7%
  • Makefile 0.4%