kvm

KVM Restore from Backup

1. Login to Solusvm and create new vps under the same node of vps you want to restore. Please assign same diskspace, memory, cpu, etc. Just create empty VM, no need to specify template or iso. If vps is linux, select virtio disk driver and if vps is windows, select ide.

2. Once done, turn off the new VM. Note down the VMID of both new and old vm. It start with kvmxxx under vm list of respective node at solusvm panel.

3. The backup storage is using NFS, so you will need to verify where is the NFS server by df -h

4. Transfer the backup file to “/” directory of the node.

Currently we have 2 KVM backup servers which are 103.82.240.23 and 103.82.240.25

103.82.240.23 : /home/kvm_backup/images-backups
103.82.240.25 : /home/kvm_backup/images-backups

# screen
# rsync -avz --progress -e "ssh -p 8286" /home/kvm_backup/kvm138_img [email protected]:/root/

5. Ensure the newly created vps has same diskspace as the old vps. Example as below:

Old vps:

[root@ssdvps03 dev]# fdisk -l /dev/ssdvps03data/kvm138_img

Disk /dev/vol_kvm/kvm138_img: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf9a74360

Below are the detail of each VPS Host :

ssdvps01 = /dev/idssd01/
ssdvps02 = /dev/idssd02/
ssdvps03 = /dev/ssdvps03data/
ssdvps04 = /dev/ssdvps04data/
ssdvps05 = /dev/ssdvps05data/
ssdvps06 = /dev/ssdvps06data/
ssdvps07 = /dev/ssdvps07data/
ssdvps08 = /dev/ssdvps08data/
ssdvps09 = /dev/ssdvps09data/
ssdvps10 = /dev/ssdvps10data/

New vps:

[root@ssdvps05 dev]# fdisk -l /dev/ssdvps05data/kvm652_img

Disk /dev/vol_kvm/kvm652_img: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

6. Execute following command to restore the image from backup to new vps disk:

[root@ssdvps05 dev]# gunzip -c <backup_file_name> | dd of=<new_vps_disk_location>

Example:

[root@ssdvps05 dev]# gunzip -c 397-kvm-kvm138-1.bz | dd of=/dev/ssdvps05data/kvm652_img

To get the location of vps diskspace: lvdisplay | grep kvmxxx

7. Once restoration done, boot up the new VM. Please swap the IP between old and new vps to retain the same DNS record, client’s access, etc.