qemu中的临时快照(-snapshot)

QEMU支持一种临时的快照,利用临时快照,可以很方便的做实验,然后不会留下使用痕迹,类似于“用后即焚‘的模式。

[root@pc qemu]# qemu-system-x86_64 -h|grep "\-snapshot" -A3 -B3 --color
-mtdblock file  use 'file' as on-board Flash memory image
-sd file        use 'file' as SecureDigital card image
-pflash file    use 'file' as a parallel flash image
-snapshot       write to temporary files instead of disk image files
-hdachs c,h,s[,t]
                force hard disk 0 physical geometry and the optional BIOS
                translation (t=none or lba) (usually QEMU can guess them)

使用该模式,会产生一个临时文件,来记录对磁盘的写操作,而对原来的磁盘并不真正执行读写操作。在虚拟机关机的时候,自动将临时文件删除。这样,我们可以在原镜像上安装一个干净的系统,然后通过qemu加上-snapshot启动它,实验完成之后,也不需要手工清除临时文件,真正做到甩手掌柜。

 

1. 启动操作系统系统

[root@pc images]# qemu  -drive if=virtio,file=centos65_base.img -snapshot --enable-kvm --vnc :8 -m 2048

2. 查看qemu打开的文件

[root@pc ~]# ps -ef|grep qemu|grep snapshot|grep -v grep
root     20890 20129 11 17:29 pts/0    00:00:19 qemu -drive if=virtio,file=centos65_base.img -snapshot --enable-kvm --vnc :8 -m 2048
[root@pc ~]# lsof |grep 20890
qemu      20890      root  cwd       DIR              253,2       4096   21889025 /home/images
qemu      20890      root  rtd       DIR              253,0       4096          2 /
qemu      20890      root  txt       REG              253,0   15198134     941595 /usr/local/bin/qemu-system-x8
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值