How to delete a snapshot not seen with virsh but can be seen with qemu-img info?

5,475

if you want only delete this file and have a root access in shell . so in linux ditros you can simply remove command line : rm -f my-image-file.qcow2

if you want to do something else please let me know to represent a better solution.

also you can delete this file with qemu-img command line if it works :

Use qemu-img snapshot -d snapshot_id disk_image to delete old or unneeded snapshots of a virtual machine. This saves some disk space inside the qcow2 disk image as the space occupied by the snapshot data is restored:

tux@venus:~> qemu-img snapshot -d 2 /images/sles11sp1.qcow2

Share:
5,475

Related videos on Youtube

munish
Author by

munish

Updated on September 18, 2022

Comments

  • munish
    munish over 1 year
    [msingh@centos images]$ qemu-img info IE11-Win7-VMWare-disk1.qcow2
    image: IE11-Win7-VMWare-disk1.qcow2
    file format: qcow2
    virtual size: 40G (42949672960 bytes)
    disk size: 82G
    cluster_size: 65536
    Snapshot list:
    ID        TAG                 VM SIZE                DATE       VM CLOCK
    2         freshInstall              0 2018-11-16 15:41:01   00:00:00.000
    3         freshInstallActivated   3.5G 2018-11-17 02:50:15   00:06:45.305
    4         90DayActivation           0 2018-11-17 09:06:41   00:00:00.000
    Format specific information:
        compat: 1.1
        lazy refcounts: false
    

    As seen above the snapshots are seen with ID 2,3,4 but i cannot see it with virsh command below.Also are these snapshots causing a big difference in the disk size and virtual size

    [msingh@centos images]$ sudo virsh snapshot-list Windows7FreeIE11 
     Name                 Creation Time             State
    ------------------------------------------------------------
    
    [msingh@centos images]$ 
    

    This happened after i moved the IE11-Win7-VMWare-disk1.qcow2 image file to another file-system because of storage space limitation.

    How can i delete the snapshots because virsh command does not work because it cannot find the snapshots listed by qemu-img.

    [msingh@centos images]$ sudo virsh list --all
    [sudo] password for msingh: 
     Id    Name                           State
    ----------------------------------------------------
     1     Windows7FreeIE11               running
     -     centos7.0                      shut off
     -     win10                          shut off