延伸儲存空間直接存取中的磁碟區Extending volumes in Storage Spaces Direct

適用於:Windows Server 2016Applies To: Windows Server 2016

本主題將說明如何調整直接儲存空間中的磁碟區大小。This topic provides instructions for resizing volumes in Storage Spaces Direct.

必要條件Prerequisites

儲存集區的容量Capacity in the storage pool

您可以調整磁碟區大小之前,請確定儲存集區中有足夠的容量,以容納其新的、更大的使用量。Before you resize a volume, make sure you have enough capacity in the storage pool to accommodate its new, larger footprint. 例如,將三向鏡像磁碟區從 1 TB 大小調整為 2 TB 時,使用量會從 3 TB 增加到 6 TB。For example, when resizing a three-way mirror volume from 1 TB to 2 TB, its footprint would grow from 3 TB to 6 TB. 為了調整大小成功,儲存集區將需要至少 (6 - 3) = 3 TB 的可用容量。For the resize to succeed, you would need at least (6 - 3) = 3 TB of available capacity in the storage pool.

熟悉儲存空間的磁碟區Familiarity with volumes in Storage Spaces

在儲存空間直接存取,每個磁碟區包含幾個堆疊物件:叢集共用磁碟區 (CSV) (這是磁碟區)、磁碟分割、磁碟 (這是虛擬磁碟),以及一或多個儲存層(如果有的話)。In Storage Spaces Direct, every volume is comprised of several stacked objects: the cluster shared volume (CSV), which is a volume; the partition; the disk, which is a virtual disk; and one or more storage tiers (if applicable). 若要調整磁碟區大小,您將需要調整幾個物件大小。To resize a volume, you will need to resize several of these objects.

volumes-in-smapi

若要熟悉它們,請嘗試執行Get- 搭配 PowerShell 的對應名詞使用。To familiarize yourself with them, try running Get- with the corresponding noun in PowerShell.

例如:For example:

Get-VirtualDisk

若要追蹤堆疊中物件之間的關聯,使用管線將一個 Get- cmdlet 的結果傳送至下一個,當做輸入。To follow associations between objects in the stack, pipe one Get- cmdlet into the next.

例如,以下是如何從虛擬磁碟取得,一直到其磁碟區︰For example, here's how to get from a virtual disk up to its volume:

Get-VirtualDisk <FriendlyName> | Get-Disk | Get-Partition | Get-Volume 

步驟 1 – 調整虛擬磁碟大小Step 1 – Resize the virtual disk

虛擬磁碟不一定使用儲存層,根據建立方式。The virtual disk may use storage tiers, or not, depending on how it was created.

若要檢查,請執行下列 Cmdlet:To check, run the following cmdlet:

Get-VirtualDisk <FriendlyName> | Get-StorageTier 

如果 cmdlet 沒有傳回任何項目,虛擬磁碟不使用儲存層。If the cmdlet returns nothing, the virtual disk doesn't use storage tiers.

無儲存層No storage tiers

如果虛擬磁碟沒有儲存層,您可以使用 Resize-VirtualDisk cmdlet 直接調整大小。If the virtual disk has no storage tiers, you can resize it directly using the Resize-VirtualDisk cmdlet.

-Size 參數提供新的大小。Provide the new size in the -Size parameter.

Get-VirtualDisk <FriendlyName> | Resize-VirtualDisk -Size <Size>

當您調整 VirtualDisk 大小,Disk 會自動接續,也調整大小。When you resize the VirtualDisk, the Disk follows automatically and is resized too.

Resize-VirtualDisk

使用儲存層With storage tiers

如果虛擬磁碟使用儲存層,您可以使用 Resize-StorageTier cmdlet 分別調整每個層大小。If the virtual disk uses storage tiers, you can resize each tier separately using the Resize-StorageTier cmdlet.

從虛擬磁碟追蹤關聯,取得儲存層的名稱。Get the names of the storage tiers by following the associations from the virtual disk.

Get-VirtualDisk <FriendlyName> | Get-StorageTier | Select FriendlyName

然後,針對每個層,以 -Size 參數提供新的大小。Then, for each tier, provide the new size in the -Size parameter.

Get-StorageTier <FriendlyName> | Resize-StorageTier -Size <Size>

提示

如果您的層級是不同的實體媒體類型 (例如 MediaType = SSDMediaType = HDD),您要確定儲存集區有足夠容量的媒體類型,以容納每一層新的、更大的使用量。If your tiers are different physical media types (such as MediaType = SSD and MediaType = HDD) you need to ensure you have enough capacity of each media type in the storage pool to accommodate the new, larger footprint of each tier.

當您調整 StorageTier 大小,VirtualDiskDisk 會自動接續,也調整大小。When you resize the StorageTier(s), the VirtualDisk and Disk follow automatically and are resized too.

Resize-StorageTier

步驟 2 – 調整磁碟分割大小Step 2 – Resize the partition

接下來,使用 Resize-Partitioncmdlet 調整磁碟分割大小。Next, resize the partition using the Resize-Partition cmdlet. 虛擬磁碟預期有兩個磁碟分割:第一個已保留,不應修改。第二個需要調整大小,有下列值 PartitionNumber = 2Type = BasicThe virtual disk is expected to have two partitions: the first is Reserved and should not be modified; the one you need to resize has PartitionNumber = 2 and Type = Basic.

-Size 參數提供新的大小。Provide the new size in the -Size parameter. 我們建議使用支援的大小上限,如下所示。We recommend using the maximum supported size, as shown below.

# Choose virtual disk
$VirtualDisk = Get-VirtualDisk <FriendlyName>

# Get its partition
$Partition = $VirtualDisk | Get-Disk | Get-Partition | Where PartitionNumber -Eq 2

# Resize to its maximum supported size 
$Partition | Resize-Partition -Size ($Partition | Get-PartitionSupportedSize).SizeMax

當您調整 Partition 大小,VolumeClusterSharedVolume 會自動接續,也調整大小。When you resize the Partition, the Volume and ClusterSharedVolume follow automatically and are resized too.

Resize-Partition

這樣就完成了!That's it!

提示

您可以執行 Get-Volume 檢查磁碟區是否有新的大小。You can verify the volume has the new size by running Get-Volume.

請參閱See also