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.
Was this answer helpful? 0 Users Found This Useful (58 Votes)

Powered by WHMCompleteSolution