Skip to content

Instantly share code, notes, and snippets.

@mechinn
Last active April 5, 2023 03:28
Show Gist options
  • Save mechinn/926a1def89510046cc58bf1aef5359ed to your computer and use it in GitHub Desktop.
Save mechinn/926a1def89510046cc58bf1aef5359ed to your computer and use it in GitHub Desktop.
bash script that will use qemu-img read the "virtual-size" of an image, create a zvol of the full size, and convert the file to the zvol
#!/bin/bash -x
file=$1
destination=$2
size=$(qemu-img info $file --output json | jq '."virtual-size"')
zfs create -V $size $destination
qemu-img convert -O raw $file /dev/zvol/$destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment