Giter Club home page Giter Club logo

streaming-qcow2-writer's Introduction

Streaming QCOW2 image writer

This is a tool that can write a QCOW2 image file in a streaming fashion. It can read a raw file or device and write a QCOW2 file, and contrary to qemu-img convert, it will not attempt to seek in the output.

Optionally it can consume a layout file in JSON format indicating which parts of the input file should be read; the other parts of the image will be assumed to be all zero and won't take space in the output.

The motivating use-case for this tool is backups: you can pipe the output to a backup system such as Restic without having to write the QCOW2 image to disk! The layout JSON matches the files given by rbd diff too, so you can do:

$ rbd diff --whole-object --format=json my-vm-disk > my-vm-disk.json
$ rbd device map my-vm-disk
/dev/rbd0
$ streaming-qcow2-writer /dev/rbd0 my-vm-disk.json | restic -r /srv/restic-repo backup --stdin --stdin-filename=my-vm-disk.qcow2
$ rbd device unmap /dev/rbd0

Features

  • Writes QCOW files version 2.
  • Uses the standard 65536-byte cluster size.
  • No deduplication or skipping of zero blocks (the layout has to be computed ahead of time, we can't decide to write a smaller file after that). Let your backup system handle it, or sparsify your input layout first.
  • No compression, so deduplication will work. On the flip side, the "restored" file will be bigger.
  • Can read from either a regular file or a block device.
  • Writes output file to stdout.
  • Portable, although I don't know how you'd get a block device on Windows.
  • Can be built as a static binary.

streaming-qcow2-writer's People

Contributors

remram44 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

streaming-qcow2-writer's Issues

Add optional sparsification via a second pass

We could make a first pass over the input to find out which blocks are all-zero before computing the layout and writing. It would result in smaller image files if the input is sparse.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.