Page 1 of 1

How to backup your Linux VPS and run it in virtualbox

Posted: Fri Dec 30, 2016 11:24 am
by david
Personally i found a easy way to backup your linux Debian VPS.

1.Execute ssh dd comand from your linux pc.

Code: Select all

ssh root@x.x.x.x "dd if=/dev/sda | gzip -c --fast" | dd of=/home/user/vps.img.gz
where x.x.x.x is your ip address.

2.Crate Virtual Machine vps with virtual drive 30GB (30GB is cos we need to make sure we have enough space )

3.Mount new virtual box hdd vps.vdi

Code: Select all

modprobe nbd max_part=16

Code: Select all

qemu-nbd -c /dev/nbd0 /home/xxx/VirtualBox\ VMs/vpn/vps.vdi
4. Extract and restore your backup /home/user/vps.gz (extract vps.gz to --> vps.img)

Code: Select all

dd if=/home/xxx/vps.img of=/dev/nbd0 bs=4M
or

Code: Select all

gunzip -c vps.img.gz | sudo dd of=/dev/nbd0

5.Run your virtual box VM and enjoy your cloned vps!