1

To disable a local disk's write cache, one can use hdparm in the following way:

sudo hdparm -W 0 /dev/sda

(where /dev/sda is the device file of the local disk)

On AWS, I tried to use this to disable the write cache for a local instance store which is an SSD based one. But I am getting the following error:

/dev/xvdc:
HDIO_DRIVE_CMD(identify) failed: Invalid argument

Any guidance on how to disable disk cache of an AWS instance store would be appreciated.

And Or
  • 11
  • 3
  • Call me curious... what is the point of trying to disable write cache on an *ephemeral* disk? Then there's the fact that it is a virtual disk. To lose writes, you'd need the hypervisor to fail, right? And if the hypervisor failed, instance would stop, and once restarted, instance would move to a different physical machine, where it would have a shiny new empty ephemeral disk. – Michael - sqlbot Jul 15 '16 at 03:22
  • Great question. In my case, I am running some experiments to compare performance of some well known indexing schemes on SSDs. We decided to use AWS instances for our experiments because it will be believable that we didn't optimize for the underlying SSD. We also have university credits on AWS which we want to make use of; buying multiple SSDs and running experiments on them is expensive and time consuming. – And Or Jul 15 '16 at 08:01

1 Answers1

0

Most actions with hdparm require root privileges. Also, the command takes a drive for the device parameter, not a partition. Try this:

hdparm -I /dev/sda

If above command fails it is due to the AWS using SAS Disc hdparm is for IDE and SATA. And also in AWS you do not have actual access to the physical layer. I guess you will have to talk to AWS support for getting this ability or is it not present for the users.

Piyush Patil
  • 14,512
  • 6
  • 35
  • 54
  • Sorry, forgot to mention I was already using `sudo`. I edited my question and added this. What you said makes sense. I suspected that such ability may not be available because other instances running on the physical machine will also get affected if I modify the disk's behaviour.. but I was hoping there must be some solution which can turn off write cache for a specific partition. I will check out SAS disks and if it is possible to get `hdparm -W` type behaviour on them. – And Or Jul 15 '16 at 00:12
  • Ok Mark my answer correct if you got clarification. – Piyush Patil Jul 15 '16 at 00:14