This is what I recently had to do, so I thought I would post about my experiences in case it might help someone else. The first question you may ask about this topic is, "Why?". I recently upgraded my server hardware and bought a new SAS controller that was not supported by ESXI. It was nearly half the price of all other similar RAID controllers, so I really did not want to have to return it and end up taking up multiple PCI Express slots with multiple cards.
A long time ago, I had used the original Hyper-V server 2008 and migrated to ESXi due to limitations in the original Hyper-V and due to the fact that I wanted to be able to use OVF/OVA templates. It turns out that the OVA files can just be extracted with 7-zip and there you have the disks and virtual machine information you need to convert the VMDK files to VHD files; however, I had never found this out until recently.
This brings us to the first issue...how to get your virtual machines from ESXi into Hyper-V. If you have the luxury of being able to have both servers online at the same time, the migration is really easy with several different tools. For most of us at home, this is not an option. I had been using the great free script, ghettoVCB, in a cron job on the ESXi host to back up my VM's to an eSATA dock with a drive in it and had used it for restore operations several times over the years.
Since the disks are converted offline, the CPU and memory assignments from the VM's in ESXi were recorded for VM creation once Hyper-V was installed. I used the ESXi client to download all the backups to an NTFS volume so I could read it from my Windows PC and access the backed up VMDK files. I ended up running into problems with one of my Ubuntu Server VM's after the conversion and had to install a new one from scratch.
This means I needed something that could read a VMDK file with Linux partitions from my Windows PC. For this part, I used Diskinternals Linux Reader that also supports VMFS volumes to access the VMFS volume and copy all the VMDK files from my backups.
Anyway, back to converting the VMDK files to VHD. There are quite a few tools available to perform this conversion, but the one I settled on was 2tware Convert VHD. It was easy to use, fast, and free!
At this point, I installed Hyper-V Server 2012 R2, performed initial setup, re-partitioned and formatted my RAID for VM storage and my backup disk, and configured remote management and remote desktop. I changed the default location for VHD and VM storage to point to my VM RAID in Hyper-V settings. Then, I shared my drive with the VHD files on it and used the Hyper-V Server CLI to transfer all the VHD files to the virtual hard disks directory and created my Virtual Machines; you should definitely enable dynamic memory on all your VM's. It works on Ubuntu 13.10 and up. Also, don't forget to update Integration Services on your VM's where needed and remove VMware Tools from them. No tools are necessary for Hyper-V in Linux, because they are built into the kernel.
With Hyper-V Server 2012 R2, configuring remote management and remote desktop is easy using the setup menu you see when you log in. You need to install Hyper-V Manager on the machine you want to use to manage your Hyper-V server from, in my case a Windows 8.1 PC. Then you can create a Microsoft Management Console to manage everything from one place. In this console, I put the following all pointing to the hyper-V server:
Hyper-V Manager
Computer Management
Group Policy
Windows Firewall
In order to access the Hyper-V server from your PC, you need to edit your %WINDIR%\System32\drivers\etc\hosts file and add an entry for your Hyper-V server, because it must be added by name rather than IP Address. It must also be in the same work group as the PC you are managing it from, or else you will need to update some firewall rules.
You will also want to create a share on your Hyper-V server for uploading ISO files for VM installations and such. This makes things much easier.
For scheduled backup of my VM's, I decided to use HV Backup after reading that the wbadmin tool places the VM in a saved state while backing it up. This was easy to set up; I just unzipped it and copied the folder into my upload directory from above.
I also needed to back up the OS on the Hyper-V server, which I was not doing on ESXi...shame on me! For this, I had to install Windows Server Backup using the command: dism /online /enable-feature:WindowsServerBackup.
When a backup task finishes, I wanted to receive an email stating that it was done so I could review the logs to make sure there were no errors. In order to be able to execute the PowerShell script, you have to enter the following at the Hyper-V Server CLI: set-executionpolicy remotesigned
I named the script SendEmail.ps1 and added the HV Backup log file as an attachment. Edit it as needed for your environment:
Write-Host "Sending Email"
#SMTP server name
$smtpServer = "<server_name_or_ip>"
$file = "lastlog_out.txt"
#Creating a Mail object
$msg = new-object Net.Mail.MailMessage
#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$att = new-object Net.Mail.Attachment($file)
#Email structure
$msg.From = "<from_email_address>"
$msg.ReplyTo = "<reply_to_email_address>"
$msg.To.Add("<to_email_address>")
$msg.subject = "<subject>"
$msg.body = "A backup task has completed. See log files at 'C:\Windows\Logs\WindowsServerBackup\' for information about the system backup. Refer to the attached file for details about virtual machine backups."
$msg.Attachments.Add($att)
#Sending email
$smtp.Send($msg)
$att.Dispose()
Here is where I created a batch script in the same directory that HV Backup was in. I called it HVBackup.bat and put the following lines in it where F: is the backup drive and C: is the OS drive. It first deletes any zip files older than 14 days in order to better manage space. I am managing the OS backups manually. Edit it as needed for your environment:
That was pretty much it. The server has been running great for me with all my storage disks passed through to my Windows Server 2012 Essentials VM, and network performance with DrivePool seems to be more stable so far than they were in ESXi with RDM disks. I hope this is helpful to someone.
Question
otispresley
This is what I recently had to do, so I thought I would post about my experiences in case it might help someone else. The first question you may ask about this topic is, "Why?". I recently upgraded my server hardware and bought a new SAS controller that was not supported by ESXI. It was nearly half the price of all other similar RAID controllers, so I really did not want to have to return it and end up taking up multiple PCI Express slots with multiple cards.
A long time ago, I had used the original Hyper-V server 2008 and migrated to ESXi due to limitations in the original Hyper-V and due to the fact that I wanted to be able to use OVF/OVA templates. It turns out that the OVA files can just be extracted with 7-zip and there you have the disks and virtual machine information you need to convert the VMDK files to VHD files; however, I had never found this out until recently.
This brings us to the first issue...how to get your virtual machines from ESXi into Hyper-V. If you have the luxury of being able to have both servers online at the same time, the migration is really easy with several different tools. For most of us at home, this is not an option. I had been using the great free script, ghettoVCB, in a cron job on the ESXi host to back up my VM's to an eSATA dock with a drive in it and had used it for restore operations several times over the years.
Since the disks are converted offline, the CPU and memory assignments from the VM's in ESXi were recorded for VM creation once Hyper-V was installed. I used the ESXi client to download all the backups to an NTFS volume so I could read it from my Windows PC and access the backed up VMDK files. I ended up running into problems with one of my Ubuntu Server VM's after the conversion and had to install a new one from scratch.
This means I needed something that could read a VMDK file with Linux partitions from my Windows PC. For this part, I used Diskinternals Linux Reader that also supports VMFS volumes to access the VMFS volume and copy all the VMDK files from my backups.
Anyway, back to converting the VMDK files to VHD. There are quite a few tools available to perform this conversion, but the one I settled on was 2tware Convert VHD. It was easy to use, fast, and free!
At this point, I installed Hyper-V Server 2012 R2, performed initial setup, re-partitioned and formatted my RAID for VM storage and my backup disk, and configured remote management and remote desktop. I changed the default location for VHD and VM storage to point to my VM RAID in Hyper-V settings. Then, I shared my drive with the VHD files on it and used the Hyper-V Server CLI to transfer all the VHD files to the virtual hard disks directory and created my Virtual Machines; you should definitely enable dynamic memory on all your VM's. It works on Ubuntu 13.10 and up. Also, don't forget to update Integration Services on your VM's where needed and remove VMware Tools from them. No tools are necessary for Hyper-V in Linux, because they are built into the kernel.
With Hyper-V Server 2012 R2, configuring remote management and remote desktop is easy using the setup menu you see when you log in. You need to install Hyper-V Manager on the machine you want to use to manage your Hyper-V server from, in my case a Windows 8.1 PC. Then you can create a Microsoft Management Console to manage everything from one place. In this console, I put the following all pointing to the hyper-V server:
In order to access the Hyper-V server from your PC, you need to edit your %WINDIR%\System32\drivers\etc\hosts file and add an entry for your Hyper-V server, because it must be added by name rather than IP Address. It must also be in the same work group as the PC you are managing it from, or else you will need to update some firewall rules.
You will also want to create a share on your Hyper-V server for uploading ISO files for VM installations and such. This makes things much easier.
For scheduled backup of my VM's, I decided to use HV Backup after reading that the wbadmin tool places the VM in a saved state while backing it up. This was easy to set up; I just unzipped it and copied the folder into my upload directory from above.
I also needed to back up the OS on the Hyper-V server, which I was not doing on ESXi...shame on me! For this, I had to install Windows Server Backup using the command: dism /online /enable-feature:WindowsServerBackup.
When a backup task finishes, I wanted to receive an email stating that it was done so I could review the logs to make sure there were no errors. In order to be able to execute the PowerShell script, you have to enter the following at the Hyper-V Server CLI: set-executionpolicy remotesigned
I named the script SendEmail.ps1 and added the HV Backup log file as an attachment. Edit it as needed for your environment:
Here is where I created a batch script in the same directory that HV Backup was in. I called it HVBackup.bat and put the following lines in it where F: is the backup drive and C: is the OS drive. It first deletes any zip files older than 14 days in order to better manage space. I am managing the OS backups manually. Edit it as needed for your environment:
That was pretty much it. The server has been running great for me with all my storage disks passed through to my Windows Server 2012 Essentials VM, and network performance with DrivePool seems to be more stable so far than they were in ESXi with RDM disks. I hope this is helpful to someone.
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.