Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 21, 2013, 04:12:32 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: Side-effect of Select-/PlaceNtfsSystemFiles()  (Read 4981 times)
gerdb
JkDefrag Hero
*****
Posts: 70


View Profile
« on: July 29, 2009, 08:32:06 am »

First, thanks a lot for sorting out that reserved area handling stuff, diskmap looks much clearer now, especially at the beginning of a volume.

Back to the issue: Using Select-/PlaceNtfsSystemFiles() creates a block of files where the MFT is immediately followed by some other file. At least on XP this leads to a (imho) nasty side-effect: If the MFT reserved area cannot be placed right behind the MFT, it is created anywhere on the volume, allocating that infamous 12.5% of volume space if possible. And - guess what - on a FastOptimized volume this usually is located towards the end of the volume, possibly pushing newly created files even further to the end.

To prevent this I use the following workaround:
Code:
  FileSelect
    SelectNtfsSystemFiles(yes) and not(FileName("$mft"))
  FileActions
    PlaceNtfsSystemFiles(Ascending)
  FileEnd

  FileSelect
    FileName("$mft")
  FileActions
    PlaceNtfsSystemFiles(Ascending)
    AddGap(Megabytes(20))
  FileEnd

This creates the block of system files with the MFT at the end, followed by a small gap to place the reserved area.

Did not check this on Vista. Might not be an issue there.
Logged
WindHydra
JkDefrag Hero
*****
Posts: 69


View Profile
« Reply #1 on: July 29, 2009, 08:54:52 am »

Does your script make the reserved zone grow everytime it moves the $MFT file? I use
Code:
  FileSelect
    FileName("$mft")
  FileActions
    PlaceNtfsSystemFiles(Ascending)
    AddGap(UntilMegabytesMultiple(10))
  FileEnd

  FileSelect
    SelectNtfsSystemFiles(yes)
  FileActions
    PlaceNtfsSystemFiles(Ascending)
    AddGap(UntilMegabytesMultiple(10))
  FileEnd
and when $MFT gets moved, the reserved zone expands to the end of the gap.  This makes the zone grow by about 10mb everytime the $MFT moves.  It was ~10mb when I first ran the script a few weeks ago, now it's ~70mb.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #2 on: July 29, 2009, 08:57:11 am »

Did not check this on Vista. Might not be an issue there.
It's just the same in Vista. I also use the same workaround to place the reserved zone after the mft. Wink
Logged

Need help creating a script? Try MyDefrag Script Creator.
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #3 on: July 29, 2009, 09:26:46 am »

Using Select-/PlaceNtfsSystemFiles() creates a block of files where the MFT is immediately followed by some other file.
It's a nice trick, but as WindHydra has noticed it will cause the NTFS reserved area to grow with every reboot. The first time you run your script everything works as expected, mft, gap, other files, and after a reboot Windows will make an NTFS reserved area exactly spanning the gap. However, if you then run MyDefrag again then the result will be mft, ntfs area, GAP, and other files. The gap is placed after the NTFS reserved area, the AddGap sees the NTFS area as unmovable space, not as a gap. If you reboot then Windows will size the NTFS area to the end of the gap. The area grows in size on every reboot by the size of the gap.

That's why I placed the other system files directly after the mft, to prevent an ever growing NTFS reserved area. I have it on my list to do something about it, perhaps add a keyword to the PlaceNtfsSystemFiles action to make a gap after the mft.
Logged
TeDDy
JkDefrag Hero
*****
Posts: 158


View Profile WWW
« Reply #4 on: July 30, 2009, 05:47:12 pm »

Quote
Using Select-/PlaceNtfsSystemFiles() creates a block of files where the MFT is immediately followed by some other file.
Can this 'trick' be done automatically by MyDefrag ?
Should be nice.

Also, the 'SelectNtfsSystemFiles(yes)' selct personal folders wich unfortunately begin with '$' for sorting purposes.
The SelectNtfsSystemFiles(yes) should select ONLY the Ntfs System Files wich are always the same.

Also, Ntfs System Files should be selected ONLY by 'SelectNtfsSystemFiles(yes)' and not as regular files. If not explicit excluded and user wish to place the NtfsFiles after other zones those can't be moved.
FileSelect all should be ALL without 'special' files/folders (pagefile, hiberfil, Ntfs System...etc)
« Last Edit: July 30, 2009, 07:05:52 pm by TeDDy » Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #5 on: July 30, 2009, 05:54:47 pm »

If you don't want to have these files in some zones, then just exclude them.
If 'all' would not select all files, then this would be strange and would also lead to complaints from others.
Logged

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


View Profile WWW
« Reply #6 on: July 30, 2009, 07:14:31 pm »

If you don't want to have these files in some zones, then just exclude them.
If 'all' would not select all files, then this would be strange and would also lead to complaints from others.
Usually, selection of some 'special' files by the ALL fileboolean will create unmovables(pagefile, hiberfil) for the active drive OR will mix them alltogether if drive 'offline'

In my opinion, special files SHOULD/MUST be excluded by default if not selected explicitly.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #7 on: July 30, 2009, 07:29:05 pm »

Usually, selection of some 'special' files by the ALL fileboolean will create unmovables(pagefile, hiberfil) for the active drive ...
So, these special files will be moveable when you select them directly?

... OR will mix them alltogether if drive 'offline'
If you never select these files with ALL and the special selectors, they will end up behind the last zone. This is just what the standard scripts do. If you want to place them in other zones, you will have to select them explicitly, just like it is done with the NTFS-System files in the current scripts.
Logged

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


View Profile WWW
« Reply #8 on: July 30, 2009, 07:48:16 pm »

Quote
So, these special files will be moveable when you select them directly?
To be brief:
If by some trick I have pagefile.sys to the first cluster of the drive and I defrag from a bootCD, the pagefile can be moved/vacated by some mistake with a sortbyname/size.
If MyDefrag, by default ignore/exclude special files NOT EXPLICITLY SELECTED from the 'ALL' bunch, should be good.


Quote
If you never select these files with ALL and the special selectors, they will end up behind the last zone.
There is my point. The ALL or other selections NEVER touch them, so they stay in their places.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #9 on: July 30, 2009, 08:13:04 pm »

So what you're saying is that special files should be excluded, just like the ExcludeFiles() statement does, so MyDefrag does not even think about moving them? Unless you would explicitly select them with a SelectSpecialFiles() statement?

But that would mean that these files will block space MyDefrag would normally occupy with files that should go there by a FileSelect and then eventually leave gaps, when these files are being moved with SelectSpecialFiles(). So you would have to run the script twice to get the result you want.

Example: The pagefile is at the beginning of the volume and moveable. If you would want it to be there, then insert a FileSelect with the pagefile as the first zone.
If you want the pagefile somewhere in the middle, the insert a FileSelect with the pagefile in the middle of the script. The pagefile will be moved, even with your version.
If you want the pagefile at the end of the volume, insert a FileSelect with the pagefile at the end of the script. The pagefile will also be moved, even with your version.
If you do not want the pagefile to be moved at all, insert an ExcludeFiles statement with the pagefile.

So, in my opinion, I don't see a need for such a incomplete ALL selector.
You also have to define 'special'. Like, why would a pagefile be 'special' and nvlddmkm.sys would be not?
Logged

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


View Profile WWW
« Reply #10 on: July 30, 2009, 08:43:06 pm »

By special files(some of them):
-pagefile.sys (in the fastest zone of drive)
-hiberfil.sys(in the slowest zone of drive)
-NtfsSystemFiles (after pagefile, bootfiles and folders/very_accessed_files) (http://www.mydefrag.com/FileBoolean-SelectNtfsSystemFiles.html)
-maybe others, don't know

Those 'special files', dictates the drive performance and should never be mixed with the others by some sortbyname/size selections.

The default fastOptimize script, when used from a BootCD, WILL select and fastfill pagefile.sys in the last zone(5) with the spacehogs. Please don't trust me, try it yourself.

To avoid this, do you think I should "and not FileName("pagefile.sys")" every zone to leave it in place ?

Never mind.
I think you can't get the idea.
I give up.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #11 on: July 30, 2009, 09:00:17 pm »

In my opinion, special files SHOULD/MUST be excluded by default if not selected explicitly.
I respectfully disagree. The MyDefrag scripting language should not automatically exclude some files from the FileSelect, and people writing scripts should have complete freedom to decide in which zone they want to place a file.

The SelectNtfsSystemFiles() fileboolean is equivalent to the following MyDefrag FileBoolean, but I added it as a separate command because it is much faster:
Code:
(FullPath("?:\$*") or FullPath("?:\$Extend\$*")) and not (FileName("$RECYCLE.BIN"))

Quote
To avoid this, do you think I should "and not FileName("pagefile.sys")" every zone to leave it in place ?
It is up to you to write a script that does exactly what you want. Please note that if you add "and not FileName("pagefile.sys")" to every zone, that the pagefile will NOT be left alone, it will be moved to behind the last data. See the ExcludeFiles setting to make sure that a file is never moved.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #12 on: July 30, 2009, 09:07:02 pm »

I think I get the idea. You want the files, which are frequently accessed, being moved to the front, right? If so, you can achieve this with
Code:
VolumeActions 
  FileSelect  SelectNtfsSystemFiles(yes)
  FileActions PlaceNtfsSystemFiles(Ascending)
  FileEnd

  FileSelect  FileName("pagefile.sys")
                or FileName("hiberfile.sys")
                or ...
  FileActions PlaceNtfsSystemFiles(Ascending)
  FileEnd

  ...
Where is the problem?

To avoid this, do you think I should "and not FileName("pagefile.sys")" every zone to leave it in place ?
Just put it in the ExcludeFiles() statements. Thats what it is for.

Those 'special files', dictates the drive performance and should never be mixed with the others by some sortbyname/size selections.
I agree with you there. But how do find out all these files? Are these files the same on every System? If not, why hard code them into MyDefrag?

I, for example, let ProcessMonitor log my disk activity and then let MyDefrag put the logged files at the front of the disk. This resulting list of 'special files' is only compatible with my system, because you might use another OS and other programs. You see, everyone has to determine there own special files.
Logged

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


View Profile WWW
« Reply #13 on: July 30, 2009, 11:25:13 pm »

Please let me explain in other way.

Starting MyDefrag.exe by 2click on it will do a FastOptimize by default. Right ?

When started in a normal windows session pagefile & hiberfil(for example) are locked on the active drive BUT can be moved on other inactive physical boot drive. Right ?
In wich zone selects them the default FastOptimize script ? I say zone 5, spacehogs !
What I wish is to ignore those files by default from ALL selection and ALSO from vacate actions UNTIL/if I manually select them.
If the script has not EXPLICIT selection for this files, they remain untouched.
Is this wrong?

Also the NtfsSystemFiles, they begin with '$' as mask.
I have on my drives many personal folders wich begin with '$' and get mixed with NtfsSystemFiles when  processed.
I wish to have the: $MFT, $MFTMirr, $LogFile, $Volume, $AttrDef, $Bitmap, $Boot, $BadClus, $Quota, $Secure, $UpCase, $Extend, internally defined as NtfsSystemFiles and avoid accidental selection with ALL or vacate.
Is this wrong?

I mean, after analyze the volume, those files are flagged as unmovables until the script change this status and select them.
Is this wrong?
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #14 on: July 31, 2009, 07:20:31 am »

Yes, this is the normal behavior of the standard scripts, and the way you want to place your files is not 'wrong'. But it is wrong to hard code this behavior in MyDefrag.

As I said before, you can exclude these files. Just insert the following lines into the Settings.MyD script:
Code:
ExcludeFiles(
  SelectNtfsSystemFiles(yes)
  or FileName("$*")
  or FileName("pagefile.sys")
  or FileName("hiberfil.sys")
)
Whenever you run a script which has the line "RunScript("Settings.MyD")" (all standard scripts have that line), these files will be excluded.

To select all files again, remove the statement from  the Settings.MyD script or insert the following line after "RunScript("Settings.MyD")" in the script you want to run:
Code:
ExcludeFiles( NOT(ALL) )
Logged

Need help creating a script? Try MyDefrag Script Creator.
Pages: [1] 2 3
  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!