defrag script for sysinternal contig

Page 4 of 5 FirstFirst ... 2345 LastLast

  1. Posts : 7,607
    Windows 10 Home 20H2
       #31

    My Music folder contains Chinese songs.

    Code:
    Contig v1.8 - Contig
    Copyright (C) 2001-2016 Mark Russinovich
    Sysinternals
    
    
    Processing D:\Music\# ???????...
    D:\Music\# ??????? is defragmented
    
    Processing D:\Music\Desktop.ini...
    D:\Music\Desktop.ini is defragmented
    
    Processing D:\Music\Testing sound files...
    D:\Music\Testing sound files is defragmented
    
    Processing D:\Music\???--????.mp4...
    D:\Music\???--????.mp4 is defragmented
    
    Processing D:\Music\???--????.mp4...
    D:\Music\???--????.mp4 is defragmented
      My Computer


  2. Posts : 7,607
    Windows 10 Home 20H2
       #32

    Code:
    Processing C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb...
    C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb is in 113 fragments
    I ran the script several times. There are still 113 fragments

    Code:
    C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb | 113 |  72  88  88  21,999,616 (21.0 MB)
      My Computer


  3. Posts : 745
    Windows 10/11
       #33

    I'll take a look, but I don't think Contig supports Unicode, so that could be problem.
      My Computer


  4. Posts : 745
    Windows 10/11
       #34

    The script is not complete. So far, it just has code to gather fragment details and I don't think that part is right yet (see my post regarding fsutil file queryextents).
      My Computer


  5. Posts : 7,607
    Windows 10 Home 20H2
       #35

    The defragmentation has made no difference.
    Code:
    C:\Windows\system32>"E:\Testing\Contig64.exe" "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"
    
    Contig v1.8 - Contig
    Copyright (C) 2001-2016 Mark Russinovich
    Sysinternals
    
    
    Summary:
         Number of files processed:      1
         Number of files defragmented:   1
         Number unsuccessfully procesed: 0
         Average fragmentation before: 84 frags/file
         Average fragmentation after : 84 frags/file
      My Computer


  6. Posts : 250
    Windows 10 22H2
    Thread Starter
       #36

    Matthew Wai said:
    The defragmentation has made no difference.
    Code:
    C:\Windows\system32>"E:\Testing\Contig64.exe" "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"
    
    Contig v1.8 - Contig
    Copyright (C) 2001-2016 Mark Russinovich
    Sysinternals
    
    
    Summary:
         Number of files processed:      1
         Number of files defragmented:   1
         Number unsuccessfully procesed: 0
         Average fragmentation before: 84 frags/file
         Average fragmentation after : 84 frags/file
    try:
    "E:\Testing\Contig64.exe" -v "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"

    and then :
    "E:\Testing\Contig.exe" -v "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"
      My Computers


  7. Posts : 745
    Windows 10/11
       #37

    @einstein1969 Can you explain why you want the results from the command "fsutil file layout"? The "Allocated size" items are always a few very small numbers, followed by the entire size of the file. It does not show the fragment sizes.
      My Computer


  8. Posts : 250
    Windows 10 22H2
    Thread Starter
       #38

    Matthew Wai said:
    My Music folder contains Chinese songs.

    Code:
    Contig v1.8 - Contig
    Copyright (C) 2001-2016 Mark Russinovich
    Sysinternals
    
    
    Processing D:\Music\# ???????...
    D:\Music\# ??????? is defragmented
    
    Processing D:\Music\Desktop.ini...
    D:\Music\Desktop.ini is defragmented
    
    Processing D:\Music\Testing sound files...
    D:\Music\Testing sound files is defragmented
    
    Processing D:\Music\???--????.mp4...
    D:\Music\???--????.mp4 is defragmented
    
    Processing D:\Music\???--????.mp4...
    D:\Music\???--????.mp4 is defragmented
    the problem is with contig output which does not use unicode but writes in codepage 1252.

    There is a solution for those files which are not covered by codepage 1252, I've already thought about it. I just didn't put it into practice because it could be a lot slower.

    But I'm working on it.

    However the contig in the defragmentation phase then seems to work

    Code:
    Processing N:\Victoria536\LNG\???????.Lng:
    Scanning file ...
    Scanning disk ...
    File is 4032 physical clusters in length.
    File is in 122 fragments.
    
    Found a free disk block at 844833794 of length 4583 for entire file.
    Moving 4032 clusters at file offset cluster 0 to disk cluster 844833794
    File size: 16515065 bytes
    Fragments before: 122
    Fragments after: 1
    ------------------------
    - - - Updated - - -

    LesFerch said:
    @einstein1969 Can you explain why you want the results from the command "fsutil file layout"? The "Allocated size" items are always a few very small numbers, followed by the entire size of the file. It does not show the fragment sizes.
    Actually, individual extents (fragments) would be needed as you tried to do before. But in order not to complicate things immediately, I started to obtain a parameter (the allocated disk size) to be able to make decisions, for example, on the defragmentation order.

    the actual file size does not always match the size allocated on the disk. For example sparse files or compressed files can take up much less space. So in this case the decision of how to defrag (the order) can change.

    To find out the size actually allocated I used a method that is not perfect. Now I'm writing version 0.0.4 which finds the right stream, which is the stream with no name and type/attribute (0x080) ie "::$DATA".

    The output of the fsutil command if you see returns all the streams and for each stream it indicates the allocated and real size. Generally the fourth element related to the stream ::$DATA is the allocated size. In fact, the script should be changed to search this way regardless of the language.

    I'm working on it...

    - - - Updated - - -

    at the moment the powershell script work fine how the dos batch script 0.0.3 !!!
      My Computers


  9. Posts : 745
    Windows 10/11
       #39

    @einstein1969 Thanks for the explanation. I look forward to seeing the final script. I don't need to defragment (I only have an SSD) but I always enjoy seeing how the code works. Thanks for sharing!
      My Computer


  10. Posts : 7,607
    Windows 10 Home 20H2
       #40

    einstein1969 said:
    try:
    "E:\Testing\Contig64.exe" -v "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"

    and then :
    "E:\Testing\Contig.exe" -v "C:\ProgramData\Malwarebytes\MB3Service\rules.mbdb"
    I found that "Contig.exe" alone can do the job. "Contig64.exe" is unneeded.

    "E:\Testing\Contig.exe" "The file path"

    Code:
    C:\Windows\system32>"E:\Testing\Contig.exe"  "C:\Users\Matthew_Wai\AppData\Local\Microsoft\Windows\Notifications\wpndatabase.db-wal"
    
    Contig v1.8 - Contig
    Copyright (C) 2001-2016 Mark Russinovich
    Sysinternals
    
    
    Summary:
         Number of files processed:      1
         Number of files defragmented:   1
         Number unsuccessfully procesed: 0
         Average fragmentation before: 16 frags/file
         Average fragmentation after : 1 frags/file
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:59.
Find Us




Windows 10 Forums