File reappear after deleting

  • I try to delete some file on the NetDCU-A5 via ftp command.

    After I did the reboot, sometimes the file reappears.

    Sometime, when I copy a file to the NetDCU-A5, the command is successful. Refreshing the file list show the file with the expected length.

    When I reboot the device, the length is zeo "0".

    How can this happen?

    There is enough time after the command was executed and the reboot.

  • How is the reboot done? Do you really execute the "reboot" command or do you just switch the board off and on again?

    You have to be aware that if you have writable filesystems, you cannot switch the board simply off. Never! You *always* have to shut it down correctly. This is the reason why our default images on our Starterkits typically have a read-only root filesystem. Then switching off the power is possible.

    If you switch off filesystems that are in use, then the metadata may not be written back to the real media. Which means if you delete a file, then this is stored in the buffer cache in RAM, but it is not yet written to flash memory. If you simply switch off and on again, then the system had never written this information to the flash and so the file reappears the next time, because the metadata in flash still has the file valid.

    A good procedure is to keep filesystems in read-only state and only switch to write mode for the short period of time when you actually write data. After that, switch back to read-only mode immediately again. This is the safest method. Or at least use some form of sync after writing data.

    Normally, using reboot should unmount all filesystems before the restart, so all meta data should be correctly saved.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.