Search This Site

Pages

Tuesday, November 16, 2010

Changing UID of virtual Hardisk of Virtual Box

The situation of changing the UID of virtual Hardisk of Virtualbox arises when you want to use the existing hard disk to create a new virtual machine(VM) without going through the whole process of installing the OS. The virtualbox simply don't accept the existing hard disks. To get around that you need to change the virtual hard disks UID(Unique Identifier). The virtualbox provides you with this facility inside it's package. Follow these steps:

a) Open command prompt: Start->run->cmd
b) Go to the path where your virtualbox is installed which is normally is in your
c:\program files.
Type "cd D:\Virtual-Box"
c) Once inside the directory type in:

"VBoxManage internalcommands setvdiuuid d:\Vm-HDD\Win-2003-Server-adc.vdi"

Note: VBoxManage is the application which changes the UID of the hard disk.
"d:\Vm-HDD" is the location where you store your virtual hard disks.
"Win-2003-Server-adc.vdi " is the name of your harddisk. So change it according to your virtual hard disks name.

Hardware Interrupts taking high CPU

First of all Check with the utility from "sysinternal" called "Process Explorer", google it and download it. If it is showing that Hardware Interrupts is taking the CPU, then you to follow the below steps.

If your problem is having the following similar characterstics i.e:

a) Copying a large file within a drive for eg. C: drive giving only 2-5 mb speed.
b) Your Hard Disk is working in PIO transfer mode instead of Ultra DMA mode.
# To check right click on "My Computer"
# Click on Manage ->Device Manager
# On the right pane, expand IDE ATA/ATAPI controller
# Right Click on primary or secondary IDE controller on which your HDD is connected to.
# Click on" Advanced Setting" Tab
# If your HDD is connected to "Device 0" or "Device 1" check it's "Transer Mode" is set to " DMA if available" and "Current Transerfer mode" is Ultra DMA mode.

Note: PIO mode is the slowest of all and windows OS set it to PIO when 6 times CRC error happens.

Solution: Copy the following visual basic script and paste it to a text file and save it with the extension ".vbs" Eg. "resetDMA.vbs". Click on the file and click ok and the manually reboot. And then to check it follow the above steps to see if the HDD current transfer mode has come back to "Ultra DMA Mode".
To double check copy a large file and you will notice the speed by yourself.

VB Script
===================================================================
' Visual Basic Script program to reset the DMA status of all ATA drives

' Copyright © 2006 Hans-Georg Michna

' Version 2007-04-04

' Works in Windows XP, probably also in Windows 2000 and NT.
' Does no harm if Windows version is incompatible.

If MsgBox("This program will now reset the DMA status of all ATA drives with Windows drivers." _
& vbNewline & "Windows will redetect the status after the next reboot, therefore this procedure" _
& vbNewline & "should be harmless.", _
vbOkCancel, "Program start message") _
= vbOk Then

RegPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\"
ValueName1Master = "MasterIdDataChecksum"
ValueName1Slave = "SlaveIdDataChecksum"
ValueName2Master = "UserMasterDeviceTimingModeAllowed"
ValueName2Slave = "UserSlaveDeviceTimingModeAllowed"
ValueName3 = "ResetErrorCountersOnSuccess"
MessageText = "The following ATA channels have been reset:"
MessageTextLen0 = Len(MessageText)
ConsecutiveMisses = 0
Set WshShell = WScript.CreateObject("WScript.Shell")

For i = 0 to 999
RegSubPath = Right("000" & i, 4) & "\"

' Master

Err.Clear
On Error Resume Next
WshShell.RegRead RegPath & RegSubPath & ValueName1Master
errMaster = Err.Number
On Error Goto 0
If errMaster = 0 Then
On Error Resume Next
WshShell.RegDelete RegPath & RegSubPath & ValueName1Master
WshShell.RegDelete RegPath & RegSubPath & ValueName2Master
On Error Goto 0
MessageText = MessageText & vbNewLine & "Master"
End If

' Slave

Err.Clear
On Error Resume Next
WshShell.RegRead RegPath & RegSubPath & ValueName1Slave
errSlave = Err.Number
On Error Goto 0
If errSlave = 0 Then
On Error Resume Next
WshShell.RegDelete RegPath & RegSubPath & ValueName1Slave
WshShell.RegDelete RegPath & RegSubPath & ValueName2Slave
On Error Goto 0
If errMaster = 0 Then
MessageText = MessageText & " and "
Else
MessageText = MessageText & vbNewLine
End If
MessageText = MessageText & "Slave"
End If

If errMaster = 0 Or errSlave = 0 Then
On Error Resume Next
WshShell.RegWrite RegPath & RegSubPath & ValueName3, 1, "REG_DWORD"
On Error Goto 0
ChannelName = "unnamed channel " & Left(RegSubPath, 4)
On Error Resume Next
ChannelName = WshShell.RegRead(RegPath & RegSubPath & "DriverDesc")
On Error Goto 0
MessageText = MessageText & " of " & ChannelName & ";"
ConsecutiveMisses = 0
Else
ConsecutiveMisses = ConsecutiveMisses + 1
If ConsecutiveMisses >= 32 Then Exit For ' Don't search unnecessarily long.
End If
Next ' i

If Len(MessageText) <= MessageTextLen0 Then
MessageText = "No resettable ATA channels with Windows drivers found. Nothing changed."
Else
MessageText = MessageText & vbNewline _
& "Please reboot now to reset and redetect the DMA status."
End If

MsgBox MessageText, vbOkOnly, "Program finished normally"

End If ' MsgBox(...) = vbOk

' End of Visual Basic Script program
===================================================================