I am trying to setup a robust raspberry canbus data logger. The pi will be installed on a mobile vehicle where the power to the pi is disconnected every time the vehicle is switched off, which will happen several times during the day.
The pi will have a readonly mounted SD card for the OS and an external SSD (probably ext4) where the logfiles are saved. The datarate of the canbus is 125kbps.
It's crucial that even in case of powerfail the logfile or worse the SSD does not get corrupted and no data is lost.
Primary I want to explore software based solution that will minimize the risk of data loss.
Secondary I also will consider hardware based solutions like adding a battery or capacitor, so the pi can be shutdown properly.
Is there any kind of best practice or are there any existing linux tools that will minimize the risk of data loss for IO operations where power can suddenly fail?