大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

[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…

问题原文

原帖链接 · munish · CC BY-SA 4.0

[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

已采纳解答

原帖链接 · NetProf · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-12-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。