KVM create and restore a full backup (Disk Image)

Making a backup

Boot the system rescue cd ISO and follow the directions until you get to a shell.

Make a directory to mount a remote filesystem

Code:
mkdir /sshfs

mount a remote filesystem with sshfs

Code:
sshfs user@ip:/dir/to/mount /sshfs

Make the image and compress with gzip. If you are not using virtio-disk, replace vda with sda or hda

Code:
dd if=/dev/vda|gzip>/sshfs/hostname.img.gz

This will take a while depending on the size of your drive, how much data is stored and network speeds. After it finishes, unmount the ISO and reboot your VM.

Restoring a backup

To restore, boot the system rescue CD ISO and follow all the directions until you get a shell and remake a directory to mount the same remote filesystem

Code:
mkdir /sshfs

mount the remote filesystem with sshfs

Code:
sshfs user@ip:/dir/to/mount /sshfs

Now we restore the backup

Code:
gunzip -c /sshfs/hostname.img.gz|dd of=/dev/vda

After it finishes, unmount the ISO and reboot the VM.

本文作者: GavinDong

版权属于: GavinDong博客

文章链接: https://gavindong.com/1889.html

如果使用过程中遇到问题,可 **点击此处** 交流沟通。

版权所有,转载时必须以链接形式注明作者和原始出处及本声明。

(0)

相关文章

发表回复

登录后才能评论

评论列表(2条)

  • ag的头像
    ag 2018.01.04 16:26

    参考:http://pof.eslack.org/2010/12/23/best-solution-to-fully-backup-kvm-virtual-machines/

  • ag的头像
    ag 2018.01.04 16:24

    原文:https://www.realwebsolution.in/clients/knowledgebase.php?action=displayarticle&id=27