1

If I want to update host-cache settings on a live data disk, what is the approach?

Should I do a script where I first take a snapshot and then create a new disk from that with the new host-cache settings?

Is there any other way of doing this with azurecli/bash?

jbnasngs
  • 25
  • 3

1 Answers1

3

You could try to use az vm update to update disk cache to a VM.

az vm update -n name -g group --disk-caching os=ReadWrite

Use singular value to apply across, or specify individual disks, e.g. os=ReadWrite 0=None 1=ReadOnly should enable update os disk and 2 data disks.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • Adding more clarity to the numbers used: 0 and 1 in above example are the LUN(Logical Unit Number) numbers of the attached data disk. This value is used to identify data disks within the VM and therefore it is unique for each data disk attached to a VM, starting at zero. [Azure Doc](https://learn.microsoft.com/en-us/azure/virtual-machines/linux/azure-to-guest-disk-mapping#what-is-a-lun) – arunkvelu Nov 12 '21 at 10:27