Converting a physical Linux Machine to use in VMWare
Solution 1:
Yes, it is possible and not really difficult. You can take the advantage of the UNIX filesystem having a single root, so you don’t need to replicate the structure of mounts, RAID etc. in your copy – the system will behave the same way having all files in a single mount.
I have successfully done the procedure before, my method is based on a guide from https://wiki.archlinux.org/index.php/full_system_backup_with_rsync.
Preconditions
- enough free space in your home directory on the server to store the whole server contents (compressed)
- enough free space for both uncompressed + compressed server contents on your local hard drive
- root access on the server
- both machines must use a compatible architecture (otherwise you could not run the transferred binaries)
Instructions
-
Backup the complete server contents. You can use
rsync
from the linked guide and then compress or do it in a single step. You needsudo
to access all the files.sudo tar --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","~/server-backup.tar.xz"} -cJvf ~/server-backup.tar.xz /
-
Download the created file using SCP or another suitable method.
-
Create a VM with a new virtual hard drive with a sufficient capacity. Boot a live distro.
-
Format and mount the blank hard drive.
-
Decompress the contents of the compressed backup file to the mounted drive. (You need to make the file available to the VM, e.g. using shared folder or another drive attached to the VM.)
-
Restore GRUB using the chroot method.
-
Edit configuration files if necessary (especially
/etc/fstab
,/etc/network/interfaces
). -
Shut down the VM, dettach the live distro media and boot your server clone.