Managing disk defragmentation is one of the finesse areas of IT administration. Here's a tip on how to manage defragmentation with Group Policy for Windows Server 2008.
In my previous Windows Server tip, I outlined how to set a server's individual defragmentation schedule. It's a good solution for one server, but what if you have a large collection of servers? This is where Group Policy comes to the rescue.
Windows Server 2008 introduces a new extension of Group Policy that allows scheduled tasks to be deployed via a Group Policy Object (GPO). In the case of disk defragmentation, you can configure a GPO to run a defragmentation task. We have to borrow the scripting options from the built-in task, specifically the %windir%\system32\defrag.exe command coupled with the -c parameter.You configure scheduled tasks through GPOs in the Computer Configuration | Preferences | Control Panel Settings | Scheduled Tasks section of the Group Policy editor (Figure A). Figure A
Click the image to enlarge.Once the scheduled task is made via the GPO, it is located in a different area of the Task Scheduler (taskschd.msc) snap-in compared to the built-in task from the default installation. The GPO tasks will appear above the Microsoft folder in the root of the Task Scheduler Library folder (Figure B). Figure B
Click the image to enlarge.Pushing a defrag task out with a GPO, on the one hand, is good because it ensures a consistent configuration deployed quickly; on the other hand, it may be risky to launch a series of tasks that would send a burst of I/O on the storage system. If this mechanism is selected, here are guidelines for deploying GPOs for defrag:
- Go very granular in the organizational unit structure with different schedules to distribute the workload.
- Consider running this on client PCs.
- Be aware of multiple iterations of defragmentation where SANs are in use.
- Consider consolidated effects of virtual machines.
Do you feel that defragmentation tasks should be centrally managed via Group Policy or local on each server? Share your comments in the discussion.
Stay on top of the latest Windows Server 2003 and Windows Server 2008 tips and tricks with our free Windows Server newsletter, delivered each Wednesday.