-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GUIDE] How to migrate instances between different machines #3755
Comments
HI @lars18th, thanks for sharing. The best place for this sort of info is our discourse. Would you mind posting there? Thanks. |
Hi @lars18th |
Hi @lars18th , if you want you can create a new Discourse topic in our Community Knowledge category. Or, I can create if for you if you like. Thanks for your input! |
Dear @giuliazanchi , |
Hi @giuliazanchi , |
Hi @lars18th , sorry for the belated reply. I had this in my backlog, I've just posted it to our Community Knowledge section: https://discourse.ubuntu.com/t/how-to-migrate-instances-between-different-machines/50569 P.s. If you comment on that post, or let me know your username on Discourse, I can tag you properly :) |
@lars18th @giuliazanchi I'm just wondering since the .vhdx is edited, perhaps a comment that one should ensure that this is a copy of the original disk that is being edited until one has verified the next instance is functional and one does not need the original instance as well. In "Copy the permissions with PowerShell Get-Acl .vhdx | Set-Acl .vhdx and delete the .vhdx file." the 'delete the .vhdx file' is specially for deleting the .vhdx |
Hi @melutovich , Thank you for pointing this. At start my post was only to describe that the migration process could be done. And describe more or less the process. With the idea of pointing the key aspects: 1) the configuration, 2) the ssh key to access to the instance. My suggestion now is to write a PowerShell script that could complete the process. The problem is that multiple use cases could exist. For example: Linux QEmu --> Windows Hyper-V. And this is only one case of the multiple sources and targets. But if someone will develop such script, then perhaps the main developers will want to incorporate the process internally. |
Hi,
I want to share this mini-guide. The idea is to provide this technical information to other users. And at the same time propose a new functionality of a ‘migrate’ command. This functionality is already requested in other issues.
Guide to migrating an instance from one Linux host to another Windows host:
/var/snap/multipass/common/data/multipassd/vault/instances/<instance_name>/*.qcow2
(or "*.img" depending on the hypervisor used).qemu-img.exe
(native win32 tool) orqemu-img
(from WSL); or you can do the conversion in the original Linux machine:qemu-img convert <donor>.qcow2 -O vhdx -o subformat=<donor>.vhdx
.multipass launch –n <instance_name> …
.C:\ProgramData\Multipass\data\vault\instances\<instance_name>\*.vhdx
(Warning: to complete this action and from this point you need administrator privileges).sudo qemu-nbd --connect=/dev/nbd0 <donor>.vhdx; sudo qemu-nbd --connect=/dev/nbd1 <target>.vhdx; sudo mount /dev/nbd0p1 /media/donor; sudo mount /dev/nbd1p1 /media/target;
/etc/ssh/ssh_host*
(remove first all of them in donor, perhaps more formats exists in the donor filesystem) and the/home/ubuntu/.ssh/authorized_keys
.<donor>.vhdx
file to the directory where<target>.vhdx
file exists.Get-Acl <target>.vhdx | Set-Acl <donor>.vhdx
and delete the .vhdx file.<donor>.vhdx
file with the original filename of the target vdisk.multipass shell <instance_name>
.This works because the trick is to replace all the ssh data of the original instance with the data of the temporary instance. You don't need to change anything else to migrate an instance to another machine. Just copy/convert the instance disk image. I have completed multiple migrations without any trouble using this technique.
I hope the developers will want to add support for this. Although at the moment we already have a manual process to achieve this.
Regards.
The text was updated successfully, but these errors were encountered: