Showing posts with label HyperV. Show all posts
Showing posts with label HyperV. Show all posts

Monday, January 3, 2011

Installing CentOS 5.5 with Linux Integration Services 2.1 on Hyper-V R2

Hyper-V R2 brings some powerful virtualization to the table for those of us who do not have either the skills or the desire to work with virtual machineware. Most fans of Hyper-V are also likely to be well versed in Windows and may often lack the knowledge to rummage through Linux. Although there are many resources available regarding Linux on Hyper-V, I felt that most assumed the reader had intimate knowledge with Linux, which is often not the case.

For Windows administrators new to Linux who wish to provide virtualized services to their end-users, my recommendation is to stick to CentOS 5.5. Being a close derivative of Red Hat Enterprise Linux (RHEL), the officially supported distribution by Microsoft, installation of the Integration Components is simplified and stability is matched to what is found when running RHEL.

You will need the CentOS 5.5 x64 installation DVD ISO (CentOS-5.5-x86_64-bin-DVD-1of2.iso) which can be found at http://isoredirect.centos.org/centos/5/isos/x86_64/.

You will also need the Linux Integration Services 2.1 ISO (LinuxIC v21.iso) available through the Microsoft Download Center at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eee39325-898b-4522-9b4c-f4b5b9b64551.

To create the initial virtual machine, you will need to use the Legacy Network Adapter and limit yourself to a single CPU. You will also want to take time to decide how large of a VHD to allocate ahead of time as expanding a Linux partition can be a little complicated. Personally, I find 20GB to be sufficient for small, single purpose Linux virtual machines.

After booting from the CentOS ISO, you are presented with the choice to do a graphical or a text mode installation. To choose the text mode installation (as used here), simply type “linux text” at the boot: prompt and hit enter.

To navigate throughout the next portion of the text mode installation, use the Tab key to navigate between fields and the Space key to select options or hit buttons.

You will be asked if you would like to do a media test. You can safely skip this.

The initial welcome screen to the installation process.

Choose your language as appropriate.

And your keyboard.

You must then partition your VHD for Linux. As you will be starting off with a fresh VHD, you can simply choose “Use free space on selected drives and create default layout.” and continue with OK.

Be sure to hit No to continue as hitting Yes will simply bring you back to the previous screen.

As long as you have properly configured your virtual machine to use the Legacy Network Adapter, you will be presented with the opportunity to have the installation configure it for you.

Check the “Enable IPv4 support” option and hit OK to continue.

Switch to the “Manual address configuration” option and enter your IP address and netmask as appropriate.

Continue on by entering your default gateway (usually your router or your network’s default route). If you have internal DNS servers for your network, enter them here or alternatively, you can use OpenDNS.

The name of your virtual machine is defined here as the hostname.

Select your time zone and continue.

Be sure to choose a secure root password as the root user has complete access to the entire virtual machine and SSH is enabled on first boot.

For a bare minimum installation, uncheck all of the packages, check “Customize software selection” and hit OK.

Uncheck all package groups and continue. Anything you require can later be installed by yum anyway.

Installation will begin once you continue past this screen.

Once installation is complete, you will be required to reboot.

After rebooting, you will be ready to login. At this point, I recommend connecting via SSH in order to copy and paste commands.

The first thing that must be done is to update all the base packages and upgrade the kernel to the latest version. Simply run a “yum update”, then reboot.

yum updatereboot

You will need to install the required packages “kernel-devel”, “gcc” and “make” packages to compile and install the Linux Integration Components. Also, I suggest installing the VIM text editor.

yum install kernel-develyum install gccyum install makeyum install vim-enhanced.x86_64

Attach the Linux Integration Services ISO. Once attached, you will need to mount the cdrom. You must then copy and compile the source in a temporary folder. Finally, you will be able install the Linux Integration Components. “make” will compile the source, then “make install” will install the compiled drivers.

mkdir -p /mnt/cdrommount /dev/cdrom /mnt/cdromcp -rp /mnt/cdrom /opt/linux_icumount /mnt/cdromcd /opt/linux_icmakemake install

The time synchronisation component is not compatible with CentOS, therefore you will need to install “adjtimex”.

yum install adjtimex

You will need to shutdown the virtual machine in order to enable the Synthetic Network Adapter and increase the number of CPUs allocated. To do so, run the shutdown command.

shutdown -h -t 0 0

Change the settings in Hyper-V once the virtual machine has completely shutdown.

Start the virtual machine and log in. You will need to reconfigure the network adapter as “eth0? will have disapeared and a new adapter, “seth0?, will have taken its place.

The easiest way to do this is to edit the MAC address in the “eth0? backup file to match the MAC address of the Network Adapter as displayed in the virtual machine settings in Hyper-V, then copy the backup file as “seth0? and restart the network service.

vi /etc/sysconfig/network-scripts/ifcfg-eth0.bak(edit HWADDR)(save and exit)rm -f /etc/sysconfig/network-scripts/ifcfg-seth0mv /etc/sysconfig/network-scripts/ifcfg-eth0.bak /etc/sysconfig/network-scripts/ifcfg-seth0service network restart

If all went well, you will find yourself with a bare minimum install of CentOS 5.5 running the latest kernel and version 2.1 of the Linux Integration Services. Fully virtualized and synthetic. You can now enjoy the many benefits of Hyper-V Linux such as the ability to shutdown the virtual machine without the root password.

Friday, November 5, 2010

Hyper-V Virtual Machine Failed to Start after Copying VHD

Hyper-V Virtual Machine Failed to Start after Copying VHD


On Windows Server 2008 R2 running Hyper-V, I copied a VHD to an external drive using Windows Explorer. After compacting the drive, I copied the VHD back to its original location and tried to start the virtual machine. I got a long message telling me that the virtual machine failed to start due to an access denied error.


The Message

Here are the important bits of the message, along with the corresponding event IDs in the Hyper-V-Worker Admin event log:



‘VM01’ failed to start.


Microsoft Emulated IDE Controller (Instance ID {…}): failed to Power on with Error ‘General access denied error’ (0×80070005). [Event ID 12010]


IDE/ATAPI Account does not have sufficient privilege to open attachment ‘D:\Virtual Machines\VM01\Virtual Hard Disks\DRIVE01.VHD’. Error: ‘General access denied error’ (0×80070005). [Event ID 12290]


‘VM01 failed to start. (Virtual machine ID 6B78D45F5-71DF-4725-B4B2-E651800BE80EF) [Event ID 12030]


Okay, so I understand that it can’t access the VHD file. But what is the “IDE/ATAPI Account”? I see no such account in the list of available users and groups when I try to modify the VHD file’s permissions using the GUI. What I do see, when I examine the permissions of a working VHD, is what looks like a GUID as a user name with Read and Write permissions:


Hyper-V VHD Permissions GUI

Virtual Machine SID

It turns out that the virtual machine’s unique identifier (SID) actually needs direct access to the file. The details are in this Microsoft knowledge base article:


Hyper-V virtual machines may not start, and you receive an error: “‘General access denied error’ (0×80070005)”
http://support.microsoft.com/kb/2249906

Update the Permissions

The solution is to give the SID Full control of the VHD using the command line.


Tip: Rather than type (or mistype) the SID by hand, cut and paste it from the event log message or from the XML file name in the Virtual Machines folder.


The command:


icacls /grant "NT VIRTUAL MACHINE\":F


Note that there is no space before the :F. For example:


icacls "D:\Virtual Machines\VM01\Virtual Hard Disks\DRIVE01.VHD" /grant "NT VIRTUAL MACHINE\6B78D45F5-71DF-4725-B4B2-E651800BE80EF":F


Once that permission has been added, you should be able to start the virtual machine.

Thursday, November 4, 2010

Hyper-V Failed to Compact VHD

Hyper-V Failed to Compact VHD | MCB Systems office 619-523-0900
toll-free 888-4-MCBSYS
toll-free 888-462-2797MCB SystemsYour Small Business Technology Specialist HomeServicesServices OverviewProactive I.T. ServicesMCB Proactive WatchMCB Proactive CareI.T. Services ComparisonI.T. Services Case StudySoftware ServicesCustomization Case StudyProgramming Case StudyConsulting ApproachAboutContactBlogUser BlogTech Blog Home \ Tech Blog \Hyper-V Failed to Compact VHD Hyper-V Failed to Compact VHDMark BerryOctober 8, 2010

On Windows Server 2008 R2 running Hyper-V, I’m trying to compact a (dynamically expanding) VHD on an external hard drive (USB drive, NTFS format). The drive is 59GB and there is 103GB free on the drive. I keep getting the message, "The system failed to compact .VHD. Error code:  The requested operation could not be completed due to a file system limitation." Why can’t I compress the VHD?

In the Hyper-V-Image-Management-Service Admin log, we have Event ID 15054:

Log Name:  Microsoft-Windows-Hyper-V-Image-Management-Service-Admin
Source:  Microsoft-Windows-Hyper-V-Image-Management-Service
Event ID:  15054
Level:  Error
User:  SYSTEM
Description:  ‘The system failed to compact ‘F:\.VHD’. Error Code: 2424869

I thought maybe the physical drive was too fragmented, but a defrag ran quickly and made no difference.

This blog post provides the answer:  the VHD contains VSS shadow copies. (It’s a Server 2003 with Volume Shadow Copies enabled.)

Start up the virtual machine and log on to the guest. Run vssadmin list shadows to check for shadow copies. Run vssadmin delete shadows /all to delete the shadow copies. Then shut down the virtual machine guest and try compacting again.

Tags: hyper-v
This entry was postedon Friday, October 8th, 2010 at 4:28 pmand is filed under IT Administration.You can follow any responses to this entry through the RSS 2.0 feed.You can leave a response, or trackback from your own site. Leave a ReplyClick here to cancel reply.
Name (Required)
E-mail (will not be published) (Required)

Website

About

Welcome to the Tech Blog!

MCB Systems is a San Diego-based provider of information technology and software services.

We are based in Point Loma, close to downtown San Diego, Ocean Beach, Pacific Beach, and Mission Valley.

This Tech Blog is geared towards I.T. professionals, but end users may be interested to glimpse what goes on "behind the scenes" in keeping their computing environments stable and secure. A User Blog is also available.

Mark BerryBlog author Mark Berry owns MCB Systems.

Contact MCB Systems.

Recent PostsHow to Repair the SBSMonitoring Database Where to Find CHKDSK Results VSS Errors While Formatting Drive PowerEdge 1500SC: Bogus Memory and Linux Errors Activate Windows 7 Enterprise with a MAK Key – GUI Method Windows 7 UAC Blocks DRAC II Web Console Hyper-V Virtual Machine Failed to Start after Copying VHD Hyper-V Failed to Compact VHD How to Duplicate Administrator Permissions on Server 2008 R2 Reset Roaming Profile and Folder Redirection Permissions SubscribeSubscribe to the MCB Tech Blog with RSSApply to be a Chitika Publisher!