PW nie wyslales, wiec nie wiem czy sobie poradziles czy nie. Niemniej jednak moze wkleje to co kiedys napisalem odnosnie p2v dla linux o/s. Jesli komus sie przyda to dobrze.
Linux P2V howto
Grzegorz Kulikowski 16.07.2008
Vmware converter option
Partimage option
1). Vmware converter option
There is a chance that vmware converter will be able to define the operating system on physical box(linux). We still do not know what is the % of linux that can we understood by vmware converter. For example on a box with fedora 5 , converter had no problems with converting it to virtual machine. On a machine with Centos 4.6 convert could not figure out what operating system is installed and the conversion was not started.
If the conversion starts without any problems below steps are to be taken to complete p2v.
go to www.sysresccd.org/ and download latest system rescue cd. It is a bootable linux that has many handy tools that will help us in later steps.
Be sure that you have the first CD from your linux distribution, or special rescue cd from the linux distribution that you are using
In order to boot the linux system again, we must boot the VM from the first cd from installation set in rescue mode . After that we have to boot machine in rescue mode, usually you boot the cd with : “linux rescue” but that can depend from distribution.
After step (c) installer should tell you that he found operating system on your drive and it is ready to be chrooted in : /mnt/sysimage (this is usual place for that)
If installer will not tell you that he has found existing OS, then you have to mount it manually in /mnt/sysimage : mount /boot , / in /mnt/sysimage . type fdisk –l , if you want to see what partition will be used. After mounting it manually, or having it mounted by installer type : “chroot /mnt/sysimage/”
After last issued command you are inside of your linux which resides on the disk so watch our for commands as they are affecting your new VM.
You have to gather information whether your linux is supporting buslogic or lsilogic. If you have this information edit your /etc/modules.conf (or modprobe.conf depends from distribution). Be sure that you change all aliases starting from scsi, to a module “BusLogic” , watch for the capital letters as they matter. If you know that you want to use lsi logic then, change modules for “mptscsih”. Also be sure ! that all network aliases are changed to pcnet32 module.
Now: we have to create new initial ram disk according to new modules that we want to have available when booting : for buslogic I suggest : “ mkinitrd –v –f /boot/YOUR-KERNEL.img YOUR-KERNEL “ in case of lsi logic I suggest : “mkinitrd –v –f --preload mptbase /boot/YOUR-KERNEL.img YOUR-KERNEL” .
Be sure that this corresponds with your kernel that you will use, if you have more than 1 kernel, make sure that you are creating initrd for that actual kernel. To check whether you have one or more kernels go to: /boot/grub/grub.conf and read this file, be sure if you need to use smp or not, and if you have more than 1 kernel check the option :”default” which corresponds with which kernel should be used. Check if correct disks are given for grub to operate on !
If all above steps are completed we have to rewrite mbr. Run “grub” , and within grub write : “ root (hd0,0) “, after this issue save : “setup (hd0)” . and exit & reboot.
For figuring out the hd numbers : hd0 means “A” ,1-“B”,2-“C”,3-“D” so: sda is hd0 , sdb is hd1, and so one, about the partition number : hd0,0-> the second zero is like 1, so hd0,0 is sda1 , if hd0,1 then sda2 . , if hd1,0 sdb1 . Be sure to specify the /boot partition. Usually /boot is the first partition so my guess is that this will be : hd0,0 . But it is not a must.
If you encounter some additional errors I suggest to read below links :
http://www.vmware.com/support/esx21/doc/esx21admin_lsilogic_vms.html
http://virtualaleph.blogspot.com/2007/05/virtualize-linux-server-with-vmware.html
http://communities.vmware.com/blogs/JoeHan/2008/06/11/successful-physical-to-virtual-p2v-conversion-of-linux-boxes-with-vmware-converter
http://conshell.net/wiki/index.php/Linux_P2V
about grub
http://www.sorgonet.com/linux/grubrestore/
http://orgs.man.ac.uk/documentation/grub/grub_3.html
2. Partimage option
a) If in case vmware converter can’t recognize the system, we will use partimage.
b)Download system rescue-cd mentioned in 1)-a) . Boot the machine from sysres cd. Be sure that you have where to store the saved partition images.
c)About the storage for partition images :
c1: on netapp storage, request for a nfs share with write/read . withing the rescue cd configure network connection as : net-setup eth0 / net-setup eth1 / net-setup ethX . After you have configured network connection create a directory : “cd $HOME && mkdir test “ , after this : “mount IP_NFS_SHARE:/X/Y/ test/” where x and y are shared volumes from netapp. Make shure that you enter directory test : “cd test/” , and while being in test/ directory you run partimage. To run it, just type in console : “partimage”. Within partimage select partition to be saved on disk, specify filename, and press F5, select compression mode for the file, and again F5. Repeat this step with partimage until you have all partitions saved. Umount your test/ directory. Remember that you can not save a swap partition. See what is it’s size and write it down it will be needed in later steps. Create a new VM specifying linux system, and the scsi adapter(buslogic/lsi). Create a new virtual disk. Boot the vm from rescue cd. Setup the network. Do : “cd $HOME && mkdir test”. Then mount the directory with images through nfs: “mount IP_NFS_SHARE:/X/Y test/”. Enter the test/ directory. Run gparted, to create the partition on which you will be copying the images. Remember to create also a swap partition. Run partimage, and resport partitions on the new ones which we have created.
C2: if you know that you still have some free space on the disks, you can create an ext3 partition just for storing the partition images. Being in rescue cd system, type:”gparted” and create another partition from free space. After you have create a partition. Mount this partition : “cd $HOME && mkdir test && mount /dev/sdXY test/” where x and y are the disk and partition number. Remember to enter the test directory before you run partimage :”cd test/” . Run partimage and save the partitions . Your partitions images are now ready to copy them via scp to esx on which you will host the vm. In Virtual Center create a new VM and specify whether you will you lsi or buslogic in vm “edit settings”. Besides creating a new disk for the linux machine, create a second disk that we will use to copy partition images on it. Boot the new vm from rescue cd. Setup network, and copy via scp, partitions images from esx, to the 2nd disk you have created for this vm. Remember to partition it first using gparted and then mount it as a filesystem. If you have now your partition images on the second virtual disk, you can create partitions using gparted on the first virtual disk, remembering the size of previous partitions from physical box. If this is done, go to the directory where you have mounted second disk with images. And from there run partimage, and restore the partitions onto the first disk. As we did not copy the swap partition , we also now create using gparted a partition for new swap. Make the same size partition as on physical box.Your linux machine disk is now created. In VM edit setting delete the second virtual disk.
d) The configuration of mbr/initrd/modules is the same as in the procedure per converter linux p2v, see section 1).
If you need more informations about partimage go to :
www.partimage.org/
Sorry ze w eng, ale pisalem to tylko w eng, jak ktos che przetlumaczyc to be my guest :smileywink:. Jesli beda jakies problemy to daj znac, postaram sie pomoc.