2

How would I go about moving a Ubuntu 14 box from Digital Ocean to physical hardware?

Serge
  • 23
  • 1
    Maybe this is helpful? https://www.digitalocean.com/community/tutorials/how-to-migrate-linux-servers-part-1-system-preparation – wjandrea Jan 23 '19 at 16:25
  • It may be a good time to upgrade since 14.04 will not be supported for much longer. – kasperd Jan 23 '19 at 16:26
  • Please don't and start fresh with a new installation. Copy the apt cache over if you want to install the same software if you never deleted the cache. Oh and your problem also is related on how digital ocean provides features for this: if they let you make a virtual container you might only need to create one. Otherwise I would use dd to create a diskdump if you have the diskspace for it,. – Rinzwind Jan 23 '19 at 16:36
  • I have created a dd image and have it on a local disk, however I've been unable to boot from it. – Serge Jan 23 '19 at 17:14
  • You probably won't have all the drivers necessary to run on real hardware if you bluntly copy the DO installation (that runs on a VM...). Do a lspci on your DO server, and see all these devices than run only in VMs: SCSI storage controller: Red Hat, Inc Virtio SCSI, Ethernet controller: Red Hat, Inc Virtio network device, etc... Backup your config and reinstall a fresh system (with a 18.xx release). – xenoid Jan 23 '19 at 17:25
  • If it’s a full VPS, you can check my answer to another question. Although the asker wanted to convert a physical machine to virtual, it works the other way round, too. @xenoid AFAIK the supported drivers depend on the kernel. If running a generic kernel, this should not be a problem. – Melebius Jan 24 '19 at 13:19

2 Answers2

1

You need to download an image of the disk that exists on your VPS provider. The problem here is that the most common setup for a VPS is a server with a single "hard drive" attached to it, and you can't reliably make a disk image of a system while it's running without specialized tools or processes. Also, where would the disk image go since trying to take a snapshot of the disk while it's being imaged creates a problem.

If your VPS provider lets you download a disk image/snapshot/backup directly, great, you can just do that. However, most don't provide that functionality directly and instead you have to do it yourself. To do that you need to either create a new volume/disk and attach it to the server or launch a new VPS and attach the disk you're trying to image to that server. In either case, you need a system running Linux that has two disks attached, one the disk you're trying to image and the other a (larger) disk of where to store the image.

Next get the name of the disk you're imaging, in this example we'll call it /dev/sdb. You don't have to actually mount the disk you're trying to image, but instead do something like this:

dd if=/dev/sdb of=/where/to/write.img status=progress

The status=progress is so that you can monitor the progress. If you're doing this over SSH you might want to run this all as a setsid command (setsid dd ...) so that it doesn't get killed if you disconnect.

Once you have that .img file you can reverse the process by plugging a disk into a machine running Linux locally, in this example I'll call the disk we plugged in /dev/sdc

dd if=write.img of=/dev/sdc status=progress

If you're feeling snazzy you can try to do all of this without an intermediate storage disk on your VPS by booting into a Live CD and copying the files over an SSH tunnel by running this command on your VPS while booted into the Live CD:

dd if=/dev/sdb | ssh -C user@ip_of_home_pc dd of=disk.img

This takes advantage of the fact that SSH actually hooks up standard input/output streams and passes the output of the dd imaging process over a compressed (-C) SSH connection.

0

One solution is to create an ISO image from your current Ubuntu 14 box and then mount the ISO image onto a USB drive, using the USB drive to boot from next time for installation.

See this similar question/answer for more information.