Skip to content

djs55/vhd-tool

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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's 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