

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Petakan disk non-NVME di instans Amazon EC2 Windows ke volume
<a name="windows-list-disks"></a>

Untuk instance yang diluncurkan dari AMI Windows yang menggunakan driver AWS PV atau Citrix PV, Anda dapat menggunakan hubungan yang dijelaskan di halaman ini untuk memetakan disk Windows ke penyimpanan instans dan volume EBS Anda. Topik ini menjelaskan cara melihat **NVMe non-disk** yang tersedia untuk sistem operasi Windows pada instance Anda. Ini juga menunjukkan cara memetakan disk non-NVME tersebut ke volume Amazon EBS yang mendasarinya dan nama perangkat yang ditentukan untuk pemetaan perangkat blok yang digunakan oleh Amazon EC2.

**catatan**  
Jika Anda meluncurkan instance Jika AMI Windows Anda menggunakan driver Red Hat PV, Anda dapat memperbarui instans Anda untuk menggunakan driver Citrix. Untuk informasi selengkapnya, lihat [Tingkatkan driver PV pada instans EC2 Windows](Upgrading_PV_drivers.md).

**Topics**
+ [Daftar non- NVMe disk](#windows-disks)
+ [Petakan NVMe non-disk ke volume](#windows-volume-mapping)

## Daftar non- NVMe disk
<a name="windows-disks"></a>

Anda dapat menemukan disk pada instance Windows Anda menggunakan Manajemen Disk atau PowerShell.

------
#### [ Disk Management ]

**Untuk menemukan disk di instans Windows Anda**

1. Masuk ke instans Windows menggunakan Remote Desktop. Untuk informasi selengkapnya, lihat [Hubungkan ke instans Windows Anda menggunakan RDP](connecting_to_windows_instance.md).

1. Mulai utilitas Manajemen Disk.

   **Pada bilah tugas, klik kanan logo Windows, lalu pilih Manajemen Disk.**

1. Tinjau disk. Volume root adalah volume EBS yang dipasang sebagai `C:\`. Jika tidak ada disk lain yang ditampilkan, berarti Anda tidak menentukan volume tambahan saat membuat AMI atau meluncurkan instans.

   Berikut ini adalah instans yang menunjukkan disk yang tersedia jika Anda meluncurkan instans `m3.medium` dengan volume penyimpanan instans (Disk 2) dan volume EBS tambahan (Disk 1).  
![Manajemen Disk dengan volume root, satu volume penyimpanan instans, dan satu volume EBS.](http://docs.aws.amazon.com/id_id/AWSEC2/latest/UserGuide/images/disk_management.png)

1. Klik kanan panel abu-abu dengan label Disk 1, lalu pilih **Properti**. Perhatikan nilai **Lokasi** dan cari dalam tabel di [Petakan NVMe non-disk ke volume](#windows-volume-mapping). Misalnya, disk berikut memiliki lokasi Nomor Bus 0, Target Id 9, LUN 0. Menurut tabel untuk volume EBS, nama perangkat untuk lokasi ini adalah `xvdj`.  
![Lokasi volume EBS.](http://docs.aws.amazon.com/id_id/AWSEC2/latest/UserGuide/images/disk_1_location.png)

------
#### [ PowerShell ]

 PowerShell Skrip berikut mencantumkan setiap disk dan nama dan volume perangkat yang sesuai.

**Persyaratan dan batasan**
+ Memerlukan Windows Server 2012 atau yang lebih baru.
+ Memerlukan kredensial untuk mendapatkan ID volume EBS. Anda dapat mengonfigurasi profil menggunakan Alat untuk PowerShell, atau melampirkan peran IAM ke instance.
+ Tidak mendukung NVMe volume.
+ Tidak mendukung disk dinamis.

Hubungkan ke instans Windows Anda dan jalankan perintah berikut untuk mengaktifkan PowerShell pelaksanaan skrip.

```
Set-ExecutionPolicy RemoteSigned
```

Salin skrip berikut dan simpan sebagai `mapping.ps1` di instans Windows Anda.

```
# List the disks
function Convert-SCSITargetIdToDeviceName {
  param([int]$SCSITargetId)
  If ($SCSITargetId -eq 0) {
    return "sda1"
  }
  $deviceName = "xvd"
  If ($SCSITargetId -gt 25) {
    $deviceName += [char](0x60 + [int]($SCSITargetId / 26))
  }
  $deviceName += [char](0x61 + $SCSITargetId % 26)
  return $deviceName
}

[string[]]$array1 = @()
[string[]]$array2 = @()
[string[]]$array3 = @()
[string[]]$array4 = @()

Get-WmiObject Win32_Volume | Select-Object Name, DeviceID | ForEach-Object {
  $array1 += $_.Name
  $array2 += $_.DeviceID
}

$i = 0
While ($i -ne ($array2.Count)) {
  $array3 += ((Get-Volume -Path $array2[$i] | Get-Partition | Get-Disk).SerialNumber) -replace "_[^ ]*$" -replace "vol", "vol-"
  $array4 += ((Get-Volume -Path $array2[$i] | Get-Partition | Get-Disk).FriendlyName)
  $i ++
}

[array[]]$array = $array1, $array2, $array3, $array4

Try {
  $InstanceId = Get-EC2InstanceMetadata -Category "InstanceId"
  $Region = Get-EC2InstanceMetadata -Category "Region" | Select-Object -ExpandProperty SystemName
}
Catch {
  Write-Host "Could not access the instance Metadata using AWS Get-EC2InstanceMetadata CMDLet.
Verify you have AWSPowershell SDK version '3.1.73.0' or greater installed and Metadata is enabled for this instance." -ForegroundColor Yellow
}
Try {
  $BlockDeviceMappings = (Get-EC2Instance -Region $Region -Instance $InstanceId).Instances.BlockDeviceMappings
  $VirtualDeviceMap = (Get-EC2InstanceMetadata -Category "BlockDeviceMapping").GetEnumerator() | Where-Object { $_.Key -ne "ami" }
}
Catch {
  Write-Host "Could not access the AWS API, therefore, VolumeId is not available.
Verify that you provided your access keys or assigned an IAM role with adequate permissions." -ForegroundColor Yellow
}

Get-disk | ForEach-Object {
  $DriveLetter = $null
  $VolumeName = $null
  $VirtualDevice = $null
  $DeviceName = $_.FriendlyName

  $DiskDrive = $_
  $Disk = $_.Number
  $Partitions = $_.NumberOfPartitions
  $EbsVolumeID = $_.SerialNumber -replace "_[^ ]*$" -replace "vol", "vol-"
  if ($Partitions -ge 1) {
    $PartitionsData = Get-Partition -DiskId $_.Path
    $DriveLetter = $PartitionsData.DriveLetter | Where-object { $_ -notin @("", $null) }
    $VolumeName = (Get-PSDrive | Where-Object { $_.Name -in @($DriveLetter) }).Description | Where-object { $_ -notin @("", $null) }
  }
  If ($DiskDrive.path -like "*PROD_PVDISK*") {
    $BlockDeviceName = Convert-SCSITargetIdToDeviceName((Get-WmiObject -Class Win32_Diskdrive | Where-Object { $_.DeviceID -eq ("\\.\PHYSICALDRIVE" + $DiskDrive.Number) }).SCSITargetId)
    $BlockDeviceName = "/dev/" + $BlockDeviceName
    $BlockDevice = $BlockDeviceMappings | Where-Object { $BlockDeviceName -like "*" + $_.DeviceName + "*" }
    $EbsVolumeID = $BlockDevice.Ebs.VolumeId
    $VirtualDevice = ($VirtualDeviceMap.GetEnumerator() | Where-Object { $_.Value -eq $BlockDeviceName }).Key | Select-Object -First 1
  }
  ElseIf ($DiskDrive.path -like "*PROD_AMAZON_EC2_NVME*") {
    $BlockDeviceName = (Get-EC2InstanceMetadata -Category "BlockDeviceMapping")."ephemeral$((Get-WmiObject -Class Win32_Diskdrive | Where-Object { $_.DeviceID -eq ("\\.\PHYSICALDRIVE" + $DiskDrive.Number) }).SCSIPort - 2)"
    $BlockDevice = $null
    $VirtualDevice = ($VirtualDeviceMap.GetEnumerator() | Where-Object { $_.Value -eq $BlockDeviceName }).Key | Select-Object -First 1
  }
  ElseIf ($DiskDrive.path -like "*PROD_AMAZON*") {
    if ($DriveLetter -match '[^a-zA-Z0-9]') {
      $i = 0
      While ($i -ne ($array3.Count)) {
        if ($array[2][$i] -eq $EbsVolumeID) {
          $DriveLetter = $array[0][$i]
          $DeviceName = $array[3][$i]
        }
        $i ++
      }
    }
    $BlockDevice = ""
    $BlockDeviceName = ($BlockDeviceMappings | Where-Object { $_.ebs.VolumeId -eq $EbsVolumeID }).DeviceName
  }
  ElseIf ($DiskDrive.path -like "*NETAPP*") {
    if ($DriveLetter -match '[^a-zA-Z0-9]') {
      $i = 0
      While ($i -ne ($array3.Count)) {
        if ($array[2][$i] -eq $EbsVolumeID) {
          $DriveLetter = $array[0][$i]
          $DeviceName = $array[3][$i]
        }
        $i ++
      }
    }
    $EbsVolumeID = "FSxN Volume"
    $BlockDevice = ""
    $BlockDeviceName = ($BlockDeviceMappings | Where-Object { $_.ebs.VolumeId -eq $EbsVolumeID }).DeviceName
  }
  Else {
    $BlockDeviceName = $null
    $BlockDevice = $null
  }
  New-Object PSObject -Property @{
    Disk          = $Disk;
    Partitions    = $Partitions;
    DriveLetter   = If ($DriveLetter -eq $null) { "N/A" } Else { $DriveLetter };
    EbsVolumeId   = If ($EbsVolumeID -eq $null) { "N/A" } Else { $EbsVolumeID };
    Device        = If ($BlockDeviceName -eq $null) { "N/A" } Else { $BlockDeviceName };
    VirtualDevice = If ($VirtualDevice -eq $null) { "N/A" } Else { $VirtualDevice };
    VolumeName    = If ($VolumeName -eq $null) { "N/A" } Else { $VolumeName };
    DeviceName    = If ($DeviceName -eq $null) { "N/A" } Else { $DeviceName };
  }
} | Sort-Object Disk | Format-Table -AutoSize -Property Disk, Partitions, DriveLetter, EbsVolumeId, Device, VirtualDevice, DeviceName, VolumeName
```

Jalankan skrip sebagai berikut:

```
PS C:\> .\mapping.ps1
```

Berikut ini adalah output contoh.

```
Disk  Partitions  DriveLetter   EbsVolumeId             Device      VirtualDevice   DeviceName              VolumeName
----  ----------  -----------   -----------             ------      -------------   ----------              ----------
   0           1            C   vol-0561f1783298efedd   /dev/sda1   N/A             NVMe Amazon Elastic B   N/A
   1           1            D   vol-002a9488504c5e35a   xvdb        N/A             NVMe Amazon Elastic B   N/A
   2           1            E   vol-0de9d46fcc907925d   xvdc        N/A             NVMe Amazon Elastic B   N/A
```

Jika Anda tidak memberikan kredensi Anda pada instance Windows, skrip tidak bisa mendapatkan ID volume EBS dan digunakan N/A di kolom. `EbsVolumeId`

------

## Petakan NVMe non-disk ke volume
<a name="windows-volume-mapping"></a>

Driver perangkat blok untuk instans menetapkan nama volume aktual saat melakukan pemasangan volume.

**Topics**
+ [Volume penyimpanan instans](#instance-store-volume-map)
+ [EBS volume](#ebs-volume-map)

### Volume penyimpanan instans
<a name="instance-store-volume-map"></a>

Tabel berikut menjelaskan bagaimana driver Citrix PV dan AWS PV memetakan volume penyimpanan NVMe non-instance ke volume Windows. Jumlah volume penyimpanan instans yang tersedia ditentukan oleh tipe instans. Untuk informasi selengkapnya, lihat [Batas volume penyimpanan instans untuk instans EC2](instance-store-volumes.md).


| Lokasi | Nama perangkat | 
| --- | --- | 
| Nomor Bus 0, ID Target 78, LUN 0 | xvdca | 
| Nomor Bus 0, ID Target 79, LUN 0 | xvdcb | 
| Nomor Bus 0, ID Target 80, LUN 0 | xvdcc | 
| Nomor Bus 0, ID Target 81, LUN 0 | xvdcd | 
| Nomor Bus 0, ID Target 82, LUN 0 | xvdce | 
| Nomor Bus 0, ID Target 83, LUN 0 | xvdcf | 
| Nomor Bus 0, ID Target 84, LUN 0 | xvdcg | 
| Nomor Bus 0, ID Target 85, LUN 0 | xvdch | 
| Nomor Bus 0, ID Target 86, LUN 0 | xvdci | 
| Nomor Bus 0, ID Target 87, LUN 0 | xvdcj | 
| Nomor Bus 0, ID Target 88, LUN 0 | xvdck | 
| Nomor Bus 0, ID Target 89, LUN 0 | xvdcl | 

### EBS volume
<a name="ebs-volume-map"></a>

Tabel berikut menjelaskan bagaimana driver Citrix PV dan PV memetakan AWS volume EBS non-NVME ke volume Windows.


| Lokasi | Nama perangkat | 
| --- | --- | 
| Nomor Bus 0, ID Target 0, LUN 0 | /dev/sda1 | 
| Nomor Bus 0, ID Target 1, LUN 0 | xvdb | 
| Nomor Bus 0, ID Target 2, LUN 0 | xvdc | 
| Nomor Bus 0, ID Target 3, LUN 0 | xvdd | 
| Nomor Bus 0, ID Target 4, LUN 0 | xvde | 
| Nomor Bus 0, ID Target 5, LUN 0 | xvdf | 
| Nomor Bus 0, ID Target 6, LUN 0 | xvdg | 
| Nomor Bus 0, ID Target 7, LUN 0 | xvdh | 
| Nomor Bus 0, ID Target 8, LUN 0 | xvdi | 
| Nomor Bus 0, ID Target 9, LUN 0 | xvdj | 
| Nomor Bus 0, ID Target 10, LUN 0 | xvdk | 
| Nomor Bus 0, ID Target 11, LUN 0 | xvdl | 
| Nomor Bus 0, ID Target 12, LUN 0 | xvdm | 
| Nomor Bus 0, ID Target 13, LUN 0 | xvdn | 
| Nomor Bus 0, ID Target 14, LUN 0 | xvdo | 
| Nomor Bus 0, ID Target 15, LUN 0 | xvdp | 
| Nomor Bus 0, ID Target 16, LUN 0 | xvdq | 
| Nomor Bus 0, ID Target 17, LUN 0 | xvdr | 
| Nomor Bus 0, ID Target 18, LUN 0 | xvds | 
| Nomor Bus 0, ID Target 19, LUN 0 | xvdt | 
| Nomor Bus 0, ID Target 20, LUN 0 | xvdu | 
| Nomor Bus 0, ID Target 21, LUN 0 | xvdv | 
| Nomor Bus 0, ID Target 22, LUN 0 | xvdw | 
| Nomor Bus 0, ID Target 23, LUN 0 | xvdx | 
| Nomor Bus 0, ID Target 24, LUN 0 | xkertas | 
| Nomor Bus 0, ID Target 25, LUN 0 | xvdz | 