I have some problems with my hard disk - maybe it is broken, maybe the SATA cable is broken, I am just investigating it. One thing is strange.

I can read raw data from this device using:

# cat /dev/gcw/root > /dev/null

But when I try to mount this device using:

# mount -o ro /dev/gcw/root /mnt/lvroot

I get errors. Dmesg says:

[ 3561.281369] ata6.01: failed command: WRITE MULTIPLE EXT
[ 3561.281384] ata6.01: cmd 39/00:08:27:92:1c/00:00:39:00:00/f0 tag 0 pio 4096 out
[ 3561.281384]          res 51/84:01:2e:92:1c/84:00:39:00:00/f0 Emask 0x10 (ATA bus error)
[ 3561.281393] ata6.01: status: { DRDY ERR }

My question is: why is operating system trying to write to this device (command "WRITE MULTIPLE EXT" is for writing) when I try to mount this device read only?

  • You have a drive error, maybe cabling. You need to fix this first. The OS may simply be interrogating the devices "capabilities." You can't circumvent a low level hardware error by mounting read only (higher level operation). – bsd Apr 18 '15 at 10:24
  • 1
    The cat is for a different device. And no I am not just being awkward, I have found that about ½ of cases where I can detect that the quoted code is not what was tested, the quoted code would work, but the tested code should not. If the questioner had just tested what they said they tested then it would have worked. This may not be true in you case, but please test what you say you tested. – ctrl-alt-delor Apr 18 '15 at 10:58
  • The fact that the device has the .01 extension indicates that you have the controller set in IDE emulation mode and it is pretending the sata disk is an IDE slave drive. This prevents proper error diagnosis. Going into the bios and putting the controller into AHCI mode should at least get you better, proper, SATA error messages. – psusi Apr 19 '15 at 0:42

There are filesystems for which a read-only mount triggers a write operation. The one case I'm aware of is journaling filesystems, where if you mount a filesystem that wasn't unmounted cleanly, that triggers a replay of the journal, even for a read-only mount.

With ext3 or ext4 on Linux, pass the noload mount option:

mount -o ro,noload /dev/gcw/root /mnt/lvroot

Unfortunately, this causes the journal not to be replayed at all, not even in memory, which may make the filesystem show inconsistent data.

I think that it's possible to create a virtual block device such that writes go to an in-memory layer, but the original content is provided by the on-disk block device. See GNU/Linux: overlay block device / stackable block device for an example which is close to your scenario.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.