How to Migrate Bare Metal Linux to Virtual Machine

bare-metallinuxmigrationvirtual-machines

I'd like to migrate a RHEL5 installation from a bare-metal installation to a virtual machine. I'm not very experienced when it comes to Linux backup and restore procedures, so I'm looking for advice on the best way to accomplish this. The requirements are

  • must be able to reduce the size of the disk (physical disk is over 200gb, mostly empty space, so the VM should be able to be made smaller)
  • there is an Oracle installation on the machine which must come along for the ride (if there's a way to stop writes going to the disk while backing it up, that'd be ideal)
  • I can install the OS on the destination VM before restoring to it, if required
  • this is not a production system, so I'm not worried about uptime or performance
  • everything needs to be moved (installed software, users/groups, /etc/* configuration, etc.)
  • the disk being backed up is the primary disk, but there is a secondary disk which can be used for storing data before moving it to the VM.

I assume that needing to reduce the disk space rules out using dd. Would tar work for my requirements? Is there some way of taking the file system offline so applications can't write while I'm backing it up? Can Oracle be backed up using tar if it is stopped at the time, or do I need to move it separately from the rest of the system, using its built in tools?

Best Answer

You're missing an important piece of information here - which virtualisation hypervisor?

If it's VMWare there are both free, limited and paid, more-powerful, P2V convertors available that can create VMs native to VMWare or to the .OVA open virtual machine format.

Others will know the P2V conversion options for Hyper-V/KVM/Xen etc. better than I.

Related Topic