Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defragging the C Drive on Windows 2003 Server 2

Status
Not open for further replies.

ScottWIT

IS-IT--Management
May 22, 2007
145
US
I have heard of problems when defragging the C drive on a PC such as system files getting moved around.... however, I thought that windows system files were not supposed to be moved during a defrag??? My main question is this: do I run any risk of something like that happening if I defrag the C drive on a Windows 2003 file server? I gained 2 GB of room doing a cleanup on C so at this point I'm thinking of just skipping the defrag entirely and not taking any chances.




 
I would not skip the defrag. I think any admin would tell you that these fears are unfounded. Files that are unmoveable will be flagged and ignored as such automatically. The risk in my opinion is miniscule to zero.

(yay! shameless advertising. my side business)
 
I agree with wdoellefeld, the chances of something going wrong is quite small.
 
You don't mention why you want to defrag? A properly configured server will have very little data being written to the C:

No applications should be writing data there.
There should be absolutely no file shares on C:

Paging files, print spooler, and other items shouldn't be there.

Can you clarify the need?

Pat Richard
Microsoft Exchange MVP
 
here's a script to run a scheduled task.
-c = Defrags all drives
-w = Full Defrag
-f = Force

Code:
Dim WsHShell
Set WsHShell = CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
	WshShell.Run "defrag.exe -c -w -f ", 0, True
Set WshShell = Nothing
 
As far as why I want to defrag... I am just doing some cleanup/prep work for another project. I will being adding some hard drives and reconfiguring the RAID 5 on this server soon. I'll be using diskpart to add space as well. Anyways, I thought it might be a good idea to get things cleaned up a bit, run defrag, chkdisk, etc. before I dive into that project. I have already run a defrag on the data partition.

I inherited this server from another Admin... there are applications installed on the C partition along with Symantec anti-virus and Veritas Backup Exec. That is why I'm hesitant to touch it.

When I ran a disk cleanup on the C parition it prompted me to put in the Windows Server 2003 cd so it could re-copy some files because it said a few system files were missing. After copying those files back everything was fine but after that I am hesitant to do much else to the C drive.



 
check system files = sfc /scannow
Why you so hesitant it's yours now do what you want, just make sure the backups are working and that you have documented EVERYTHING.
How many servers are you running?
 
It's a small operation.... one PDC that is Windows Server 2003 (file server) and a BDC (Windows 2000) that runs Exchange 2000.

I'm a one man IT department so I'm hesitant because if something goes wrong it's all on me! I prefer to be extra cautious because you never know what can happen, that's all.

Yeah, I have backups but I'd rather not be in the position where I need them of course.

If I decide to defrag C I should take it offline, correct?
Again, it is the PDC. I did take it offline overnight to defrag the data partition and it caused exchange to be unavailable for a while.





 
Been working with networks since 1983, I NEVER had an issue with defragging a drive... thousands of defrag runs, using all Win OS versions, Norton, Diskeeper, PerfectDisk ect.


........................................
Chernobyl disaster..a must see pictorial
 
To be on the safe side I had planned to take the server (it's a PDC ) offline overnight while the defrag runs on C. Is that normal procedure? Is it dangerous to let people access files on the data partition while the defrag runs on C?





 
I would not offline the server, this is not a normal procedure. If there is heavy production use, the users might see a slight slow down. I have all my client's servers on a daily defrag which does not take that long to complete (10-60 minutes). It has been so long since I hit a heavily fragmented server, I can not tell you how long it will take.... if it is under 50 gigs, guessing an hour or two at most. How large an array do you have ?
Your worrying too much. Believe me, I sweat about many aspects of server operations but I NEVER think twice about a defrag, wish the other 99% of the OS operations were as safe. ( with the exception of boot time defragmentation, as offered by third party defraggers; no problems so far but I still sweat every time.)


........................................
Chernobyl disaster..a must see pictorial
 
Defrag cannot touch files that are open and locked (such as the registry), so it will only defrag the other files that aren't in use. There's no need to take the system offline unless you want to defrag those files that are normally in use while Windows is running.
 
well, i didn't see the latest posts until afterwards so i ended up taking it offline. everything went fine but instead of doing it overnight i started it in the morning and it took about 3-4 hours to complete. anyways, thanx for all of the info.





 
as to offlining it, I was only worried about needed access by users...some of my clients run 24/7, some do not...in no case do take a server offline (except if I do a boot time defrag, which is not often).
Now that it is defragged, if you schedule a defrag nightly, it should take much less time to complete. Many of my clients have arrays between 200 and 1gig, most take <10 minutes a night to defrag, as a disk can not become highly fragmentated in a 24 hour period.



........................................
Chernobyl disaster..a must see pictorial
 
Do yourself a favor and invest in the server version of Diskeeper for your 2 servers and your other workstations.

Everything gets fragged eventually. It operates in background.

Worth every penny per day it costs!
 
ScottWIT . If you are running 3.1 make sure there is no power failure or if your running exchange then yes I would stay away from defraging the partition that holds the *.edb files, then I would take it offline. I defragged exchange 5.5 once which killed the IS and had to restore from backup. Running exchange 2007 now and still have never defragged that partition.
 
yeah, the server i defragged was just a file server. we run exchange 2000 on a separate windows 2000 server and we're hopefully upgrading it to 2007 next year. i won't get into the issues i've had on my exchange server but i don't think i'm going to defrag it out of fear that something could go bad as you mentioned.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top