VMware Communities
kirkande
Contributor
Contributor
Jump to solution

How to Convert Linux host to Virtual Machine

I am running a linux kernel 32 bit OS and I would like to convert this OS to a virtual machine to run in VMware. Is this possible and if so how?

Thanks,

Kirk

0 Kudos
1 Solution

Accepted Solutions
dwight
Enthusiast
Enthusiast
Jump to solution

This is certainly possible. The easiest method use disk imaging software such as ghost to image the Linux host and restore the Image into a VM.

However, if you really know what you are doing it is possible to move a running Linux system over to a VM using a live CD and a number of internal commands. Off the top of my head the process I've used in the past was:

1. Set up a VM with sufficent disk space.

2. Boot the VM using a Linux LiveCD distro of the same architecture as the host being migrated (make sure you use a 64 bit distro if migrating a host running 64 bit linux)

3. Partition the disk using the fdisk command

4. Run partprobe to have the kernel reprobe the partition table.

5. Newfs all the filesystems

6. Mount the new filesystems

7. Make sure the networking is working properly

8. Use rsync or ssh/star to copy the files to the VM over the network to the filesystems just created. Rsync is nicer in that you can run it more than once and it will only copy things that have changed. However, if you are using extended attributes or selinux you will have to use ssh/star to do the copy. If you have any changing data on the physical machine you will need to shutdown the services changing disk files prior to doing the copy with ssh/star or prior to running rsync a second time (the second rsync will only copy the changes which can significantly decrease the overall downtime)

9. Edit the grub menu.lst or lilo.conf to be correct the boot loader configuration.

10. Install the grub or lilo boot block (depending on the boot loader being used)

11. Correct the hostname and IP address if they are changing.

12. Shutdown the physical machine

13. Shutdown the VM

14. Detach the LiveCD from the VM.

15. Boot the new VM.

Obviously the second method is a lot more difficult.






RHCE, VCP

Blog: http://computing.dwighthubbard.info

RHCE, VCP Blog: http://computing.dwighthubbard.info

View solution in original post

0 Kudos
2 Replies
dwight
Enthusiast
Enthusiast
Jump to solution

This is certainly possible. The easiest method use disk imaging software such as ghost to image the Linux host and restore the Image into a VM.

However, if you really know what you are doing it is possible to move a running Linux system over to a VM using a live CD and a number of internal commands. Off the top of my head the process I've used in the past was:

1. Set up a VM with sufficent disk space.

2. Boot the VM using a Linux LiveCD distro of the same architecture as the host being migrated (make sure you use a 64 bit distro if migrating a host running 64 bit linux)

3. Partition the disk using the fdisk command

4. Run partprobe to have the kernel reprobe the partition table.

5. Newfs all the filesystems

6. Mount the new filesystems

7. Make sure the networking is working properly

8. Use rsync or ssh/star to copy the files to the VM over the network to the filesystems just created. Rsync is nicer in that you can run it more than once and it will only copy things that have changed. However, if you are using extended attributes or selinux you will have to use ssh/star to do the copy. If you have any changing data on the physical machine you will need to shutdown the services changing disk files prior to doing the copy with ssh/star or prior to running rsync a second time (the second rsync will only copy the changes which can significantly decrease the overall downtime)

9. Edit the grub menu.lst or lilo.conf to be correct the boot loader configuration.

10. Install the grub or lilo boot block (depending on the boot loader being used)

11. Correct the hostname and IP address if they are changing.

12. Shutdown the physical machine

13. Shutdown the VM

14. Detach the LiveCD from the VM.

15. Boot the new VM.

Obviously the second method is a lot more difficult.






RHCE, VCP

Blog: http://computing.dwighthubbard.info

RHCE, VCP Blog: http://computing.dwighthubbard.info
0 Kudos
kirkande
Contributor
Contributor
Jump to solution

Thank you for the information. I did not think about the 2nd method.

0 Kudos