Wednesday, April 8, 2015

Bugger: loosing files in /tmp

I had completely forgotten that /tmp is a RAM disk by default in Raspberry Pi and any files there will be lost on reboot. One of my scripts was saving some temporary (temporal) files in /tmp and once in a while, the data would vanish.

Since my Raspberry runs unattended, it just boots itself whenever there is a power loss. It took me two puzzled weeks to figure out the bug. 

Solution: If you need to persist temporary files across reboots use /var/tmp instead. Extending the thought, if you need the files across reboot, are they really temporary ;)

No comments: