Windows如何计算碎片百分比?


1

defrag -a -v C:在Windows 2008 R2上运行时,我得到以下输出:

Windows磁盘碎片整理程序
版权所有(c)2006 Microsoft Corp.

卷C的分析报告:

    体积大小= 40.00 GB
    群集大小= 4 KB
    已用空间= 13.94 GB
    可用空间= 26.06 GB
    可用空间百分比= 65%

文件碎片
    文件碎片百分比= 19%
    可移动文件总数= 73,181
    平均文件大小= 233 KB
    碎片文件总数= 1,574
    总过量碎片= 5,611
    每个文件的平均片段数= 1.09
    总不可移动文件= 21

百分比文件碎片的价值似乎很奇怪,我。从文件计数来看,1574个碎片文件只占文件总数的2%。

Windows如何计算百分比文件碎片值?


19%是所有文件中的碎片数量与每个扇区中文件段总数的比较。
Ramhound 2015年

Windows跳过超过64MB的文件,所以我猜19%是从较小的64MB文件中计算得出的:“在Windows XP中,任何分成多个文件的文件都被视为碎片。如果碎片足够大,在Windows Vista中则不然。 - 更改了碎片整理算法(从Windows XP)以忽略大于64MB的文件碎片。因此,XP中的碎片整理和Vista中的碎片整理将报告卷上的不同碎片量。blogs.msdn.com/b/e7/archive/2009/01/25/ ...
magicandre1981 2015年

@ magicandre1981请注意,只有14 GB的空间正在使用中。这意味着超过64MB的文件不能超过200个。所以我不认为这可以解释差异,当文件总数是73 181.
jpa 2015年

Answers:


1

此计算是隐藏的,信息由Win32_DefragAnalysis类提供:

所述Win32_DefragAnalysis类表示的卷上碎裂的值。Win32_DefragAnalysis类的实例作为out参数从Win32_Volume方法DefragAnalysis和Defrag传递。

class Win32_DefragAnalysis
{
  uint64 AverageFileSize;
  real64 AverageFragmentsPerFile;
  real64 AverageFreeSpacePerExtent;
  uint64 ClusterSize;
  uint64 ExcessFolderFragments;
  uint32 FilePercentFragmentation;
  uint64 FragmentedFolders;
  uint64 FreeSpace;
  uint32 FreeSpacePercent;
  uint32 FreeSpacePercentFragmentation;
  uint64 LargestFreeSpaceExtent;
  uint32 MFTPercentInUse;
  uint64 MFTRecordCount;
  uint64 PageFileSize;
  uint64 TotalExcessFragments;
  uint64 TotalFiles;
  uint64 TotalFolders;
  uint64 TotalFragmentedFiles;
  uint64 TotalFreeSpaceExtents;
  uint64 TotalMFTFragments;
  uint64 TotalPageFileFragments;
  uint32 TotalPercentFragmentation;
  uint64 TotalUnmoveableFiles;
  uint64 UsedSpace;
  string VolumeName;
  uint64 VolumeSize;
};

此类不是任何客户端操作系统的端口。
magicandre1981 2015年

没有真正回答这个问题。我希望FilePercentFragmentation成员可以在某处记录,但找不到任何东西。
jpa 2015年

1

看起来:

文件碎片百分比 = 可用空间百分比(碎片整理后) - 可用空间百分比 (碎片整理前)

换句话说,通过执行完全碎片整理添加的可用空间百分比。

如您所见,7%= 31% - 24%:

C:\Windows\system32>defrag c: -w -v
Windows Disk Defragmenter
Copyright (c) 2006 Microsoft Corp.`

Defragmentation report for volume C:

    Volume size                         = 74.53 GB
    Cluster size                        = 4 KB
    Used space                          = 55.96 GB
    Free space                          = 18.57 GB
    Percent free space                  = 24 %

File fragmentation
    Percent file fragmentation          = 7 %
    Total movable files                 = 203,178
    Average file size                   = 342 KB
    Total fragmented files              = 3,641
    Total excess fragments              = 32,280
    Average fragments per file          = 1.19
    Total unmovable files               = 26

Free space fragmentation
    Free space                          = 18.57 GB
    Total free space extent             = 22,689
    Average free space per extent       = 858 KB
    Largest free space extent           = 4.09 GB

Folder fragmentation
    Total folders                       = 40,150
    Fragmented folders                  = 155
    Excess folder fragments             = 567

Master File Table (MFT) fragmentation
    Total MFT size                      = 203 MB
    MFT record count                    = 205,234
    Percent MFT in use                  = 98
    Total MFT fragments                 = 3

    Note: On NTFS volumes, file fragments larger than 64MB are not included in the fragmentation statistics

Defragmentation report for volume C:

    Volume size                         = 74.53 GB
    Cluster size                        = 4 KB
    Used space                          = 50.90 GB
    Free space                          = 23.62 GB
    Percent free space                  = 31 %

File fragmentation
    Percent file fragmentation          = 0 %
    Total movable files                 = 203,178
    Average file size                   = 342 KB
    Total fragmented files              = 3
    Total excess fragments              = 1,152
    Average fragments per file          = 1.00
    Total unmovable files               = 26

Free space fragmentation
    Free space                          = 23.62 GB
    Total free space extent             = 10,109
    Average free space per extent       = 2 MB
    Largest free space extent           = 6.99 GB

Folder fragmentation
    Total folders                       = 40,150
    Fragmented folders                  = 1
    Excess folder fragments             = 0

Master File Table (MFT) fragmentation
    Total MFT size                      = 203 MB
    MFT record count                    = 205,234
    Percent MFT in use                  = 98
    Total MFT fragments                 = 3

    Note: On NTFS volumes, file fragments larger than 64MB are not included in the fragmentation statistics

C:\Windows\system32>  

另一方面,在对驱动器进行碎片整理后,Percent可用空间不会更改,也不会更改Percent文件碎片,即使Total碎片文件编号确实更改:

C:\Windows\system32>defrag d: -w -v -f
Windows Disk Defragmenter
Copyright (c) 2006 Microsoft Corp.

Defragmentation report for volume D:

    Volume size                         = 932 GB
    Cluster size                        = 4 KB
    Used space                          = 841 GB
    Free space                          = 90.89 GB
    Percent free space                  = 9 %

File fragmentation
    Percent file fragmentation          = 2 %
    Total movable files                 = 400,108
    Average file size                   = 2 MB
    Total fragmented files              = 7,671
    Total excess fragments              = 1,420,753
    Average fragments per file          = 4.70
    Total unmovable files               = 7

Free space fragmentation
    Free space                          = 90.89 GB
    Total free space extent             = 213,633
    Average free space per extent       = 446 KB
    Largest free space extent           = 27.46 GB

Folder fragmentation
    Total folders                       = 16,189
    Fragmented folders                  = 526
    Excess folder fragments             = 2,304

Master File Table (MFT) fragmentation
    Total MFT size                      = 421 MB
    MFT record count                    = 405,678
    Percent MFT in use                  = 94
    Total MFT fragments                 = 3

    Note: On NTFS volumes, file fragments larger than 64MB are not included in the fragmentation statistics

Defragmentation report for volume D:

    Volume size                         = 932 GB
    Cluster size                        = 4 KB
    Used space                          = 841 GB
    Free space                          = 90.89 GB
    Percent free space                  = 9 %

File fragmentation
    Percent file fragmentation          = 2 %
    Total movable files                 = 400,108
    Average file size                   = 2 MB
    Total fragmented files              = 353
    Total excess fragments              = 1,226,342
    Average fragments per file          = 4.19
    Total unmovable files               = 7

Free space fragmentation
    Free space                          = 90.89 GB
    Total free space extent             = 260,094
    Average free space per extent       = 366 KB
    Largest free space extent           = 27.46 GB

Folder fragmentation
    Total folders                       = 16,189
    Fragmented folders                  = 1
    Excess folder fragments             = 0

Master File Table (MFT) fragmentation
    Total MFT size                      = 421 MB
    MFT record count                    = 405,678
    Percent MFT in use                  = 94
    Total MFT fragments                 = 3

    Note: On NTFS volumes, file fragments larger than 64MB are not included in the fragmentation statistics

C:\Windows\system32>
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.