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

  1. Backup the complete server contents. You can use rsync from the linked guide and then compress or do it in a single step. You need sudo 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 /
    
  2. Download the created file using SCP or another suitable method.

  3. Create a VM with a new virtual hard drive with a sufficient capacity. Boot a live distro.

  4. Format and mount the blank hard drive.

  5. 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.)

  6. Restore GRUB using the chroot method.

  7. Edit configuration files if necessary (especially /etc/fstab, /etc/network/interfaces).

  8. Shut down the VM, dettach the live distro media and boot your server clone.