Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 22, 2013, 01:22:06 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Script for Terninal Services Server with SQL Express  (Read 463 times)
Andreww
Newbie
*
Posts: 1


View Profile
« on: July 31, 2012, 04:26:19 pm »

I have been trying to create a scrip for a Terminal Services Server that also has SQL Express installed. We get a lot of fragmentation causing file system errors requiring (unmounted) AutoCheck.

I've expanded the >1 GB SQL databases and log files (so they don't grow).

I've edited a script (see below) to defragment the the filing system, keeping the users profiles out of the way, but I want (also) to oik out the big database files into free space at the end of the disk. How on earth do I move all files (say) that over say 100 MB out of the "zones" into free space at the end of the disk created by My Defrag!

Thanks

===============

Title('SystemDisk By Folder Try')
Description('
Sort all the files and directories by name on all the selected disk(s).
')

VolumeSelect
  CommandlineVolumes()
VolumeActions

  /* Write the "before" statistics to the logfile. See the "Settings.MyD" file
     for the definition of the "LogBefore" string. */
  AppendLogfile("MyDefrag.log","LogBefore")

 /* Place files at 30% into the data on the disk. */
  MakeGap(RoundUp(VolumeUsed * 0.3,VolumeSize * 0.01), DoNotVacate)

  /* Zone 1: Place the MFT and some other special NTFS files. */
  FileSelect
    SelectNtfsSystemFiles(yes)
  FileActions
    PlaceNtfsSystemFiles(Ascending,MftSize * 0.1)
  FileEnd

/* Zone 2: Winnt */
   FileSelect
       # Select everything in the "WINNT" directory.
     DirectoryName("Winnt")
   FileActions
       # Add a gap of 10% of the free size of the volume.
      AddGap(VolumeFree * 0.1)
    SortByLastChange(Ascending)
   FileEnd

 /* Zone 3: Programs Files */
   FileSelect
       # Select everything in the "Program Files" directory.
     DirectoryName("Program Files")
     FileActions
       # Add a gap of 10% of the free size of the volume.
      AddGap(VolumeFree * 0.2)
    SortByLastChange(Ascending)
   FileEnd

 /* Zone 4: MitreFinch */
   FileSelect
       # Select everything in the "MitreFinch" directory.
     DirectoryName("MitreFinch")
     FileActions
       # Add a gap of 10% of the free size of the volume.
      AddGap(VolumeFree * 0.2)
    SortByLastChange(Ascending)
   FileEnd

  /* Zone 5: Documents and Settings */
    MakeGap(ZoneBegin + VolumeFree * 0.2)
    FileSelect
       # Select everything in the "Documents and Settings" directory.
     DirectoryName("Documents and Settings")
   FileActions
       # Add a gap of 10% of the free size of the volume.
      AddGap(ZoneEnd + VolumeFree * 0.2)
     SortByLastChange(Ascending)
   FileEnd

FileSelect
    size(100000000,0)
  FileActions
    MoveToEndOfDisk()
  FileEnd

 AppendLogfile("MyDefrag.log","LogAfter")

VolumeEnd

AppendLogfile("MyDefrag.log","LogFooter")

====================================
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #1 on: July 31, 2012, 08:43:06 pm »

We get a lot of fragmentation causing file system errors requiring (unmounted) AutoCheck.
I thought that wasn't possible with NTFS but apparently the first version(s) of it do have such a "feature". (I have several files with thousands of fragments but there is no sign of file system corruption). You should also check if the disk itself is healthy and not starting to fail.

but I want (also) to oik out the big database files into free space at the end of the disk.
That is not a good idea since the end of the disk is a lot slower than the beginning.

About the script:
- AddGap does not really "add" a gap to a zone. You always have to use "ZoneEnd + ..." to achieve that.
- By using the AddGaps you're wasting the first few mb's of the disk. The default scripts have a MakeGap(0) to reset the zone point to the beginning of the disk, using the fast space there.
- You're writing in the comments that you're adding 10% but instead you add 20% (if you would fix your AddGaps like I've mentioned above)

You should rethink your placement strategy. Take a look at the default scripts, they exclude a lot of unused files that are best placed towards the slow end of the disk.
Logged

Need help creating a script? Try MyDefrag Script Creator.
Rohk
JkDefrag Hero
*****
Posts: 128


View Profile
« Reply #2 on: August 01, 2012, 07:01:04 am »

Quote
How on earth do I move all files (say) that over say 100 MB out of the "zones" into free space at the end of the disk created by My Defrag!

At the beginning select all 100mb or bigger files and move them to the end of the disk.

Code:
  /* Select files: 100mb and bigger. */
  FileSelect
    Size(100mb, 0)
  FileActions
    # Move files to the end of the disk.
    MoveToEndOfDisk()
  FileEnd

Above Zone can also be used at the end of the script by first excluding all the 100mb files from other zones you want using this:

Code:
and not (Size(100mb, 0))

But think carefully if you really want to move all the large files to the end of the disk, see the last point in MoveToEndOfDisk description. It will drastically decrease disk performance as most of the big files are also used and accessed by the server. What about just moving them further on the disk? Like the Standard system disk script does with the space hogs. Or only move "never" accessed big files by separating regularly accessed files, etc.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!