Yes. It is also possible that the card itself has reported no failure in order to prevent the OS from stalling.MarkDH102 wrote: ↑Tue Sep 26, 2017 2:06 pmOk, can I ask if someone knowledgeable would like to explain why the python editor, nano or any other app that is trying to save files to a "read only" SD card, does not display some kind of error to say that the file hasn't been written. Is it because to all intents and purposes once it issues the write command it says ok, I've stuck it all in the buffer ready to go to the SD card and that's all the write command knows so it just assumes it's written correctly?
Code: Select all
[email protected] ~ $ cd /tmp [email protected] /tmp $ echo "Is this data saved" >> foo.txt [email protected] /tmp $ cat foo.txt Is this data saved [email protected] /tmp $
Code: Select all
[email protected] ~ $ cd /tmp [email protected] /tmp $ echo "Is this data saved" >> foo.txt [email protected] /tmp $ cat foo.txt cat: foo.txt: No such file or directory [email protected] /tmp $
This is true. Full sized card do have a read/write tab, but that is simply a slider on the card that is detected by a switch in the socket. It doesn't do anything to the card itself. A lot of sockets don't have the detect switch, which means the read/write tab is ignored. The original Pi had the switch in the socket, but it wasn't connected to anything.
The files are written to a buffer, that may be in the Pi, or on the card, but it is not permanent storage. The card will try to wait until it has a large amount of data ready to write as the write operation is slow and complicated (read old data into temporary storage, add new data, erase the old data block from Flash memory, write new datablock to Flash). The card may be holding that data in the temporary memory, but not writing it to the Flash. Also the Linux kernel will use most of the unused RAM as file buffers and read data back from there to speed things up.