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.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Send any Linux Command output via E-mail

Create a script file with below syntax : command > file.tmp mailx -s "Subject" mailaddress...

How to Cache or copy a website?

Full website contents can be copied with wget command with below options :wget \--recursive...

How to Configure Centos 6 firewall (iptables)?

Introduction CentOS 6 uses iptables as system firewall.We configure iptables in our default...

How to resize volumes with LVM?

Quick tips: To see the details of logical volume group use: vgdisplay To see the details of...

Install Fedena on CentOS

Installing Fedena on Centos is a bit tricky since most of the stack used to run fedena is not...

Powered by WHMCompleteSolution