OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) rebooting OSPi from web gui can cause fs corruption

  • This topic has 3 replies, 3 voices, and was last updated 9 years ago by kms.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36357

    kms
    Participant

    I’ve noticed that rebooting the OSPi via the new OS gui causes minor filesystem corruption – for example, some logfiles in the RPi’s /var/log directory

    have blocks of NULLs at the time of reboot. This appears to be caused by the lack of a manual sync() before calling the reboot command.

    The raspbian reboot(2) manpage says:

    >    LINUX_REBOOT_CMD_RESTART
    >            (RB_AUTOBOOT,  0x1234567).   The  message “Restarting system.” is
    >             printed, and a default restart is performed immediately.  If  not
    >             preceded by a sync(2), data will be lost.

    I’ve verified that calling sync()  before reboot(RB_AUTOBOOT) appears to solve the problem.

    A minor consequence is that the the reboot is delayed by a couple of seconds while the filesystem is synced.

    I’ve no idea if this fix applies to the other OS hardware platforms or not.

    Kim.

     

     

     

    #36361

    Sean
    Participant

    Kim,

     

    I have ssh enabled on my Pi and have been using “sudo reboot”. Does this properly sync the files?

     

    Sean

    #36376

    Ray
    Keymaster

    @kms: that’s a good point, I never thought about it. Will add the sync() as you suggested. Thanks for reporting.

    #36390

    kms
    Participant

    @sean: using “sudo reboot” should be quite safe, as it syncs by default according to the manpage on raspbian. Only if you used “sudo reboot -n”

    would it not sync.

    Kim.

     

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) rebooting OSPi from web gui can cause fs corruption