more G-Labs products

Author Topic: Read only Rasping config  (Read 2169 times)

June 21, 2014, 11:17:17 PM
Read 2169 times

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I officially switched my HA system over to HG today (disabled AHP and hooked the main CM15 to the Rasping).  As long as everything works correctly, I'll be moving the setup to it's permanent home soon.

This has me thinking about maintenance.  I don't want to worry about the SD card failing and having to reconfigure everything at an inopportune time, so I'm planning on making a duplicate of the SD card so if things break, I can simply swap cards.  I want to guarantee that I'm doing everything I can to reduce the odds of a failure, though.  I know with the debug option enabled, HG will write to/user/local/bin/home genie/log.  Two questions now:

1) If I disable logging, can I make the file system read only?  If so, I wouldn't expect SD failures at all (other than power fluctuation I suppose).
2) Can you make the log write to a use specified location?  I am thinking that I will add a flash drive to the USB port and write my logs to that.  I would prefer to write HG logs there as well.

June 22, 2014, 06:49:05 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
You can't make the fs read-only because statistics data and *.xml files keep being updated from HG.
The only solution would be to move the whole homegenie folder to another location where the file system is rw.
Btw, why would you expect an SD card failure? Isn't the configuration backup feature safe enough?

Cheers,
g.

June 22, 2014, 10:00:13 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I am just trying to make a maintenance free setup where anything that Could cause problems has been resolved.  I've read that flash media (SD, CF, flash drives, etc) have a finite number of writes before they fail.  HG writes statistics, logs, etc many times per minute from what I've seen, so I figure that would reduce the SD life quite a bit.  If the data (statistics, logs, etc) could be written to a different location (e.g., flash drive installed in second USB port), then if the disk failed, I'd only lose data and not the setup.  I'll keep a backup SD anyway, but I was thinking that the flash drive going down would be really easy to replace with any other without any setup.

Maybe none of this is an issue, I don't know.  I've never had a flash fail but have had several HDD die even though they are supposedly more stable.  Who knows.

June 22, 2014, 11:24:39 PM
Reply #3

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
I had one SD card failed already with HG. Yes the number of written cycles on any flash card is not infinite.
So is better not write a lot on SD file system. and create a ram drive for log file and statistics.
Then for not lose stats write a copy of them on SD once a day.

June 22, 2014, 11:49:15 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
If the number of writes was closer to 1 a day than hundreds (or more), I would probably not worry about it.  As it is, I am a little nervous that things will fail at an inopportune time.  I can write my log files to any location, but HG files are always written to the/user/local/bin/homegenie path.

June 23, 2014, 11:52:22 PM
Reply #5

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I've been doing some reading on SD technology and it looks like the cards have a microprocessor inside them that handle certain things including wear leveling.  I'm not clear whether Debian is set up so it knows that the storage is Flash, but if it is then it should be able to deal with writes such that it maximizes the life of the card.  This works best when the card is mostly empty or larger since it will try to write to different blocks each time rather than writing to the same location every time.  If Debian is set up correctly, then this is most likely a non-issue.

If not, SD is designed for 100,000 writes per block.  If HG writes 1 time per second (which is a bit more than reality), it could kill that block in 100,000/86,400 = 1.15 days.  I don't know what happens to a card when a block is killed.  I would hope that it knows enough to mark it as dead and move on.

June 24, 2014, 11:16:05 AM
Reply #6

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
So I think it's better to write statistics and logs in a ramdrive. with filesize limit.

For the log you use 2 files :
First you write in the file log.txt then when it's full (size limit) you delete log_old.txt then you rename log.txt in log_old.txt and create a new log.txt for the next events.

Fot the stats if it is a database you have to close it, copy to the flash and open it. You can do this once per day and when you stop the service without reopen in this case of course.
When the service starts, you have to load the database to ramdrive before using.