KVM create and restore a full backup (Disk Image)

  • 2
  • 371 views
  • A+
所属分类:Notes

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.

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:2   其中:访客  2   博主  0

    • ag

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

      • ag

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