0

There isn't a way to download a complete image from Digital Ocean VPS hosting through their web UI. How can I download an entire image of the VPS that I can use locally on a VM or upload to another VPS later on? Can this be done via SSH or SFTP? Im running Debian 6.

1 Answer 1

2

You can use rsync to essentially clone the whole system via SSH while running.

You create the local VM with the specs you need, install a minimal debian (same version) with the same partitioning schema as your VPS and then boot into a live CD (ubuntu-desktop has pretty much anything you will need).

Then from the live CD you mount the partition(s) to a temporary location (eg: /mnt) and then you run something like this to clone the whole VPS to your local VM keeping all permissions intact.

rsync -aAXv --progress --stats --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} root@YOUR_VPS_IP:/* /mnt/

Make sure to exclude paths that you don't need to clone. The above paths are standard paths that need to be excluded for a successful rsync.

Depending on the virtualization platform the current VPS runs on you might need to fix some paths or files (eg: Partitions' UUIDs on /etc/fstab and/or GRUB config).

You may also need to (re)install the boot loader.

And of course you will need to update the network information so that the newly cloned VM is accessible over the network.

4
  • Sounds like it would be easier to re-configure a brand new node from scratch. How is there not an easier way when we have tools like vagrant now!
    – GodsDead
    Jul 16, 2015 at 13:33
  • If you know what you are doing, cloning a system like this is waaaay easier and faster than re-installing everything from scratch. Not to mention the fact that by cloning it, when it actually boots OK then you won't have to worry about any issues since it's the exact same installation with the exact same config. Doing a re-install from scratch is bound to cause issues (a setting here, a forgotten config there an so on and so forth). Since you mentioned Vagrant, if all this is a dev box, then I guess re-installing everything is not a problem. For production systems though I wouldn't re-install.
    – Cha0s
    Jul 16, 2015 at 15:02
  • Btw the only reason I mentioned to first install a vanilla Debian and then essential overwrite the installation with rsync is to avoid manually creating the partitions and the boot loader. You could of course do it all the way manually if that suits you better (and it's actually faster this way).
    – Cha0s
    Jul 16, 2015 at 15:05
  • Could I also use rsync to sync a local image to a new VPS over ssh? Its been do long since I setup the VPS, ive had to configure so much custom stuff, I cant believe Digital Ocean don't have a download option.
    – GodsDead
    Jul 17, 2015 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.