This night and this day i did finally made the migration of a ESXI-Server. Of course, i ran into a couple of problems which cost me the hole night. So, maybe, somebody else can use this step-by-step instructions in future to avoid this tons of googling, filtering, trying and so on.
So, here we go:
First Step: Export the VM’s of ESXI to an external location
For that purpose
– open the VMWare VSphere Client, and
– shut down the first VM you wanna migrate to the xen
– rightclick your vm and make sure that there is no CD-ROM/DVD-ISO attached – otherwise you may run into problems later!
– go to the datastore browser, browse to the location where your VM is stored, select nvram, vmdk, vmx and save it to an external local connected usb-disk (or wherever you wanna go…).
maybe you only need the vmdk-file, but for sure i did save the small other files also! dont worry about the file-size of the vmdk-file. the export-process generates a new file called filename-flat.vmdk which contains the complete data of your virtual machine.
Repeat this steps for all your vm’s you wanna export.
Second: Setup XenServer
After i’ve savely exported all vm’s and converted them already in ovf, which is not necessary!, downloaded the xen-server 6.5 iso and burned it on a disk, i began yesterday evening with killing the old esxi.
The following information is only important if you also using a HP Server with a P400 Controller:
First i wanted delete the two RAID5 Arrays, that we created because our old ESXI could not use drivers larger then 2TB, to create one big new one. The Array’s were both in a fail-state. when i booted the machine, i was asked if i wanna repair the Array or not. i actually don’t remember what i did choose, because i did care as i wanted to delete the arrays anyway, but at the next step after pressing F8 to enter the RAID-Config-Tool, choosing the first array i wanted to delete after pressing F3 to Delete the Array i got: FATAL ERROR Command C0. I plug out the regarding drives, and tried again, now with success, but as i plugin the drives back in, the array was back there (because the information is stored on the drives, not on the controller, i suppose). so i tried again and run into same error code. i rebooted, and choosed “repair” on boot, and after some tries i could delete the arrays! dont worry if you see the information “saving configuration” for a couple minutes – this is normal! (i aborted first time, because i thought the system crashed…). after creating the raid5 the third time without the bad two drives i started to install the xen server.
I ran into the next problem after i passed the first three screens: “could not parse sgdisk”. after googling arround i found the information, that this is caused by the ESXI-Partitions which XEN can not handle! so, before you boot the xen-server-setup the first time do the following:
– boot Ultimate Boot CD (or any other software, which can wipe disks)
– wipe the first sectors of every disk or array that you have inside your system
– now boot the free xen-sever setup disk (in my case 6.5, downloaded from www.xenserver.org)
Attention: if you wanna use larger drives then 2TB you should put the installation on a separate smaller array, because (i didn’t checked this, but i read it, and was very happy, that i had done this anyway) xen can’t handle disks greater then 2TB.
In my case the setup was done on the extra RAID1 with two SCSI 78GB drives.
Third: InitIalize the additional RAID5 >2TB as SR
After logging in the first time in the XenCenter (after reset the password locally which was entered with CAPSLOCK enabled…damn…) i did miss space for importing my machines.
i started googling arround and found information that, xen does not support creating GPT-Table and disks greater 2TB… so booted the UBCD again and started gparted. meanwhile i read that xenserver IS possible to create disks, so i aborted the Gparted-thing and bootet into xen server again. after collecting information from different sites i did the following very well working steps to get access to the separate RAID5:
– logon to the xen shell using putty (or whatever you like)
– determine the disk name with: ls -hal /dev/cciss/
you should see a list of drive names. that one which ends with XXXp1, XXXp2, etc. are partitions of the first disk already created from the installer. there should be another disk without addiditional entrys ending on p1, etc. this should be your big RAID-drive.
– run: gdisk /dev/cciss/your-drive-name (in my case it was: gdisk /dev/cciss/c0d1)
– press n (for new partition)
– press ENTER (default first partition number)
– press ENTER (default first sector)
– press ENTER (default last sector)
– press ENTER (default hexcode)
– press w (for save)
– press Y (to accept)
– finally you can check if partition was created: ls -hal /dev/cciss/ – you should see something new ending on p1 – in my case c0d1p1
– run: pvcreate /dev/cciss/your-partition (in my case /dev/cciss/c0d1p1)
– run: xe sr-create content-type=user type=ext device-config:device=/dev/cciss/your-partition shared=false name-label=”your name for the new sr”
in my case it was: xe sr-create content-type=user type=ext device-config:device=/dev/cciss/c0d1p1 shared=false name-label=”XenSpace”. The second time i did this, this process takes up to an hour (on a 4TB array), because in background mkfs.ext did ran and take a while to finished – i don’t knwo why this command was finished in seconds the first time (where i had the failed drives inside the array).
here we go: after that step you have a brand new empty SR you can use inside your XenCenter!
Fourth: Do the Import
Now you can began import your machines, but before doing that you should set a default SR! if you do not, you will run into “Failed to Import” without additional information inside xencenter – even googling will not show you the information, that you just have to select a default-SR first! i found the information while i was trying to install the transfer VM using a command on the shell to solve the problem…….. so just:
– rightclick on your new SR under “Local Storage Repositories” and click on “set as default” (right now i cannot find the button anymore, but i think it was this way to do it..)
Now you are ready to import!
– Click on File->Import…-> and browse to your vmdk-file. make sure, that you don’t select the big xxx-flat.vmdk – you need to select the small one without the flat-ending!
– proceed the next steps of the import-wizard.
– if you don’t have an active working DHCP-Server, make sure that you enter a valid IP-Address of your subnet (and valid gateway if target is outside…) under transfer VM Settings, otherwise the import will fail!
the newer versions of xen does start an little VM for the import-process, to avoid lagging on the dom0, because the import-process uses all resources it got’s …
this process can take a while, espessialy if you are working not locally, of course. lean back while the machine does makes his job and drink a cofee.
Optional: Create ISO-Repository:
If you need a ISO-Repository also, you can go on and do the following:
– go over to your putty
– mkdir /ISOS/
be warned! the partition created by xen-installer is only 4GB (in my case), should not be resized (read that here), so it is a good idea to create a new partition for that (using gdisk and mkfs.ext3 ….) and mount it to the new directory! otherwise you will run out of space very fast, and get errors like me… “The Underlying Xen API xapi is not running. This console will have reduced functionality”
so….if you have created the partition you can go on:
– xe sr-create name-label=ISOS type=iso device-config:location=/ISOS/ device-config:legacy_mode=true content-type=iso
now you can upload your ISOS using scp (or in my case the pscp.exe – can be downloaded from putty-website, same syntax like scp on linux…)
– scp your-setup-image.iso root@ip-or-hostname-of-your-xen-server:/ISOS/your-setup-image.iso
after that is done you can choose them in new vm’s as setup-source.
MISC: Fix Boot-Problems in PFSense / FreeBSD
if you migrate a pfsense (based on FreeBSD) maybe it will not boot because it cannot find the root filesystem.
this is because the name of the disk-device can change (it did in my case everytime)
you will get an error like this:
ROOT MOUNT ERROR: If you have invalid mount options, reboot, and first try the following from the loader prompt:
the solution is simple.
– just press the ? key and hit enter. you will see a little list of available devices. in my case the right device was ad0s1a (before migration it was da0s1a or something like that….
– now type in: set vfs.root.mountfrom=ufs:/dev/ad0s1a and hit enter.
– type in: boot
now everything should came up normally. for making the changes permantent do…
– vi /etc/fstab
… and make the same changes.
if you are not familar with vi: press i for insert-mode before you type, ESC to exit insert-mode, and type ESC:wq! to save the file.
MISC: FIX Network Performance-Problems with pfSense 2.2 on Xen6.5 in all VM’s and aswell at the LAN
iv’e seen VERY poor network connection. while i was copy some files from my local client to an VM my tv wasn’t able to play movies which are located at the same VM. On Dom0 FTP-Download was VERY slow (needed 20 seconds to just initialize the connection itselfes..)- …do. Also yum was not able to get Update.xml file because of an timeout!
Identify the UUID of your pfSense
identify the uuid of the VIF’s of your pfSense:
xe vm-vif-list uuid=UUID_of_your_VM
Disable the offload settings for both interfaces (LAN + WAN):
xe vif-param-set uuid=VIFUUID other-config:ethtool-gso=”off”
xe vif-param-set uuid=VIFUUID other-config:ethtool-ufo=”off”
xe vif-param-set uuid=VIFUUID other-config:ethtool-tso=”off”
xe vif-param-set uuid=VIFUUID other-config:ethtool-sg=”off”
xe vif-param-set uuid=VIFUUID other-config:ethtool-tx=”off”
xe vif-param-set uuid=VIFUUID other-config:ethtool-rx=”off”
shutdown / start the VM
everything is working fine now
MISC: Monitor the P400 RAID-Controller state
to avoid running into The zlib package or binaries are missing! while executing hpsmh-setup and while zlib is already installed execute:
ln -s /lib64/libz.so.1 /usr/lib/libz.so.1
to avoid running into Starting hpsmhd: /bin/bash: /opt/hp/hpsmh/sbin/smhstart: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory do the following:
ln -s /lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2
to avoid running into dependency problems do:
yum –enablerepo=base install glibc libgcc libstdc++
rpm -ihv hpsmh-7.3.0-9.i386.rpm
rpm -ihv cpqacuxe-9.40-12.0.i386.rpm
rpm -ihv hpacucli-9.10-22.0.i386.rpm
at least iam not shure if i needed to install hpsmh and cpqacuxe. the hpsmh service didn’t start and crashes with an segmentation fault (maybe because i linked th ld-linux-x86-64.so.2 against the ld-linux.so.2. maybe this tools are dependencies for hpacucli which gives me usefull output when executing following command:
hpacucli controller slot=1 physicaldrive all show
i used this code to write a little cronscript which informs me on failures which was everything i was interested in at this time. maybe you need to install hspa driver aswell (i did this before, but i think it is not necessary at all..)
here’s my little very basic script. it just checks if the output contains the word “Failed” and if so, sends a mail out.
just create a new file with
and insert the following code:
hpacucli controller slot=1 physicaldrive all show > /tmp/hpraidreport
if grep -q -E ‘Failed|Rebuilding’ “/tmp/hpraidreport”; then
echo “To: email@example.com” > /tmp/hpraidreportmail
echo “From: firstname.lastname@example.org” > /tmp/hpraidreportmail
echo “Subject: Achtung, RAID-Controller-Fehler!” > /tmp/hpraidreportmail
cat /tmp/hpraidreport >> /tmp/hpraidreportmail
/usr/sbin/ssmtp email@example.com < /tmp/hpraidreportmail
after saving you should change permission of this file, otherwise cron cannot execute it. a 700 should do the job… i choosed 777 ……
chmod 777 /etc/cron.hourly/hpmon.sh
edit /etc/ssmtp/ssmtp.conf for making the mail-sending-tool working if not done already!
MISC: Fix bad IO-Performance within the HP P400 Controller
we ran into very poor IO-performance about 5MB/s from the Windows-VM. I started googling arround.
Install the VM-Tools didn’t change anything, but enable the cache pushed me to ~20/30MB/s
just juse the previously installed hpacucli to do this:
hpacucli controller slot=1 show config detail
i had the following output: Cache Status: Temporarily Disabled and i was able to enable it with
hpacucli controller slot=1 modify nbwc=enable
i had todo this because the installed battery-unit is kind of old and bad.
i did also enable the Drive Write Cache by executing
hpacucli controller slot=1 modify dwc=enable
but this did not make signifcant changes.