Qemu: Merge snapshot and backing file into standalone disk

# qemu-img info --backing-chain test1-master-0 
image: test1-master-0
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 4.6G
cluster_size: 65536
backing file: /var/lib/libvirt/images/test1-base
backing file format: qcow2
Format specific information:
compat: 0.10
refcount bits: 16
image: /var/lib/libvirt/images/test1-base ***
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 1.6G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
# cp test1-base new-master
# qemu-img rebase -b new-master test1-master-0
# qemu-img commit test1-master-0
Image committed.
# qemu-img info new-master
image: new-master
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 6.1G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
  1. We copied our backing file test1-base to a new-master pretty easy :)
  2. Then rebase the image file that was backed off the original file so that it uses the new file i.e. new-master
  3. Finally you can commit those changes back to original file test1-master-0 back into the new base new-master

--

--

--

Runner, Cyclist, Open-source lover, MiniShift Developer !!

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Praveen Kumar

Praveen Kumar

Runner, Cyclist, Open-source lover, MiniShift Developer !!

More from Medium

Library

How to connect[Mount/Unmount] EFS to multiple EC2 instances and how we can use…Step by step

COMBINATIONS (BLOG POST)

THM: Pickle Rick