壓縮基本磁碟區Shrink a basic volume

適用於:Windows 10、Windows 8.1、Windows Server (半年度管道)、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012Applies To: Windows 10, Windows 8.1, Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

您可以透過將主要磁碟分割及邏輯磁碟機壓縮至同一硬碟上相鄰的連續未配置空間,以減少它們的使用空間。You can decrease the space used by primary partitions and logical drives by shrinking them into adjacent, contiguous space on the same disk. 例如,如果您發現您需要額外的磁碟分割,卻沒有額外的磁碟時,您可以從磁碟區的結尾處壓縮現有的磁碟分割,以建立供新磁碟分割使用的新未配置空間。For example, if you discover that you need an additional partition but do not have additional disks, you can shrink the existing partition from the end of the volume to create new unallocated space that can then be used for a new partition. 壓縮作業可能會因為存在特定檔案類型而遭封鎖。The shrink operation can be blocked by the presence of certain file types. 如需詳細資訊,請參閱其他考量For more information, see Additional Considerations

當您壓縮磁碟分割時,將會自動重新配置磁碟上的任何一般檔案以建立新的未配置空間。When you shrink a partition, any ordinary files are automatically relocated on the disk to create the new unallocated space. 不需要重新格式化磁碟來壓縮磁碟分割。There is no need to reformat the disk to shrink the partition.

警告

如果磁碟分割是包含資料 (例如資料庫檔案) 的原始磁碟分割 (也就是沒有檔案系統的磁碟分割),壓縮磁碟分割可能會損毀資料。If the partition is a raw partition (that is, one without a file system) that contains data (such as a database file), shrinking the partition might destroy the data.

壓縮基本磁碟區Shrinking a basic volume

注意

您必須至少是備份操作員系統管理員群組的成員,才能完成這些步驟。You must be a member of the Backup Operators or Administrators group, at minimum, to complete these steps.

若要使用 Windows 介面壓縮基本磁碟區To shrink a basic volume using the Windows interface

  1. 在 [磁碟管理員] 中,以滑鼠右鍵按一下您想要壓縮的基本磁碟區。In Disk Manager, right-click the basic volume you want to shrink.

  2. 按一下[壓縮磁碟區]Click Shrink Volume.

  3. 依照畫面上的指示操作。Follow the on-screen instructions.


注意

您只能壓縮沒有檔案系統或使用 NTFS 檔案系統的基本磁碟區。You can only shrink basic volumes that have no file system or that use the NTFS file system.

若要使用命令列壓縮基本磁碟區To shrink a basic volume using a command line

  1. 開啟命令提示字元,然後輸入 diskpartOpen a command prompt and type diskpart.

  2. DISKPART 提示中輸入 list volumeAt the DISKPART prompt, type list volume. 記下您要壓縮的簡單磁碟區編號。Note the number of the simple volume you want to shrink.

  3. DISKPART 提示中輸入 select volume <volumenumber>At the DISKPART prompt, type select volume <volumenumber>. 選取您要壓縮的簡單磁碟區 volumenumberSelects the simple volume volumenumber you want to shrink.

  4. DISKPART 提示中輸入 shrink [desired=<desiredsize>] [minimum=<minimumsize>]At the DISKPART prompt, type shrink [desired=<desiredsize>] [minimum=<minimumsize>]. 可能的話,將選取的磁碟區壓縮到 desiredsize (以 MB 為單位),如果 desiredsize 太大,則壓縮到 minimumsizeShrinks the selected volume to desiredsize in megabytes (MB) if possible, or to minimumsize if desiredsize is too large.


Value 描述Description

list volumelist volume

顯示所有磁碟上的基本和動態磁碟區。Displays a list of basic and dynamic volumes on all disks.

select volumeselect volume

選取指定的磁碟區 (其中 volumenumber 是磁碟區編號),並讓它成為焦點。Selects the specified volume, where volumenumber is the volume number, and gives it focus. 如果沒有指定磁碟區,select 會命令列出焦點所在的目前磁碟區。If no volume is specified, the select command lists the current volume with focus. 您可以用編號、磁碟機代號或掛接點路徑來指定磁碟區。You can specify the volume by number, drive letter, or mount point path. 在基本磁碟上,選取磁碟區也會讓對應的磁碟分割成為焦點。On a basic disk, selecting a volume also gives the corresponding partition focus.

shrinkshrink

壓縮具有焦點的磁碟區以建立未配置的空間。Shrinks the volume with focus to create unallocated space. 不會有任何資料遺失。No data loss occurs. 如果磁碟分割包含無法移動的檔案 (例如分頁檔或陰影複製存放區域),磁碟區將會壓縮到無法移動的檔案所在位置為止。If the partition includes unmovable files (such as the page file or the shadow copy storage area), the volume will shrink to the point where the unmovable files are located.

desired= desiredsizedesired= desiredsize

要回收到目前磁碟分割的空間數量,以 MB 為單位。The amount of space, in megabytes, to recover to the current partition.

minimum= minimumsizeminimum= minimumsize

至少要回收到目前磁碟分割的空間數量,以 MB 為單位。The minimum amount of space, in megabytes, to recover to the current partition. 如果未指定想要的大小或最小的大小,命令將會回收盡可能最大的空間數量。If you do not specify a desired or minimum size, the command will reclaim the maximum amount of space possible.

其他考量Additional considerations

  • 當您壓縮磁碟分割時,無法自動重新配置特定檔案 (例如分頁檔或陰影複製存放區域),而且也無法將配置的空間減少到超出無法移動的檔案所在位置以外。When you shrink a partition, certain files (for example, the paging file or the shadow copy storage area) cannot be automatically relocated, and you cannot decrease the allocated space beyond the point where the unmovable files are located. 如果壓縮作業失敗,請檢查應用程式記錄檔的事件 259,這可識別無法移動的檔案。If the shrink operation fails, check the Application Log for Event 259, which will identify the unmovable file. 如果您知道哪些叢集與阻止壓縮作業的檔案相關聯,也可以使用在命令提示字元使用 fsutil 命令 (輸入 fsutil volume querycluster /?If you know the cluster(s) associated with the file that is preventing the shrink operation, you can also use the fsutil command at a command prompt (type fsutil volume querycluster /? 以了解使用方式)。for usage). 當您提供 querycluster 參數時,命令輸出將會找出導致壓縮操作未能順利進行的無法移動檔案。When you provide the querycluster parameter, the command output will identify the unmovable file that is preventing the shrink operation from succeeding. 在某些情況下,您可以暫時重新配置檔案。In some cases, you can relocate the file temporarily. 例如,如果您需要進一步壓縮磁碟分割,可以使用 [控制台],將分頁檔或儲存的陰影複製移到其他磁碟、刪除儲存的陰影複製、壓縮磁碟區,然後再將分頁檔移回原來的磁碟。For example, if you need to shrink the partition further, you can use Control Panel to move the paging file or stored shadow copies to another disk, delete the stored shadow copies, shrink the volume, and then move the paging file back to the disk. 如果動態錯誤叢集重新對應所偵測到的錯誤叢集數目遺高,您就無法壓縮磁碟分割。If the number of bad clusters detected by dynamic bad-cluster remapping is too high, you cannot shrink the partition. 如果發生這種情況,您應該考慮移動資料並更換磁碟。If this occurs, you should consider moving the data and replacing the disk.

  • 請勿使用區塊層級複製來傳送資料。Do not use a block-level copy to transfer the data. 這會將損毀的磁區也一起複製,新磁碟便會將即使是正常的相同磁區視為已損毀。This will also copy the bad sector table and the new disk will treat the same sectors as bad even though they are normal.

  • 您可以壓縮原始磁碟分割 (沒有檔案系統的磁碟分割) 上的主要磁碟分割和邏輯磁碟機,或是使用 NTFS 檔案系統的磁碟分割。You can shrink primary partitions and logical drives on raw partitions (those without a file system) or partitions using the NTFS file system.

另請參閱See Also