Migrate Debian 9.3 VirtualBox VM to Linode
According to https://www.linode.com/docs/platform/disk-images/migrating-a-server-to-your-linode/ it's possible to "You can even migrate virtualized servers created with products like VirtualBox or VMware.".
That's exactly what I want to do. I have a Debian 9.3 VM from VirtualBox which I would like to host on a Linode server. However, I haven't found much that explains how to actually do it.
Does anyone here have any pointers for me? Thank you very much.
I'm sure there may be a few different ways out there but here is what I've done in the past.
1. Prepare your Debian VirtualBox image
- You'll want to ensure you have openssh is installed
- apt-get install openssh-server - systemctl start ssh.service - systemctl enable ssh.service
2. Download and boot from Finnix(In VirtualBox)
- Download Finnix here (Click the "x86/AMD64")
- In VirtualBox go to Settings --> Storage --> Click Empty --> Click the CD icon, and then select Choose a virtual CD/DVD disk file --> Select your Finnix ISO, and then click OK--> Boot your VM.
You are now in Finnix!
3. Now begin to prepare your Linode.
- Create a Linode
- Create a configuration profile
- Create your new Disks
- You will want to create 1 ext4 disk and 1 swap disk (size of the EXT4 disk has to be big enough to accommodate the data on the VM)
- Go back to your configuration profile --> Under Block Device Assignment assign the EXT4 disk to sda and the swap to sdb --> Save changes
4. Begin the data transfer.
root@ttyS0:~# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ttyS0:~# service ssh start [*] [*] IMPORTANT: The 'root' and 'finnix' accounts have been disabled, and [*] passwords for these accounts must be set for remote administration. [*] [*] Please be sure to use 'passwd' to set a password after sshd is started. [*] [*] Generating SSH2 RSA host key... done [*] Generating SSH2 DSA host key... done [*] Generating SSH2 ECDSA host key... done [*] Generating SSH2 ED25519 host key... done [*] Starting OpenBSD Secure Shell server... sshd done root@ttyS0:~# mount /media/sda
Your Linode is now ready to accept the image :)
- On your VM, boot it into Finnix and execute the same steps but instead add a '1' at the end of the mount command like so:
root@ttyS0:~# mount /media/sda1
root@ttyS0:~# passwd root@ttyS0:~# service ssh start root@ttyS0:~# mount /media/sda1
- On the VM run this command to begin the data transfer:
rsync -avz /media/sda1/ root@$linodeip:/media/sda/
- Once that completes, then you will want to edit your fstab to look similar to this:
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). #<file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/sda / ext4 noatime,errors=remount-ro 0 1 /dev/sdb none swap sw 0 0
Boot up and you should be good to go :)
I ran into an issue where with networking on first boot, I was getting this error:
[FAILED] Failed to start Raise network interfaces.
ip a and found that my eth0 interface was named
enp0s3: instead of eth0. To resolve that, I ran the command below and rebooted which fixed it:
ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
Hope that helps!