Questo contenuto non è disponibile nella lingua selezionata.

14.5.16. Using blockpull to Shorten a Backing Chain


blockpull can be used in in the following applications:
  • Flattens an image by populating it with data from its backing image chain. This makes the image file self-contained so that it no longer depends on backing images and looks like this:
    • Before: base.img ← Active
    • After: base.img is no longer used by the guest and Active contains all of the data.
  • Flattens part of the backing image chain. This can be used to flatten snapshots into the top-level image and looks like this:
    • Before: base ← sn1 ←sn2 ← active
    • After: base.img ← active. Note that active now contains all data from sn1 and sn2 and neither sn1 nor sn2 are used by the guest.
  • Moves the disk image to a new file system on the host. This is allows image files to be moved while the guest is running and looks like this:
    • Before (The original image file): /fs1/base.vm.img
    • After: /fs2/active.vm.qcow2 is now the new file system and /fs1/base.vm.img is no longer used.
  • Useful in live migration with post-copy storage migration. The disk image is copied from the source host to the destination host after live migration completes.
    In short this is what happens: Before:/source-host/base.vm.img After:/destination-host/active.vm.qcow2./source-host/base.vm.img is no longer used.

Procedure 14.3. Using blockpull to Shorten a Backing Chain

  1. It may be helpful to run this command prior to running blockpull:
    # virsh snapshot-create-as $dom $name - disk-only
    Copy to Clipboard Toggle word wrap
  2. If the chain looks like this: base ← snap1 ← snap2 ← active run the following:
    # virsh blockpull $dom $disk snap1
    Copy to Clipboard Toggle word wrap
    This command makes 'snap1' the backing file of active, by pulling data from snap2 into active resulting in: base ← snap1 ← active.
  3. Once the blockpull is complete, the libvirt tracking of the snapshot that created the extra image in the chain is no longer useful. Delete the tracking on the outdated snapshot with this command:
    # virsh snapshot-delete $dom $name - metadata
    Copy to Clipboard Toggle word wrap
Additional applications of blockpull can be done as follows:
  • To flatten a single image and populate it with data from its backing image chain:# virsh blockpull example-domain vda - wait
  • To flatten part of the backing image chain:# virsh blockpull example-domain vda - base /path/to/base.img - wait
  • To move the disk image to a new file system on the host:# virsh snapshot-create example-domaine - xmlfile /path/to/new.xml - disk-only followed by # virsh blockpull example-domain vda - wait
  • To use live migration with post-copy storage migration:
    • On the destination run:
       # qemu-img create -f qcow2 -o backing_file=/source-host/vm.img /destination-host/vm.qcow2
      Copy to Clipboard Toggle word wrap
    • On the source run:
      # virsh migrate example-domain# virsh migrate example-domain
      Copy to Clipboard Toggle word wrap
    • On the destination run:
      # virsh blockpull example-domain vda - wait# virsh blockpull example-domain vda - wait# virsh blockpull example-domain vda - wait
      Copy to Clipboard Toggle word wrap
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat