Disk performance is a very important factor for Desktops and Servers. Desktops and Servers use disks very busy way to write and read data. While buying disk we should prefer a faster disk according to our budget. There is a way to make a disk faster without paying any money. We can defrag disks in Windows operating system. Keep in mind that this won’t work for SSD. We can use defrag
command to make our disk tidy for a file system.
磁盘性能是台式机和服务器的重要因素。 台式机和服务器使用磁盘非常忙的方式来写入和读取数据。 在购买磁盘时,我们应该根据预算选择更快的磁盘。 有一种方法可以使磁盘更快而无需支付任何费用。 我们可以在Windows操作系统中对磁盘进行碎片整理。 请记住,这不适用于SSD。 我们可以使用defrag
命令使文件系统的磁盘整齐。
GUI或命令行 (GUI or Command Line)
defrag
can be done in two ways. The first one is the GUI way Windows operating systems provide a GUI tool called Disk Defragmenter. Another way is using the command-line tool defrag
.
可以通过两种方式进行defrag
。 第一个是GUI方式,Windows操作系统提供了一个称为Disk Defragmenter的GUI工具。 另一种方法是使用命令行工具defrag
。
磁盘碎片整理程序 (Disk Defragmenter)
We can find Disk Defragmenter GUI tool in Program files -> Accessories or simply writing down to the Start
menu.
我们可以在程序文件->附件中找到Disk Defragmenter GUI工具,或者简单地写下“ Start
菜单。

The current status of partitions is listed with related drive letters. Also, last run information is given. Prevent defragmenting System Reserved partitions. We can select a partition and click the Defragment disk button to start the defragmentation. This may take some time. Also, we can click Configure schedule
button to configure defragmentation for future times to start automatically.
分区的当前状态与相关的驱动器号一起列出。 此外,还会提供上次运行信息。 防止对系统保留分区进行碎片整理。 我们可以选择一个分区,然后单击“碎片整理磁盘”按钮以开始碎片整理。 这可能要花点时间。 另外,我们可以单击“ Configure schedule
按钮来配置碎片整理,以便将来自动启动。
碎片整理命令 (Defrag Command)
defrag
is an MS-DOS or Powershell command. In order to run defrag we need Administrator privileges which means we should start the command line as Administrator.
defrag
是MS-DOS或Powershell命令。 为了运行碎片整理,我们需要管理员权限,这意味着我们应该以管理员身份启动命令行。
碎片整理帮助 (Defrag Help)
We can list detailed help information about the defrag
command like below.
我们可以列出有关defrag
命令的详细帮助信息,如下所示。
> defrag /?

执行碎片整理(Perform Defrag To A Volume)
The most popular usage form of defrag
is operating only a single volume. We need to specify the volume or partition name to the command. In this example, we will defrag E:
partition.
defrag
的最流行用法是仅操作单个卷。 我们需要为命令指定卷或分区名称。 在此示例中,我们将对E:
分区进行碎片整理。
> defrag E:

After defragmentation following information is provided.
碎片整理后,将提供以下信息。
- Volume Size 体积大小
- Free Space可用空间
- Total Fragmented Space总碎片空间
- Largest Free Space Size最大可用空间
在所有卷中执行碎片整理(Perform Defrag In All Volumes)
If we want to defrag in all volumes we can use /C
option. This will start the defragmentation process in all volumes in a sequential manner.
如果要对所有卷进行碎片整理,则可以使用/C
选项。 这将按顺序启动所有卷中的碎片整理过程。
> defrag /C
在屏幕上显示碎片整理进度 (Show Defrag Progress In Screen)
Defragmentation operation generally takes sometimes. We can list the current situation of defragmentation in the command line with /V
option. In this example, we will list defragmentation progress of volume E:
碎片整理操作通常需要花费一些时间。 我们可以使用/V
选项在命令行中列出碎片整理的当前情况。 在此示例中,我们将列出卷E:
碎片整理进度E:
> defrag E: /V

翻译自: https://www.poftut.com/windows-defrag-command-tutorial-examples-defrag-disks/