Attention! Partners, please be advised that we will be changing the theme on this website in the coming two weeks. Click here to find out more.

Defragment MFT

This forum is for discussion of expansion script related issues.

Defragment MFT

Postby justin.mjbest » Thu Mar 31, 2011 12:11 pm

I finally got tired of the "MFT Fragmentation" monitor triggering all kinds of alerts, so I decided to start attempting to do something about it.

The script attached defragments a hard drive's Master File Table using a free utility called contig.exe (see http://technet.microsoft.com/en-us/sysinternals/bb897428). Note that the labtech utilities pack includes an old version of contig.exe, which you'll need to update to the current version.

This script is a rough draft. I've done some internal testing, but don't have months of experience with this 'in the wild', so please be cautious and don't blame me if contig.exe breaks something. With some additional work and testing, this could probably be turned into an "autofix action" script.

Also, this is my first attempt at working with tickets and having them interact with a script. For some reason, I can't get the ticket to close itself automatically using the script. Any advice would be appreciated.
Attachments
Defragment MFT.zip
(2.37 KiB) Downloaded 1158 times
justin.mjbest
Newbie
Newbie
 
Posts: 7
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby Guest » Tue Apr 12, 2011 11:11 am

Justin,

Any more luck on this script? Just wanted to see if you were able to work out the kinks and if so, could you make the script available. Thanks!
Guest
 

Re: Defragment MFT

Postby drankin.edtsolutions » Tue May 31, 2011 1:02 pm

I did something similar a few months back to Defrag the MFT but I have only seen it to be successful in Vista or newer machines.
drankin.edtsolutions
Newbie
Newbie
 
Posts: 37
Joined: Wed Jan 26, 2011 2:29 pm

Re: Defragment MFT

Postby sneer82 » Tue May 31, 2011 5:36 pm

I suggest using MyDefrag, which is perfectly capable of defragmenting MTF.
No MHz - No Fun!
sneer82
Full Member
Full Member
 
Posts: 162
Joined: Wed Dec 31, 1969 8:00 pm
Location: London, UK

Re: Defragment MFT

Postby justin.mjbest » Fri Jul 15, 2011 4:21 pm

I've been using this script since I posted it in February. It seems to work well, and has always solved the issue when attempted.

Attached is the current version of the script. Keep in mind:
- The script just assumes that C: is the drive you want to defrag MFT on.
- You need the updated version of contig.exe, at http://technet.microsoft.com/en-us/sysi ... s/bb897428
Attachments
Defragment MFT.zip
(130.21 KiB) Downloaded 920 times
justin.mjbest
Newbie
Newbie
 
Posts: 7
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby cinfante » Thu Nov 17, 2011 9:19 am

First of all Thanks for the script and information! Have you had any luck with the script closing the tickets? I have been working with it for a few months and other then getting the tickets to close automatically it works great.
cinfante
Newbie
Newbie
 
Posts: 3
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby justin.mjbest » Thu Nov 17, 2011 12:54 pm

Glad you're using the script and it's working for you.

I haven't spent any time trying to get it to close the tickets. If anybody does, please post here and we'll get your update.
justin.mjbest
Newbie
Newbie
 
Posts: 7
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby philipf.davincid » Thu Nov 17, 2011 5:28 pm

I just started using this script three days ago.. It automatically closes my tickets ...
philipf.davincid
Jr. Member
Jr. Member
 
Posts: 98
Joined: Fri Jan 21, 2011 9:54 pm

Re: Defragment MFT

Postby philipf.davincid » Thu Nov 17, 2011 5:30 pm

I think if it runs on a server though, it does not close the ticket... i will have to look at the script again.. from what I could tell at the time, it didn't run on servers by design
philipf.davincid
Jr. Member
Jr. Member
 
Posts: 98
Joined: Fri Jan 21, 2011 9:54 pm

Re: Defragment MFT

Postby cinfante » Thu Nov 17, 2011 5:44 pm

I have only run it on workstations running Windows 7 64-bit Professional and each time it creates the ticket but does not close it.
cinfante
Newbie
Newbie
 
Posts: 3
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby philipf.davincid » Fri Nov 18, 2011 8:57 pm

interesting.. i just went and double checked and my tickets are closing..
philipf.davincid
Jr. Member
Jr. Member
 
Posts: 98
Joined: Fri Jan 21, 2011 9:54 pm

Re: Defragment MFT

Postby oltconsulting » Tue Nov 22, 2011 4:08 pm

I've just been playing with the monitor called "Drive- MFT Fragmentation" and the results seem very strange - for example, the SQL query lists far more machines than the alert shows up and the numbers seem more like the size of the MFT rather than the number of fragments - is it possible that the SQL query isn't displaying the correct field value ion the query but somehow the monitor is picking up the correct value when it runs? It's all a bit strange.

Also, is there a reason why this script is filtered so that it only runs on Workstations? Is there a good reason not to run it on servers (for example, could contig corrupt the MFT and cause lasting damage)?


Thanks,
Edmund
oltconsulting
Full Member
Full Member
 
Posts: 108
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby justin.mjbest » Tue Nov 22, 2011 4:14 pm

I'm not sure about the labtech monitor question, you'll have to ask LabTech directly on that one. I found it sufficient that when the monitor triggers on my labtech system, it's because there's too many MFT fragments. I wrote the script to correct the issue.

Defragmenting the hard drive on a server can create issues if you're using ShadowProtect backups. The incremental file after a defrag can be huge. I haven't tested to see if this also applies with MFT defrags, but I chose to filter the script to run on workstations only in an attempt to be super cautious. I'm not aware of any other issues caused by the contig.exe software, but I haven't been using contig.exe very long. If you trust contig.exe to run unattended on your servers, then go ahead and remove the filters.
justin.mjbest
Newbie
Newbie
 
Posts: 7
Joined: Wed Dec 31, 1969 8:00 pm

Re: Defragment MFT

Postby hrumbough » Fri Dec 02, 2011 10:23 am

How do I exclude drives from the MFT monitor? It seems to be pulling in USB drives as well as hard drives.
hrumbough
Newbie
Newbie
 
Posts: 32
Joined: Mon Jun 27, 2011 4:48 pm

Re: Defragment MFT

Postby mwhalen.houstontc » Fri Dec 02, 2011 12:38 pm

heather wrote:How do I exclude drives from the MFT monitor? It seems to be pulling in USB drives as well as hard drives.



I'd love an answer on this too. It's one of the more irritating things. LT Support may be able to craft a SQL-based filter that would rule out storage devices connected to the USB BUS. Problem is, you may want to know about a USB hard drive that's fragmented but NOT a USB stick.
mwhalen.houstontc
Newbie
Newbie
 
Posts: 16
Joined: Mon Feb 28, 2011 9:01 pm

Next

Return to 29B. Scripts

Who is online

Users browsing this forum: No registered users and 0 guests