0

I have a machine in the cloud which has a persistent disk. For the host, it appears as a SCSI disk. I see the following seting:

$ cat /sys/block/sda/device/scsi_disk/0\:0\:1\:0/cache_type
write back

What does this mean? Does it mean that on this machine, there is a write back cache being used by the scsi layer and so a write I/O op might be just making it to this cache before being deemed to be complete? (and later somehow get flushed to the actual disk across the network asyncronously)

Thanks.

MK.
  • 285
  • 2
  • 5
  • That is what it means. I would also interpret it to mean "ok for temporary usage, don't put a database on it". – Greg Askew Jul 02 '22 at 21:10
  • @GregAskew databases often are smart and issue write barriers (to ensure the data reached the target, not just the cache), so it should be safe to use for databases too. – Nikita Kipriyanov Jul 03 '22 at 04:25

1 Answers1

0

Yes.

It may be safe to use for a database if the disk is on a controller with battery backed caching or it might not be a single disk at all but rather a SAN. In both cases you shouldn't be using the default IO scheduler. OTOH it might be a virtual disk on a SATA drive plugged directly into the host - in which case there is a good chance that things could go very pear shaped in the event of a sudden power outage.

But most cloud providers won't tell you that much about the hardware.

symcbean
  • 19,931
  • 1
  • 29
  • 49
  • The `write back` setting is on the SCSI initiator machine. So, what is the significance of whether the controller (i.e on the remote SCSI target machine) has a battery or not? The said write back cache is on the initiator machine iiuc , (is that right?) and so data is going to be cached on the initiator side itself and so suspect to loss. – MK. Jul 03 '22 at 15:43