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/nullBut when I try to mount this device using:# mount -o ro /dev/gcw/root /mnt/lvrootI 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?
I can read from hard disk, but I can't mount it read only
mount;hard disk;readonly
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/lvrootUnfortunately, 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.