Last active
September 19, 2020 00:30
-
-
Save chinoto/342d3e6e7906fbefab393a471c96754c to your computer and use it in GitHub Desktop.
MyDefrag script based on SystemDiskDaily. Uses rough sorting for NtfsSystemFiles and directories, puts files less than 128KB near the start, places files less than 50MB after that, and any larger files only have fragments smaller than 50MB combined. Hopefully this is all relatively quick to run and offers a practical benefit on rotational media.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MyDefrag v4.0 default script: System Disk Daily | |
# | |
# This script is part of the standard MyDefrag distribution. | |
Title("Damian's Daily") | |
Description("System Disk Daily description") // See the "Settings.MyD" file. | |
WindowSize(minimized) | |
#WhenFinished(exit) | |
/* 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 | |
DeleteJournal() | |
/* 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 | |
/* SkipBlock will make the sorting of files "rough" by skipping over chunks that seem mostly sorted */ | |
PlaceNtfsSystemFiles(Ascending SkipBlock(ZONE220N * 0.10, ZONE222N * 0.10), MftSize * 0.1) | |
FileEnd | |
/* Zone 2: Directories. */ | |
FileSelect | |
Directory(yes) | |
FileActions | |
SortByName(Ascending SkipBlock(ZONE220N * 0.10, ZONE222N * 0.10)) | |
FileEnd | |
/* Place files at the beginning of the disk. */ | |
MakeGap(0) | |
/* Zone 3: files used when booting, and a gap. */ | |
FileSelect | |
ImportListFromBootOptimize() | |
and Size(0, 10485760) | |
FileActions | |
Defragment(Fast) | |
Defragment() | |
FastFill() | |
AddGap(RoundUp(ZoneEnd, VolumeFree * 0.01)) | |
FileEnd | |
/* Zone 4: files used by the most used programs, and a gap. */ | |
FileSelect | |
ImportListFromProgramHints("*.pf") | |
and Size(0, 10485760) | |
FileActions | |
Defragment(Fast) | |
Defragment() | |
FastFill() | |
AddGap(RoundUp(ZoneEnd, VolumeFree * 0.01)) | |
FileEnd | |
/* Zone 5: tiny files and a gap. */ | |
FileSelect | |
/* | |
Size determined based on a majority of files being less than 128k (Figure 1), | |
but only consuming a minority of the disk (Figure 2). Putting these small files | |
together and closer to the edge of the disk should lead to faster loading of | |
applications that rely on many small files by decreasing seek time, whereas | |
read time of larger files outweighs seek time. | |
http://pages.cs.wisc.edu/~remzi/Classes/537/LectureNotes/Papers/windows-fs.pdf | |
*/ | |
Size(0, 131072) | |
FileActions | |
Defragment(Fast) | |
Defragment() | |
FastFill() | |
AddGap(RoundUp(ZoneEnd, VolumeFree * 0.01)) | |
FileEnd | |
/* Zone 6: regular files and a gap. */ | |
FileSelect | |
Size(0, 52428800) | |
FileActions | |
Defragment(Fast) | |
FastFill() | |
AddGap(RoundUp(ZoneEnd, VolumeFree * 0.01)) | |
FileEnd | |
/* Zone 7: spacehog files (less important files that take up a lot of space). */ | |
FileSelect | |
All | |
FileActions | |
/*All fragments at least 50MiB*/ | |
Defragment(ChunkSize(50)) | |
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment