Le jeu. 5 mars 2020 à 13:07, Michael <confabul...@kintzios.com> a écrit : > > On Thursday, 5 March 2020 09:54:01 GMT Alessandro Barbieri wrote: > > I want to do a crazy thing. I want to migrate my gentoo installation from a > > chroot to a VM (both on the same host). The host is debian but I can only > > use SSH. What do you suggest to do? > > There are VMWare applications to convert a physical installation of an OS to a > VM disk, but since the guest OS is linux, the way I would do it would be: > > 1. Create a virtual disk of the desired size. > 2. Attach a LiveCD to the VM and boot with it. > 3. Use the LiveCD environment to partition/format/mount the VM disk. > 4. Use rsync to copy the filesystem contents from the chroot to the VM > partitions. > 5. Edit the copied fstab to correspond to the VM disk partition UUIDs and > potentially reinstall GRUB. > 6. Unmount the VM disk partitions, shutdown the VM, detatch the LiveCD and > restart the VM. > > You could use partclone instead of rsync, which would retain the same UUIDs > and filesystems as the chrooted system and therefore simplify the migration. > > HTH.
As a chroot is not a complete system, you will also have to do some more actions inside the VM - Compile and install a kernel [1], probably with the VMware modules to get better performance. - Tell Grub to include that kernel in the list of boot options [2] - Check that an init system is fully configured, you can choose between OpenRC or SystemD [3] - Configure networking inside the VM [4] and in VMware on the host - Add services like SSH to system start to be able to connect to the VM As you can see, this will be a mix of a fresh install and a migration of your chroot. Basically you can read through the Gentoo Handbook to see what steps are necessary for the VM to boot. When you copy the chroot files into the VM they will overwrite files from the Stage3. I believe the best step to do this is just before the "Installing tools" chapter, but their may be side effects I don't anticipate... The good thing about a VM is that if anything goes wrong, you just trash it and restart ! Tell us how things turn out for you. Best regards Mickaël Bucas [1] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel [2] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader [3] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base [4] https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/System