

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Mappare i dischi non NVMe ai volumi nell'istanza Amazon EC2 Windows
<a name="windows-list-disks"></a>

Per le istanze avviate da un'AMI Windows che utilizza driver AWS PV o Citrix PV, è possibile utilizzare le relazioni descritte in questa pagina per mappare i dischi Windows all'instance store e ai volumi EBS. Questo argomento spiega come visualizzare i **non NVMe dischi** disponibili per il sistema operativo Windows sull'istanza. Mostra anche come mappare tali dischi non NVMe ai volumi Amazon EBS sottostanti e ai nomi dei dispositivi specificati per le mappature dei dispositivi a blocchi utilizzate da Amazon EC2.

**Nota**  
Se si avvia un'istanza e la tua AMI Windows utilizza driver Red Hat PV, è possibile aggiornare l'istanza per utilizzare i driver Citrix. Per ulteriori informazioni, consulta [Aggiornamento dei driver PV sulle istanze Windows EC2](Upgrading_PV_drivers.md).

**Topics**
+ [Elenca i non dischi NVMe](#windows-disks)
+ [Mappa i non NVMe dischi ai volumi](#windows-volume-mapping)

## Elenca i non dischi NVMe
<a name="windows-disks"></a>

Puoi trovare i dischi sull'istanza di Windows utilizzando Gestione disco o. PowerShell

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

**Individuazione dei dischi sulla tua istanza Windows**

1. Accedere all'istanza Windows tramite Remote Desktop. Per ulteriori informazioni, consulta [Connessione all’istanza Windows con il protocollo RDP](connecting_to_windows_instance.md).

1. Avviare l'utilità Disk Management (Gestione disco).

   Nella barra delle applicazioni, fai clic con il pulsante destro sul logo Windows e seleziona **Gestione disco**.

1. Esamina i dischi. Il volume root è un volume EBS montato come `C:\`. Se non sono visualizzati altri dischi, significa che non hai specificato volumi aggiuntivi alla creazione dell'AMI o all'avvio dell'istanza.

   Nell'esempio riportato di seguito sono illustrati i dischi disponibili lanciando un'istanza `m3.medium` con un volume instance store (Disco 2) e un volume EBS aggiuntivo (Disco 1).  
![\[Disk Management (Gestione disco) con un volume root, un volume instance store e un volume EBS.\]](http://docs.aws.amazon.com/it_it/AWSEC2/latest/UserGuide/images/disk_management.png)

1. Fai clic con il pulsante destro del mouse sul riquadro grigio con l'etichetta Disco 1, quindi seleziona **Properties (Proprietà)**. Prendi nota del valore di **Location (Ubicazione)** e cercalo nelle tabelle in [Mappa i non NVMe dischi ai volumi](#windows-volume-mapping). Ad esempio, il disco seguente presenta l'ubicazione Bus Number 0, Target Id 9, LUN 0. In base alla tabella dei volumi EBS, il nome del dispositivo di questa ubicazione è `xvdj`.  
![\[L'ubicazione di un volume EBS.\]](http://docs.aws.amazon.com/it_it/AWSEC2/latest/UserGuide/images/disk_1_location.png)

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

 PowerShell Lo script seguente elenca ogni disco e il nome e il volume del dispositivo corrispondenti.

**Requisiti e limitazioni**
+ Richiede Windows Server 2012 o versione successiva.
+ Richiede le credenziali per ottenere l'ID del volume EBS. Puoi configurare un profilo utilizzando gli strumenti per PowerShell o assegnare un ruolo IAM all'istanza.
+ Non supporta NVMe i volumi.
+ Non supporta dischi dinamici.

Connect all'istanza di Windows ed esegui il comando seguente per abilitare l'esecuzione PowerShell dello script.

```
Set-ExecutionPolicy RemoteSigned
```

Copiare lo script seguente e salvarlo come `mapping.ps1` nell'istanza Windows.

```
# 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
```

Eseguire lo script come segue:

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

Di seguito è riportato un output di esempio.

```
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
```

Se non hai fornito le tue credenziali sull'istanza di Windows, lo script non può ottenere l'ID del volume EBS e gli usi N/A nella `EbsVolumeId` colonna.

------

## Mappa i non NVMe dischi ai volumi
<a name="windows-volume-mapping"></a>

Il driver del dispositivo a blocchi dell'istanza assegna i nomi del volume effettivi durante il montaggio dei volumi.

**Topics**
+ [Volumi di archivio dell'istanza](#instance-store-volume-map)
+ [Volumi EBS](#ebs-volume-map)

### Volumi di archivio dell'istanza
<a name="instance-store-volume-map"></a>

La tabella seguente descrive come i driver Citrix PV e AWS PV mappano i volumi di archiviazione non NVMe istanza ai volumi Windows. Il numero di volumi instance store disponibili è determinato dal tipo di istanza. Per ulteriori informazioni, consulta [Limiti di volume di archivio dell'istanza per le istanze EC2](instance-store-volumes.md).


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

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

La tabella seguente descrive come i driver Citrix PV e AWS PV mappano i volumi EBS non NVMe ai volumi Windows.


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