Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 17 '09 at 17:14

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
I knew I was leaving something out. I would prefer VMWare, but really it doesn't matter. Xen would be fine as well. –  user26577 Nov 19 '09 at 0:36
    
This is definitely a case where knowing the proper terminology ("P2V") greatly helps in searching google. It looks like VMWare vCenter Converter is what I want to use, although with Linux, it can unfortunately only convert to VMWare Infrastructure, not to VMWare Server. Although I haven't had the time to get this working yet, I'm marking this as the accepted answer. –  user26577 Nov 19 '09 at 4:08

There's an unsupported script out that's published on a Red Hat URL. It basically is an ISO that boots from CD, sucks your network config from the HDD to get online, and then SCPs your filesystem to an awaiting host. It also sends a Xen config.

Works great. Once those files get transferred, you can fire them right up on your Xen server.

In a way this is safe, because you're doing read-only ops on your physical machine. But, if it's a production machine, the usual disclaimers apply. The only trouble I ran into was that I had to fiddle with the kernels so that I had *xen kernels on the new virtual machine instead of non-xen. That caused a bit of unexpected downtime but I wasn't working on a critical machine either.

This is definitely experimental, but it worked for me. If you have trouble, you can always fire the physical back up immediately.

PS: Be familiar with kpartx ahead of time, in case you need to get inside your disk images when they're not running.

http://people.redhat.com/~rjones/virt-p2v

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.