2

Post-POST, post-BIOS screen, post-GRUB; when I boot Debian with a SD card or USB stick plugged in, one of the first things to pop up on the screen (so quickly that usually I don't even notice) looks a little something like:

[sdX] no caching page mode present

text, text, X starts about halfway through that long list of stuff, the text gets noticeably smaller, and just before the window manager starts, I see the very familiar device message (isn't that what dmesg stands for, anyhow?)

[sdX] assuming drive cache. write through

So, technically speaking, what's the difference between those two states? What's being cached? What's the page? What's 'writing through'? And what precludes the assumption of drive cache so that the writing through can happen, directly following boot?

ixtmixilix
  • 13,230

1 Answers1

6

"sd" stands for SCSI disk. When a disk device is first detected, the kernel (among other things) requests the device's caching mode page, which will indicate if the device has an onboard memory buffer that sits in front of the media (disk, flash memory, whatever). In your case the device doesn't have a caching mode page, so the kernel assumes there is no caching of reads or buffering of writes, and that therefore writes to the device will be "write through," i.e. will go directly to the media.

The kernel cares about write buffering because filesystem consistency checking and recovery depends in part on the order in which data is written to storage. If there were a device onboard cache, a filesystem module might want to send the SCSI command to disable the caching of writes so that fsck continues to work properly.

Kyle Jones
  • 15,015
  • 1
    It says "assuming drive cache" so I don't think "there is no caching of reads or buffering of writes" is correct. Generally, a write-through cache means "Write is done synchronously both to the cache and to the backing store" So there can definitely still be caching of reads. – Matthew Flaschen Nov 27 '12 at 19:44