虚拟机快照恢复到异机脚本

虚拟机快照恢复到异机脚本

𝓓𝓸𝓷 Lv6

目标服务器使用live cd iso加载启动并开启ssh登录: 如debian-live-8.11.0-amd64-gnome-desktop.iso

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cat /opt/soft/snapshot-1607336-1749019051-2025-06-03-7ee07cb130e32d1ba06dcfa79fe34a7748f67602.tar.gz | ssh root@172.168.1.110 "tar xzO | dd of=/dev/sda bs=1M"




This will transmit a snapshot file "snapshot_on_your_PC.tar.gz" from your local PC over SSH into a target VPS (running off a Live CD) and write unpacked image directly to disk.

After booting the Live ISO, just make sure to enable SSH (to allow inbound SSH connections).


General information on snapshot format:

The .disk file in the snapshot is a raw disk image. It can be mounted with any virtualization platform, for example Virtual Box.

If you decide to use Virtual Box, you may need to use the following command to convert the raw disk image to VDI before it can be recognized by Virtualbox:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertfromraw --format VDI vm-ID.disk vm-ID.vdi

P.S. To correctly unpack .tar.gz file on a Windows machine, please see guide: https://www.addictivetips.com/windows-tips/use-tar-on-windows-10/
Note that if you decide to use 7-zip or Winrar to unpack this archive, you will end up with a non-working (corrupt) image as these applications do not properly support sparse tar archives.
  • Title: 虚拟机快照恢复到异机脚本
  • Author: 𝓓𝓸𝓷
  • Created at : 2025-07-06 10:39:23
  • Updated at : 2025-07-10 17:50:07
  • Link: https://www.zhangdong.me/vps-snapshot-recovery.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论