2015年3月30日星期一

Using Storage vMotion to migrate a virtual machine with many disks timeout

Using Storage vMotion to migrate a virtual machine with many disks timeout(1010045)

Symptoms

You may experience these symptoms:
  • Storage vMotion fails.
  • The Storage vMotion operation fails with a timeout between 5-10% or 90-95% complete.
  • On ESX 4.1 you may see the errors:

    In hostd.log

    v ix: [7196 foundryVM.c:10177]: Error VIX_E_INVALID_ARG in VixVM_CancelOps(): One of the parameters was invalid 'vm:/vmfs/volumes/4e417019-4a3c4130-ed96-a4badb51cd0a/Mail02/Mail02.vmx' opID=9BED9F06-000002BE-9d] Failed to unset VM medatadata: FileIO error: Could not find file : /vmfs/volumes/4e417019-4a3c4130-ed96-a4badb51cd0a/Mail02/Mail02-aux.xml.tmp.
     In vmware.log

    vmkernel: 114:03:25:51.489 cpu0:4100)WARNING: FSR: 690: 1313159068180024 S: Maximum switchover time (100 seconds) reached. Failing migration; VM should resume on source.
    vmkernel: 114:03:25:51.489 cpu2:10561)WARNING: FSR: 3281: 1313159068180024 D: The migration exceeded the maximum switchover time of 100 second(s). ESX has preemptively failed the migration to allow the VM to continue running on the source host.
    vmkernel: 114:03:25:51.489 cpu2:10561)WARNING: Migrate: 296: 1313159068180024 D: Failed: Maximum switchover time for migration exceeded(0xbad0109) @0x41800f61cee2
  • vCenter Server logs contain entries similar to:

    [yyyy-mm-dd hh:mm:ss.nnn tttt error 'App'] [MIGRATE] (migrateidentifier) vMotion failed: vmodl.fault.SystemError
    [yyyy-mm-dd hh:mm:ss.nnn tttt verbose 'App'] [VpxVmomi] Throw vmodl.fault.SystemError with:
    (vmodl.fault.SystemError) {
    dynamicType = <unset>,
    reason = "Source detected that destination failed to resume.",
    msg = "A general system error occurred: Source detected that destination failed to resume.

Resolution

Note: A virtual machine with many virtual disks might be unable to complete a migration with Storage vMotion. The Storage vMotion process requires time to open, close, and process disks during the final copy phase. Storage vMotion migration of virtual machines with many disks might timeout because of this per-disk overhead.
This timeout occurs when the maximum amount of time for switchover to the destination is exceeded. This may occur if there are a large number of provisioning, migration, or power operations occurring on the same datastore as the Storage vMotion. The virtual machine's disk files are reopened during this time, so disk performance issues or large numbers of disks may lead to timeouts.
The default timeout is 100 seconds, and can be modified by changing the fsr.maxSwitchoverSeconds option in the virtual machine configuration to a larger value.
 
Note: Ensure this change is performed when the virtual machine is powered down.
 
To modify the fsr.maxSwitchoverSeconds option using the vSphere Client:
  1. Open vSphere Client and connect to the ESX/ESXi host or to vCenter Server.
  2. Locate the virtual machine in the inventory.
  3. Power off the virtual machine.
  4. Right-click the virtual machine and click Edit Settings.
  5. Click the Options tab.
  6. Select the Advanced: General section.
  7. Click the Configuration Parameters button.

    Note: The Configuration Parameters button is disabled when the virtual machine is powered on.
  8. From the Configuration Parameters window, click Add Row.
  9. In the Name field, enter the parameter name:

    fsr.maxSwitchoverSeconds 
  10. In the Value field, enter the new timeout value in seconds (for example: 150).
  11. Click the OK buttons twice to save the configuration change.
  12. Power on the virtual machine.
 
To modify the fsr.maxSwitchoverSeconds option by editing the .vmx file manually:
 
The virtual machine's .vmx configuration file can be manually edited to add or modify the option. Add the optionfsr.maxSwitchoverSeconds = " <new value>on its own line.
 
For more information, see Tips for editing a .vmx file (1714).

Note: To edit a virtual machines configuration file, you need to power off the virtual machine, remove it from Inventory, make the changes to the vmx file, add the virtual machine back to inventory, and then power on the virtual machine again.


2015年3月11日星期三

How to Clean up the WinSxS Directory and Free Up Disk Space on Windows Server 2008 R2 with New Update

It's finally here! After pages and pages of comments from you requesting the ability to clean up the WinSxS directory and component store on Windows Server 2008 R2, an update is available.
As a refresher, the Windows Server 2008 R2 update is directly related to my previous blog post announcing a similar fix for Windows 7 client
The Windows 7 version of this fix introduced an additional option to the Disk Cleanup wizard that would cleanup previous versions of Windows Update files. KB2852386 adds a Disk Cleanup option on Windows Server 2008 R2, similar to the Windows 7 update. 
What does this mean for Windows Server 2008 R2? After installing this update and prior to being able to perform the cleanup, the Desktop Experience feature must be installed. Why you ask? Disk Cleanup is not installed by default on Windows Server 2008 R2. It is instead a component installed with the Desktop Experience feature. 
Why was the update not included as a DISM switch like Windows Server 2012 R2? 
This was evaluated, however, due to the amount of changes required and the rigorous change approval process, it was not feasible to back port the functionality this way. Knowing that it would be some time before everyone could upgrade to Windows Server 2012 R2 and based on feedback from an internal survey taken of a subset of enterprise customers, it was determined that this update would still be useful in its Disk Cleanup form, even with the Desktop Experience prerequisite. We hope you agree. However, we are aware that for some of you, the Desktop Experience requirement will be a deal breaker, but decided to release it anyway hoping it will help in some instances. 
How can I get the update?
The update is available on Windows Update. It can also be manually downloaded from the Microsoft Update Catalog. The KB article listed above will also direct you to a download link in the Microsoft Download Center.
Let's Cleanup those Old Windows Update Files!
First, let's take a look at our starting point. Looking at my Windows 2008 R2 Server with SP1 installed, according to Windows Explorer, the size of my Windows/WinSxS directory is as follows: 
The size of the WinSxS directory will vary by server. Some of you will have smaller WinSxS directories, some larger.  
Installing the update is just like installing any other update. Just download and double-click on the .msu file: 
Installing the update does not require Desktop Experience to be installed beforehand, but if you check your WinSxS directory again, you'll see there has been no change to the size. This is expected as we need to run Disk Cleanup in order for this to take effect. It also does not require a reboot to install the hotfix. 
But…we can't do anything with what we just installed until we get Disk Cleanup which is installed with the Desktop Experience feature. 
When installing Desktop Experience, it does require additional features. Select the button to Add Required Features and click Next and then Install: 
A reboot is required to finalize the install. 
Click Close and Reboot when prompted. 
After we reboot, a Disk Cleanup option can be found under Start --> All Programs --> Accessories --> System Tools:
On launch, Disk Cleanup prompts for the drive you want to clean up: 
After clicking Ok, a scan is performed: 
Several options are provided for cleanup, including a new option for Windows Update Cleanup:
Just like the Windows 7 cleanup, mileage will vary. Also like Windows 7, the actual cleanup occurs during the next reboot. After the reboot, taking a look at the WinSxS directory, it has shrunk to the following: 
Automation
My super knowledgeable scripting cohort Tom Moser wrote a PowerShell script that automates THE ENTIRE PROCESS. Can I get a cheer? Ok. So maybe it is a bit much to expect IT admins to cheer, but can I get an appreciative grunt?  The script certainly beats the alternative of doing this all manually. 
You can find the script on the TechNet Script Center here: 
What does the script do? 
In short, the script does the following: 
1) Installs Desktop Experience, if not previously installed, and performs a reboot. 
2) Sets the appropriate registry keys to automate the cleanup. The script will cleanup not only previous Windows Update files as well as Service Pack files. 
3) The script then initiates the cleanup. 
4) If Desktop Experience was not previously installed, the script uninstalls it.
5) Performs final reboot. 
For more details, read below.  
The script can be run from any directory on the server. It has two parameters: LogPath and a switch called NoReboot. LogPath will allow the user to specify a log location or if none is specified, by default, the script will create a log in the same directory from which the script was executed. NoReboot allows the user to suppress reboots, but will require manual reboots by an administrator. 
Note: Make sure to check the log file to verify the process completed successfully and to verify there is no manual interaction required. If the script has completed successfully, the log will end with CleanMgr complete.
The script has several phases, using a registry key to keep track of progress. After initial run, it inserts itself as a scheduled task, which runs as local system. The final phase removes the task.
Depending on pending reboots, etc, we have found that this phase may generate a few reboots. Do not be concerned if the server reboots a few times. 
Other Options
Aside from the cleanup mechanism included with this fix, if you have applied SP1 and have not cleaned up afterwards, I'd highly recommend doing so by running the following command from an administrative command prompt:
dism /online /cleanup-image /spsuperseded
or 
If you have installed the Desktop Experience feature and thus have the Disk Cleanup utility, you can select the following option to do the same thing: 
Specifying the /spsuperceded switch or choosing to remove service pack backup files will remove the ability to uninstall the service pack. If you haven't done it before, it is certain to free up some space. 
The Origins of this Update (Hint: Windows Server 2012 R2)
I've mentioned a couple of times that this is a back port. What does that mean? Well, it means that this functionality is already built into a later operating system. In this case, that operating system is Windows Server 2012 R2. Not only do we have several mechanisms to automatically cleanup previous versions of Windows Update files like this update does, we even have the ability to more accurately determine the size of the component store (aka the WinSxS directory). 
The command to accurately determine the size of the component store on Windows Server 2012 R2 is as follows: 
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Running this command analyzes the component store to determine the size and whether cleanup is recommended. Notice in the screen shot that it provides you with the Windows Explorer reported size and the actual size: 
Notice that the component store is much smaller than Windows Server 2008 R2 right out of the gate? This isn't because I've used Features on Demand to remove roles and features. It's because by default in Windows Server 2012 R2, we compress all unused binaries. Another win for Windows Server 2012 R2!
Looking at the breakdown of the 5.12GB. We see that Shared with Windows accounts for 3.83GB of the 5.12GB. Shared with Windows refers to the size of the files that are hardlinked between the WinSxS directory and the Windows location of the file. Because these hardlinks appear to take up space, but don't really, we can subtract them from our component store size. Therefore, the actual size of the component store is the total of Backups and Disabled Features plus Cache and Temporary Data or 1.28GB. 
But back to our cleanup. 
In the above screen shot, it's stated that component store cleanup is recommended. We can manually cleanup the component store on Windows Server 2012 R2 by running the following command:  
Dism.exe /online /Cleanup-Image /StartComponentCleanup 
What does this do? When this runs, Windows cleans up the previous versions of the component that was updated. In other words, it is doing exactly what our update does for Windows Server 2008 R2 SP1. It removes previous versions of the files updated by Windows Updates. 
After running /StartCompomentCleanup, upon analyzing the size again, we see it is as follows: 
So no notable difference really. Largely because we've been running this cleanup all along. This same command is run every 30 days as a scheduled task with a time limit of 1 hour. 
With the scheduled task however, the task will wait at least 30 days after an updated component has been installed before uninstalling the previous versions of the component. This scheduled task can be found in Task Scheduler under the Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup directory: 
More information on this can be found here:  http://technet.microsoft.com/en-us/library/dn251565.aspx  
If you're in all out spring cleaning mode and want to perform super deep cleanup, you can use the /resetbase command with the /startcomponentcleanup to remove all superseded versions of every component in the component store: 
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase 
This removes the ability to uninstall any updates applied until this point in time. 
And don't forget the ability to completely remove any role or feature which also reduces the size. Take a look at one of my earlier blogs for more details on Features on Demand:  http://blogs.technet.com/b/askpfeplat/archive/2013/02/24/how-to-reduce-the-size-of-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2012-using-features-on-demand.aspx  
Here's a handy table showing when we introduced the various different cleanup and WinSxS size reductions by operating system: 
Operating SystemCompress Unused WinSxS BinariesCleanup Previous Windows Update FilesAutomatically Clean Up Previous Windows Update FilesCleanup All ComponentsFeatures on Demand
Windows Server 2008 R2With KB2852386
Windows Server 2012 With KB2821895xxx
Windows Server 2012 R2xxxxx
Want more information on how all this works under the covers? 
Check out the following series on the AskCore team blog for an in-depth look at servicing improvements on Windows Server 2012 R2: 
More on the Desktop Experience Feature
The Desktop Experience feature includes the following components and features:
* Windows Media Player
* Desktop themes
* Video for Windows (AVI support)
* Windows SideShow
* Windows Defender
* Disk Cleanup
* Sync Center
* Sound Recorder
* Character Map
* Snipping Tool
* Ink Support 
Most of these are not automatically turned on with the exception of Windows Defender whose service is started after reboot. You'll likely want to stop the service and disable it after reboot. Not all 3rd party anti-viruses conflict with Windows Defender, but there have been reports that some do. 
~ Charity Shelbourne and Tom Moser, Spring cleaning servers since 1998

Update May 15th, 2014

We are aware of a method of copying in the appropriate Disk Cleanup/CleanMgr files into the appropriate location to avoid installing the Desktop Experience. If this were a tested and supported option, we certainly would have included these details in this post and definitely would have used this method to automate the cleanup. However, it was determined early on that this method would not be supported. If you decide to do this, do so at your own risk.





http://blogs.technet.com/b/askpfeplat/archive/2014/05/13/how-to-clean-up-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2008-r2-with-new-update.aspx

2015年3月8日星期日

如何處理在 Windows 選取超過 15 個檔案後內容功能表沒有開啟、編輯、列印選項

問題的來龍去脈

當我在 Windows Vista、Windows 7、Windows 8 和 Windows 8.1 時,選取超過 15 個檔案後按滑鼠右鍵,此時內容功能表沒有開啟、編輯、列印的選項,該如何處理?
image image

問題發生的原因

此限制是經過設計的,為了避免當選取大量檔案不小心選擇錯誤,因此預設 15 個檔案後內容功能表將不會出現開啟、編輯、列印選項。

問題的解決方法

可透過修改機碼來調整,按 Windows 標誌鍵 + R,出現執行視窗,輸入 regedit 按 Enter 鍵。
SNAGHTML2bfcfc
切換至 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer,在右邊窗格按滑鼠右鍵,選擇新增 / DWORD (32-位元)。
SNAGHTML2ef8a8
輸入名稱 MultipleInvokePromptMinimum,並進行修改。
image
底數選擇十進位,在數值資料中,輸入 15 以下的數字,例如 13,則選取超過 13 個檔案後內容功能表沒有開啟、編輯、列印選項,輸入 16 以上之數字則不再限制檔案數量,設定完成後按確定,此設定會立即生效。
SNAGHTML30e2a6
如果要恢復預設值,請在 MultipleInvokePromptMinimum 按滑鼠右鍵,選擇刪除。
image