Skip to content

Latest commit

 

History

History
227 lines (173 loc) · 5.67 KB

Set-AzureDataDisk.md

File metadata and controls

227 lines (173 loc) · 5.67 KB
external help file ms.assetid online version schema
Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml
64EF867E-5142-4317-9552-8BC94117208D
2.0.0

Set-AzureDataDisk

SYNOPSIS

Modifies the host caching of an existing data disk on an Azure virtual machine.

[!INCLUDE rdfe-banner]

SYNTAX

NoResize

Set-AzureDataDisk [-HostCaching] <String> [-LUN] <Int32> -VM <IPersistentVM> [-Profile <AzureSMProfile>]
 [-InformationAction <ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]

Resize

Set-AzureDataDisk [-DiskName] <String> [-ResizedSizeInGB] <Int32> -VM <IPersistentVM>
 [-Profile <AzureSMProfile>] [-InformationAction <ActionPreference>] [-InformationVariable <String>]
 [<CommonParameters>]

DESCRIPTION

The Set-AzureDataDisk cmdlet modifies the cache attributes of an existing data disk on an Azure virtual machine. Specify which data disk to update by its logical unit number (LUN).

EXAMPLES

Example 1: Modify the host caching for a data disk

PS C:\> Get-AzureVM "ContosoService" | Set-AzureDataDisk -VM "VirtualMachine07" -LUN 2 -HostCaching ReadOnly | Update-AzureVM

This command gets the virtual machines that run on the service named ContosoService by using the Get-AzureVM cmdlet. The command passes them to the current cmdlet by using the pipeline operator. That cmdlet sets the data disk at LUN 2 of the virtual machine named VirtualMachine07 to use ReadOnly host caching. The command updates the virtual machine to reflect your changes by using the Update-AzureVM cmdlet.

Example 2: Modify the host caching for all data disks on a virtual machine

PS C:\> Get-AzureVM "ContosoService" -Name "VirtualMachine07" | Get-AzureDataDisk | Set-AzureDataDisk -HostCaching ReadWrite | Update-AzureVM

This command gets an object for the virtual machine named VirtualMachine07 on the ContosoService cloud service. The command passes it to the Get-AzureDataDisk cmdlet, which gets the data disks for that virtual machine. The current cmdlet then sets the host caching mode of each data disks to ReadWrite. The command updates the virtual machine to reflect your changes.

PARAMETERS

-DiskName

Specifies the name of the data disk configuration that this cmdlet modifies.

Type: String
Parameter Sets: Resize
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HostCaching

Warning

Disk Caching is not supported for disks 4 TiB and larger. If multiple disks are attached to your VM, each disk that is smaller than 4 TiB will support caching.

Changing the cache setting of an Azure disk detaches and re-attaches the target disk. If it is the operating system disk, the VM is restarted. Stop all applications/services that might be affected by this disruption before changing the disk cache setting. Not following those recommendations could lead to data corruption.

Specifies the host level caching settings of the disk. Valid values are:

  • None
  • ReadOnly
  • ReadWrite
Type: String
Parameter Sets: NoResize
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type: ActionPreference
Parameter Sets: (All)
Aliases: infa

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InformationVariable

Specifies an information variable.

Type: String
Parameter Sets: (All)
Aliases: iv

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LUN

Specifies the LUN for the data drive in the virtual machine. Valid values are: 0 through 15.

Type: Int32
Parameter Sets: NoResize
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type: AzureSMProfile
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ResizedSizeInGB

Specifies the new size, in gigabytes, for the data disk. The new size must be larger than the current size.

Type: Int32
Parameter Sets: Resize
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VM

Specifies the virtual machine object that is attached to the data disk. To obtain a virtual machine object, use the Get-AzureVM cmdlet.

Type: IPersistentVM
Parameter Sets: (All)
Aliases: InputObject

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

NOTES

RELATED LINKS

Add-AzureDataDisk

Get-AzureVM

Get-AzureDataDisk

Remove-AzureDataDisk

Update-AzureVM