Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
June 18, 2013, 07:58:11 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Feasable Script?  (Read 1055 times)
RAW_Randomation
JkDefrag Junior
**
Posts: 8


View Profile
« on: November 18, 2010, 03:20:25 am »

I've wondered around the site some, not really finding a definite example of what I'm looking for... What I'd like to find is something that'd

1.) Place all MFT, Boot files, and access information in the first part of the disk, then defragging those files.
2.) create a small gap there, about 1% of my 200 GB drive.
3.) Place the most frequently used files next, including (if any) the remaining .dll files contained in c:/windows/system and c:/windows/system32, then defragging those files.
4.) creating another small gap, size of which would be open for varying amounts, based on popular belief of what should be best here.
5.) continuing to process the remaining files much like the System Disk Script normally would, with the exception of large files (say over 450MBs), which would be put to the end of the disk. (which could be done separately, if need be)
6.) a final "comb-over" quick defrag of everything, just as it sits at that point, allowing for some file swapping to squeeze blocks to their max, persay.


I know that there's a lot of redundancy with the defragging, and even the pros and cons of the large-file movement to the end of the disk, but as an overall view, I'm in at least moderate belief that this could all be an overall beneficial setup.

I've modified some of the script already, just kinda tinkering with what I believe to be right (though in truth, I have very little understanding if this would work at all, much less do what I want)... Some input or improvement to this would be greatly appreciated.

As is, here's what I've tinkered:

Code:

# MyDefrag v4.0 default script: System Disk Monthly (My Version)
#
# This script is [color=red] NOT [/color] part of the standard MyDefrag distribution.

Title('System Disk Monthly (My Version)')
Description("System Disk Monthly description")      // See the "Settings.MyD" file.









/* Write the header to the logfile. See the "Settings.MyD" file for the
   definition of the "LogHeader" string. */
WriteLogfile("MyDefrag.log","LogHeader")

/* Select and process the volumes one by one. */
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")

setVariable(huge, 450MB) // size of large files > 'huge'


  /* Place files at the beginning of the disk. */
 
  /* Zone 1: Place the MFT and some other special NTFS files. */
  FileSelect
    SelectNtfsSystemFiles(yes)
  FileActions
    PlaceNtfsSystemFiles(Ascending,MftSize * 0.01)
    defragment(fast)
  FileEnd

  /* Zone 2: files used when booting, and a gap. */
  FileSelect
    ImportListFromBootOptimize()
  FileActions
    SortByImportSequence(Ascending)
    defragment(fast)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd

  /* Zone 3: Directories. */
  FileSelect
    Directory(yes)
  FileActions
    sortByNewestDate(ascending) // or (ZoneEnd,VolumeFree * 0.01)
    defragment(fast)
  FileEnd


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


  /* Zone 4: files used by the most used programs, and a gap. */
  FileSelect
    ImportListFromProgramHints("*.pf")
  FileActions
    SortByImportSequence(Ascending)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd


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


  /* Zone 5: regular files and a gap. */
  FileSelect
    not(
      Size(450M,0)
      or (LastAccessEnabled(yes) and LastAccess(,1 month ago))
      or DirectoryName("$RECYCLE.BIN")
      or DirectoryName("RECYCLED")
      or DirectoryName("RECYCLER")
      or DirectoryName("$*")
      or DirectoryName("Downloaded Installations")
      or DirectoryName("Ehome")
      or DirectoryName("Fonts")
      or DirectoryName("Help")
      or DirectoryName("I386")
      or DirectoryName("IME")
      or DirectoryName("Installer")
      or DirectoryName("ServicePackFiles")
      or DirectoryName("SoftwareDistribution")
      or DirectoryName("Speech")
      or DirectoryName("Symbols")
      or DirectoryName("ie?updates")
      or DirectoryName("dllcache")
      or DirectoryName("Installshield Installation Information")
      or DirectoryName("System Volume Information")
      or DirectoryName("windows.old")
      or FileName("*.7z")
      or FileName("*.arj")
      or FileName("*.avi")
      or FileName("*.bak")
      or FileName("*.bup")
      or FileName("*.bz2")
      or FileName("*.cab")
      or FileName("*.chm")
      or FileName("*.dvr-ms")
      or FileName("*.gz")
      or FileName("*.ifo")
      or FileName("*.iso")
      or FileName("*.log")
      or FileName("*.lzh")
      or FileName("*.mp3")
      or FileName("*.msi")
      or FileName("*.old")
      or FileName("*.pdf")
      or FileName("*.rar")
      or FileName("*.rpm")
      or FileName("*.tar")
      or FileName("*.wav")
      or FileName("*.wmv")
      or FileName("*.vob")
      or FileName("*.z")
      or FileName("*.zip")
      )
  FileActions
    SortByName(Ascending)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd

  /* Zone 6: spacehogs : less important files that take up a lot of space. */
  FileSelect
    Size(450M,0)
      or DirectoryName("System Volume Information")
      or FileName("*.edb")
      or FileName("*.sys")
     
  FileActions
    moveToEndOfDisk()
  FileEnd

  /* Zone 7: Whole HD : Re-Evaluating Full Defrag Quickly, and arrangeing Fast Fill Files to accomidate left over small holes.  */
  FileSelect
    all
  FileActions
   FastFill(WithShuffling)
   Defragment(Fast)
  FileEnd


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

VolumeEnd

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








Again, I have very limited "idea" as to what I'm doing here, so cut me some slack.  Wink

Thanks for any assistance in this.
« Last Edit: November 18, 2010, 06:48:49 am by RAW_Randomation » Logged
Darlis
JkDefrag Hero
*****
Posts: 1725


View Profile WWW
« Reply #1 on: November 18, 2010, 12:29:18 pm »

- From zone 1 to 3 you're using a sorting file action. The Defragment action is not neccessary.
- You're basically separating the MFT from the directories by placing them like they appear in the layout.ini. This may decrease the time to boot, but it will also decrease the performance while working normally (like browsing through directories).
- You use percentages of VolumeUsed to place the zones (MakeGap). I think this is not a good idea. Depending on the size of each zone, you may get no gap at all. Plus you're vacating files with AddGap after each zone which could then be moved down again to fill the gap.
- In the last zone: swap FastFill and Defragment.
Logged

Need help creating a script? Try MyDefrag Script Creator.
RAW_Randomation
JkDefrag Junior
**
Posts: 8


View Profile
« Reply #2 on: November 18, 2010, 09:03:18 pm »

I've made a few changes here, as you've suggested, but as this kind of script work is still new to me, I'm sure it'll be of some trial and error before I have a complete understanding of what, in truth, I'm doing. Wink

So anyways, as per what you said
 - I removed the defrag action from Zones 1-3
 - I reorginized the order of Zones 1-3, to allow the MFT and Directories to be placed continuously on the drive, changing that the first Zone be the files used while booting.
 - I'm unsure as to how to go about removing the percentages of VolumeUsed to place Zones. Should I be using something other than MakeGap to do this? Upon a trial run of my previous script, I did see a small gap that was placed while running through Zone 1-3, only for it to be filled later (like you stated happening with the AddGap). I'm sure it's a simple fix of how to not allow this, but I am as yet unsure as to how I could implement that.
 - In the last Zone, I've swapped the Fast Fill and Defragment as you suggested, though I suppose I'm confused as to why. Wouldn't after doing a fast fill the files need a defragment, or are the files already defragmentmented being moved to fill blocks not full?
 - I'm also a bit confused as to why in Zone 2 and 4 of this previous script (as I've seen multiple times over in the Forums) that files are being placed ascendant. Why, if the files most used are being needed first, would you place them towards the end of the Zone? In these 2 specific Zones, I've changed these Actions to be descending (newest to oldest), as a conundrum I'd like input on. 


So, as per the changes, the script now reads as:

Code:


# MyDefrag v4.0 default script: System Disk Monthly (My Version)
#
# This script is [color=red] NOT [/color] part of the standard MyDefrag distribution.

Title('System Disk Monthly (My Version)')
Description("System Disk Monthly description")      // See the "Settings.MyD" file.



  /* Write the header to the logfile. See the "Settings.MyD" file for the
   definition of the "LogHeader" string. */
WriteLogfile("MyDefrag.log","LogHeader")

  /* Select and process the volumes one by one. */
  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")

setVariable(huge, 450MB) // size of large files > 'huge'


  /* Place files at the beginning of the disk. */


  /* Zone 1: files used when booting, and a gap. */
  FileSelect
    ImportListFromBootOptimize()
  FileActions
    SortByImportSequence(Ascending)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd

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


  /* Zone 3: Directories. */
  FileSelect
    Directory(yes)
  FileActions
    sortByNewestDate(ascending) // or (ZoneEnd,VolumeFree * 0.01)
  FileEnd


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


  /* Zone 4: files used by the most used programs, and a gap. */
  FileSelect
    ImportListFromProgramHints("*.pf")
  FileActions
    SortByImportSequence(Descending)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd


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


  /* Zone 5: regular files and a gap. */
  FileSelect
    not(
      Size(450M,0)
      or (LastAccessEnabled(yes) and LastAccess(,1 month ago))
      or DirectoryName("$RECYCLE.BIN")
      or DirectoryName("RECYCLED")
      or DirectoryName("RECYCLER")
      or DirectoryName("$*")
      or DirectoryName("Downloaded Installations")
      or DirectoryName("Ehome")
      or DirectoryName("Fonts")
      or DirectoryName("Help")
      or DirectoryName("I386")
      or DirectoryName("IME")
      or DirectoryName("Installer")
      or DirectoryName("ServicePackFiles")
      or DirectoryName("SoftwareDistribution")
      or DirectoryName("Speech")
      or DirectoryName("Symbols")
      or DirectoryName("ie?updates")
      or DirectoryName("dllcache")
      or DirectoryName("Installshield Installation Information")
      or DirectoryName("System Volume Information")
      or DirectoryName("windows.old")
      or FileName("*.7z")
      or FileName("*.arj")
      or FileName("*.avi")
      or FileName("*.bak")
      or FileName("*.bup")
      or FileName("*.bz2")
      or FileName("*.cab")
      or FileName("*.chm")
      or FileName("*.dvr-ms")
      or FileName("*.gz")
      or FileName("*.ifo")
      or FileName("*.iso")
      or FileName("*.log")
      or FileName("*.lzh")
      or FileName("*.mp3")
      or FileName("*.msi")
      or FileName("*.old")
      or FileName("*.pdf")
      or FileName("*.rar")
      or FileName("*.rpm")
      or FileName("*.tar")
      or FileName("*.wav")
      or FileName("*.wmv")
      or FileName("*.vob")
      or FileName("*.z")
      or FileName("*.zip")
      )
  FileActions
    SortByName(Ascending)
    AddGap(RoundUp(ZoneEnd,VolumeFree * 0.01))
  FileEnd

  /* Zone 6: spacehogs : less important files that take up a lot of space. */
  FileSelect
    Size(450M,0)
      or DirectoryName("System Volume Information")
      or FileName("*.edb")
      or FileName("*.sys")
  FileActions
    moveToEndOfDisk()
  FileEnd

  /* Zone 7: Whole HD : Re-Evaluating Full Defrag Quickly, and arrangeing Fast Fill Files to accomidate left over small holes.  */
  FileSelect
    all
  FileActions
   Defragment(Fast)
   FastFill(WithShuffling)
  FileEnd


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

VolumeEnd

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






I also noted that at the end of the test run that I did not have any files placed at the end of my disk... Is this simply because I likely don't have any movable files over 450M?

As ever, my thanks and gratitude for your assistance.
« Last Edit: November 18, 2010, 09:16:45 pm by RAW_Randomation » Logged
Darlis
JkDefrag Hero
*****
Posts: 1725


View Profile WWW
« Reply #3 on: November 18, 2010, 09:46:59 pm »

- I'm unsure as to how to go about removing the percentages of VolumeUsed to place Zones. Should I be using something other than MakeGap to do this? Upon a trial run of my previous script, I did see a small gap that was placed while running through Zone 1-3, only for it to be filled later (like you stated happening with the AddGap). I'm sure it's a simple fix of how to not allow this, but I am as yet unsure as to how I could implement that.
You don't need a MakeGap to place a zone. Usually, zones will be placed after each other unless you have an Add/MakeGap. After removing the MakeGaps, the zones will be placed after the gap that was created by AddGap. This way, you will also prevent that a gap will be filled again. It is not (yet) possible to keep the vacated space created by Add/MakeGap clean.

- In the last Zone, I've swapped the Fast Fill and Defragment as you suggested, though I suppose I'm confused as to why. Wouldn't after doing a fast fill the files need a defragment, or are the files already defragmentmented being moved to fill blocks not full?
FastFill neither fragments nor defragments. If you use FastFill() first, it will move all fragments together (without actually defragmenting them) and Defragment() will move them out of the zone again to defragment. This will leave holes in the zone and you would have to use FastFill() again.

- I'm also a bit confused as to why in Zone 2 and 4 of this previous script (as I've seen multiple times over in the Forums) that files are being placed ascendant. Why, if the files most used are being needed first, would you place them towards the end of the Zone? In these 2 specific Zones, I've changed these Actions to be descending (newest to oldest), as a conundrum I'd like input on. 
You define "most used" as "recently accessed/created/changed". This is not true. But you can say that a file is *not* most used if it was not accessed/created/changed recently.

So, as per the changes, the script now reads as:
Remove the SortByLastAccess in zone 2. Usually, all these files are accessed frequently and there are two few of them so that such a sorting would have any impact in performance. If you want to keep it, remove PlaceNtfsSystemFiles, because SortByLastAccess will destroy what it has done.

I also noted that at the end of the test run that I did not have any files placed at the end of my disk... Is this simply because I likely don't have any movable files over 450M?
I don't know what files you have on your disk. But keep in mind that these files could have already been placed by previous zones. MyDefrag does not move a file again, if it has once been selected.
Logged

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


View Profile
« Reply #4 on: November 18, 2010, 10:20:14 pm »

FastFill neither fragments nor defragments. If you use FastFill() first, it will move all fragments together (without actually defragmenting them) and Defragment() will move them out of the zone again to defragment. This will leave holes in the zone and you would have to use FastFill() again.
Unless Jeroen has changed it in recent versions, FastFill() uses only whole files to fill gaps, not individual fragments. It may defragment a file but it may also make new gaps in the zone by pulling file fragments from already filled part. And it most probably won't defragment all files so the rest of the argument is correct. It is always good idea to defragment before filling.
« Last Edit: November 18, 2010, 10:24:26 pm by Kasuha » Logged
RAW_Randomation
JkDefrag Junior
**
Posts: 8


View Profile
« Reply #5 on: November 18, 2010, 10:35:39 pm »

You don't need a MakeGap to place a zone. Usually, zones will be placed after each other unless you have an Add/MakeGap. After removing the MakeGaps, the zones will be placed after the gap that was created by AddGap.
It's not my intention to make a gap to place a zone... I want to make a gap after the zone is done to allow for file seperation between one zone to the next, albeit a small gap.
This way, you will also prevent that a gap will be filled again. It is not (yet) possible to keep the vacated space created by Add/MakeGap clean.
Isn't this a contradiction? It can be done, but it can't be done (yet)? Or am I reading this wrong?


I'm also a bit confused as to why in Zone 2 and 4 of this previous script (as I've seen multiple times over in the Forums) that files are being placed ascendant. Why, if the files most used are being needed first, would you place them towards the end of the Zone? In these 2 specific Zones, I've changed these Actions to be descending (newest to oldest), as a conundrum I'd like input on.
You define "most used" as "recently accessed/created/changed". This is not true. But you can say that a file is *not* most used if it was not accessed/created/changed recently.
My focus here was more based off of the location placement of the file based off of the frequency of it's use, not persay it being not being accessed/created/changed recently. The files that are most often used would be more effective placed latest to least frequent, would it not? This is why "ascending" here doesn't make sense to me, with ascending being the opposite of that. Or do I have this wrong?

Remove the SortByLastAccess in zone 2. Usually, all these files are accessed frequently and there are two few of them so that such a sorting would have any impact in performance. If you want to keep it, remove PlaceNtfsSystemFiles, because SortByLastAccess will destroy what it has done. 
I just removed the SortByLastAccess and changed the PlaceNtfsSystemFiles to have it's action be aimed descending; effectively creating the same desired effect without the extra step. 

I don't know what files you have on your disk. But keep in mind that these files could have already been placed by previous zones. MyDefrag does not move a file again, if it has once been selected.
I pretty much chalked this one off as accurate. I don't have any files over that size; maybe in the future I'll create something to test this.
Logged
RAW_Randomation
JkDefrag Junior
**
Posts: 8


View Profile
« Reply #6 on: November 18, 2010, 10:42:14 pm »

FastFill neither fragments nor defragments. If you use FastFill() first, it will move all fragments together (without actually defragmenting them) and Defragment() will move them out of the zone again to defragment. This will leave holes in the zone and you would have to use FastFill() again.
Unless Jeroen has changed it in recent versions, FastFill() uses only whole files to fill gaps, not individual fragments. It may defragment a file but it may also make new gaps in the zone by pulling file fragments from already filled part. And it most probably won't defragment all files so the rest of the argument is correct. It is always good idea to defragment before filling.

That's pretty much what I got out of the concept I was going for; seeing that new placements could create new fragmentation, if even a small amount. But you're right, defragging before filling would make more sense.
Logged
RAW_Randomation
JkDefrag Junior
**
Posts: 8


View Profile
« Reply #7 on: November 18, 2010, 10:51:33 pm »


I also have a quick script (insert) request...

If I were to want to move a selected file (c:/USRD) elsewhere in the drive, say at 65% of the drive, just so it wasn't taking up space at the beginning of the drive (it's very infrequently accessed, or of little concern how long accessing to it would take).
How would a script of this nature look like?
« Last Edit: November 18, 2010, 10:53:21 pm by RAW_Randomation » Logged
Darlis
JkDefrag Hero
*****
Posts: 1725


View Profile WWW
« Reply #8 on: November 19, 2010, 06:49:42 pm »

It's not my intention to make a gap to place a zone... I want to make a gap after the zone is done to allow for file seperation between one zone to the next, albeit a small gap.
Then just remove the MakeGaps and you get what you want.

This way, you will also prevent that a gap will be filled again. It is not (yet) possible to keep the vacated space created by Add/MakeGap clean.
Isn't this a contradiction? It can be done, but it can't be done (yet)? Or am I reading this wrong?
AFAIK, Jeroen is going to implement something that will preserve the gaps. You can not do it with the current version but maybe with a future one.

I'm also a bit confused as to why in Zone 2 and 4 of this previous script (as I've seen multiple times over in the Forums) that files are being placed ascendant. Why, if the files most used are being needed first, would you place them towards the end of the Zone? In these 2 specific Zones, I've changed these Actions to be descending (newest to oldest), as a conundrum I'd like input on.
Directories are mostly accessed in alphabetical order. For example c:\a\b. The directories are very small, so caching is important here. If you access directory a, the data that comes after this directory on hard disk will be read too (read-ahead). If they are sorted alphabetically, it is likely that b will be in the cache. If they are swapped, the hard disk has to move it's heads to a.

As for the program hints files: The ascending import sequence is exactly like the files are accessed when a program starts. Sorting them exactly the other way around will decrease the performance (see above).

You define "most used" as "recently accessed/created/changed". This is not true. But you can say that a file is *not* most used if it was not accessed/created/changed recently.
My focus here was more based off of the location placement of the file based off of the frequency of it's use, not persay it being not being accessed/created/changed recently. The files that are most often used would be more effective placed latest to least frequent, would it not? This is why "ascending" here doesn't make sense to me, with ascending being the opposite of that. Or do I have this wrong?
Quote
SortByNewestDate
Place the selected items and sort by creation, last access, or last change date/time, whichever is newest, from oldest to newest ("ascending") or from newest to oldest ("descending").
Again, this way you can not determine the frequently accessed files. If you install/update a software, you'll get a lot of "frequently used" files this way.

I just removed the SortByLastAccess and changed the PlaceNtfsSystemFiles to have it's action be aimed descending; effectively creating the same desired effect without the extra step. 
See above.

I also have a quick script (insert) request...
Code:
Title( "Move a file" )
Description( "n/a" )

VolumeSelect
  Label( "C:" )
VolumeActions

  MakeGap( 0.65 * VolumeSize, DoNotVacate )
 
  FileSelect
    FullPath( "C:\", "USRD" )
  FileActions
    SortByName( ascending )
  FileEnd

VolumeEnd

Note that if you do not exclude this file from other scripts, it will be likely moved down again.
Logged

Need help creating a script? Try MyDefrag Script Creator.
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!