Thank you Darlis. Yes I agree about the dedicated partition and non-fragmented free space.
I would add: use a dedicated hard drive; dedicate the first/fastest 30% or so for Fraps,
and the rest can be used for backup etc.
I came up with a defrag script for this situation:
this assumes we want as much free space at the start of the partition, we want
the MFT located at around 30% of the disk size, and any non-capture files should
be moved to the end, thus maximizing contiguous free space, as you say.
First run takes a while but subsequent runs are very fast.
Don't know if this will help the "freezing" problem, but I think it should eliminate
disk fragmentation as a factor.
Fraps-01.MyD
# MyDefrag v4.0 script for Fraps partitions
#
# L Bigelow / raffriff 14-Nov-2011.
# adapted from existing scripts from mydefrag.com, as noted.
Title('Fraps partition 0.1')
Description('
Process a Fraps capture partition (dedicated to video capture;
mostly free space, but with a *few* files we want to keep for awhile):
place the MFT and the directories at 30% into the disk;
move all except "raw" and "work" folders to end of disk.
Assumes "raw" (capture) files change rapidly; "work" (rough edit)
files change *fairly* rapidly; and speed unimportant for all other files.
For daily use - not a full defrag routine.
')
/* 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")
/* -------- SystemDiskDaily.MyD -------- */
/* Place files at 30% into the disk. */
MakeGap(RoundUp(VolumeSize * 0.3,VolumeSize * 0.01))
/* Zone 1: Place the MFT and some other special NTFS files. */
FileSelect
SelectNtfsSystemFiles(yes)
FileActions
PlaceNtfsSystemFiles(Ascending,MftSize * 0.1)
FileEnd
/* Zone 2: Directories. */
FileSelect
Directory(yes)
FileActions
SortByName(Ascending)
FileEnd
/* -------- ..\Example Scripts\MoveToEndOfDisk.MyD -------- */
/* Place your normal zones here. The zone with files at the end of the
disk must be the last zone. */
/* .... */
/* Move all remaining files to the end of the disk. */
FileSelect all
& not (
DirectoryName("raw")
or DirectoryName("work")
or DirectoryName("System Volume Information")
)
FileActions
MoveToEndOfDisk()
/* Defragment(Fast) */
/* FastFill() */
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 made a script to fill the partition with as many 4GB files as possible,
to get a feel for the time required. On my machine the first 3/4 of available free space
fills up very fast; after that, there's a delay for each new file of 1 or 2 seconds
(assuming partition is defragmented; if not it can go much more slowly)
It's a script for general research, and also might be good for remote troubleshooting.
Note contig.exe attempts to create contiguous files (as the name says) but will create
a fragmented file if it has to; the slowdown appears to come when the fragmenting starts.
prereq:
contig.exe from systernals (install on %path%)
usage: at a command prompt, type "
cscript contig-fill.vbs d"
where "d" is a drive letter (required)
contig-fill.vbs
Option Explicit
'** fill the disk with as many contiguous temp files as possible, then delete them
'
'@version 1.0 L Bigelow 16-Nov-2011
Dim gFileSysObj 'As Scripting.FileSystemObject
Dim gShellObj 'As Wscript.Shell
'******************************
'
'[[VBA -- uncomment this block for VB/VBA use (ie, for debugging in an IDE)
'Public Sub Main(args)
']]
StatMsg "****************************************************"
StatMsg "** contig-fill: fill the disk with as many contiguous"
StatMsg " temp files as possible, then delete them"
StatMsg ""
StatMsg "NOTE: systernal Config.exe must be installed on %PATH%"
StatMsg " http://technet.microsoft.com/en-us/sysinternals/bb897428"
StatMsg ""
StatMsg "usage: contig-fill <drive letter> [#] [/c#] [/nodelete]"
StatMsg " [#] = 1 to 4 [default 4] // file size in GB"
StatMsg " [/c#] // max number of files to create"
StatMsg " [/nodelete] // if present, do not delete temp files"
StatMsg "****************************************************"
StatMsg ""
'[[VBA
' Dim countArgs: countArgs = UBound(args) + 1
' If (Err) Then
' StatMsg " missing arguments"
' QuitApp False
' Exit Sub
' End If
'][VBS -- uncomment this block for VBScript
Dim countArgs: countArgs = WScript.Arguments.Count
If (countArgs = 0) Then
StatMsg " missing arguments"
QuitApp False
End If
Dim args(): ReDim args(countArgs - 1)
Dim pArg
For pArg = 0 To (countArgs - 1)
args(pArg) = WScript.Arguments(pArg)
Next
']]
On Error Resume Next
Dim sRoot: sRoot = Left(args(0), 1) & ":\"
Dim fSize: fSize = 0
Dim iMax: iMax = 0
Dim nodelete: nodelete = False
For pArg = 1 To (countArgs - 1)
If (args(pArg) = "/nodelete") Then
StatMsg " /nodelete = true"
nodelete = True
ElseIf ((Left(args(pArg), 2) = "/c") And (iMax = 0)) Then
iMax = CLng(Mid(args(pArg), 3))
If (Err) Then
StatMsg " /c argument is not a valid number"
QuitApp False
Else
StatMsg " max file count = " & CStr(iMax)
End If
ElseIf ((CLng(args(pArg)) > 0) And (fSize = 0)) Then
fSize = CLng(args(pArg))
If (Err) Then
StatMsg " size argument is not a valid number"
QuitApp False
ElseIf ((fSize < 1) Or (fSize > 4)) Then
StatMsg " size argument is out of range"
QuitApp False
End If
Else
StatMsg " your argument is invalid"
QuitApp False
End If
Next
If (fSize = 1) Then
StatMsg " temp file size = 1GB"
fSize = "1073741822" '1GB - 2 bytes
ElseIf (fSize = 2) Then
StatMsg " temp file size = 2GB"
fSize = "2147483646" '2GB - 2 bytes
ElseIf (fSize = 3) Then
StatMsg " temp file size = 3GB"
fSize = "3221225470" '3GB - 2 bytes
Else
StatMsg " temp file size = 4GB"
fSize = "4294967294" '4GB - 2 bytes; max supported by contig.exe ??
End If
Set gFileSysObj = CreateObject("Scripting.FileSystemObject")
If (Err) Then
StatMsg " error 702: " & Err.Description
QuitApp False
End If
Set gShellObj = CreateObject("WScript.Shell")
If (gFileSysObj.DriveExists(args(0)) = False) Then
StatMsg " error: drive """ & args(0) & """ not found"
QuitApp False
End If
Dim sPath 'As String
Dim errLvl 'As Long
Dim i: i = 0
Dim TMPFILE: TMPFILE = "$contig"
Dim LOGFILE: LOGFILE = gShellObj.ExpandEnvironmentStrings("%temp%") & "\contig-fill.log"
If (gFileSysObj.FileExists(LOGFILE)) Then
gFileSysObj.DeleteFile LOGFILE
End If
StatMsg " creating contig files in " & sRoot & " ..."
Do
i = i + 1
If ((i > iMax) And (iMax > 0)) Then
Exit Do
End If
sPath = sRoot & TMPFILE & CStr(i) & ".tmp"
If (gFileSysObj.FileExists(sPath)) Then
gFileSysObj.DeleteFile sPath
End If
Dim startTime: startTime = Now
errLvl = gShellObj.Run( _
"cmd /c contig -v -n " & sPath & " " & fSize & " >> " & LOGFILE, 7, True)
StatMsg " created " & sPath & " in " & _
FormatNumber(86400 * (Now - startTime), 0, True, True, False) & " sec"
If (Err) Then
StatMsg " error: " & Err.Description
Exit Do
ElseIf (errLvl) Then
'StatMsg " errorlevel: " & errLvl
Exit Do
End If
Loop
If Not (nodelete) Then
StatMsg " deleting temp files..."
gShellObj.Run "cmd /c del /q " & sRoot & TMPFILE & "*.tmp", 7, True
End If
StatMsg "...done"
QuitApp True
'End Sub
'********************************
'
Sub QuitApp(ByVal success)
' If (success) Then
' 'continue
' Else
''[[VBA
''Debug.Assert (False) 'step
'']]VBA
' StatMsg " error: " & Err.Description
' End If
'[[VBA
' End
'][VBS
WScript.Quit
']]
End Sub
'********************************
'** show/log message
'
Sub StatMsg(ByVal msg)
On Error Resume Next
'[[VBA
' Debug.Print msg
'][VBS
WScript.Echo msg
']]
Err.Clear
End Sub
Any thought or suggestions welcome. Do you agree with my placement of the
MFT at 30% of volume? Do I need to worry about its' being moved *back* the
the front if other defrag scripts are run? If so, maybe I should stick to common
practice....