Ramdrive on raspberry pi and how change location Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
johnnydomotic
Posts: 7
Joined: Tuesday 09 June 2015 20:34
Target OS: Linux
Domoticz version:
Contact:

Ramdrive on raspberry pi and how change location

Post by johnnydomotic »

Hi,
I just succeeded to create a 8mb ramdrive on my pi 2 with domoticz to use as tmp space.
After burning up my second sd card and lose all (including backups)

I followed the tutorial on the wiki page and at the end it stated: now u have some space for your garbage,
But it does not say how to piont the tmp file location to the new ramdrive /var/tmp
I see the tmpfs but is stays at 0% or does it take a long time to get to 1%

My question is:
Is this now automaticly changed or do i need to edit a config file somwhere?

Within the domoticz gui i cant find a spot to change the logging / temp space,
On the internet i also cant find my awntser,

Hope u can help me,

Peter
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by woody4165 »

Take a look at domoticz.sh in the /etc/init.d you can find it there.
I'd you have a Nas you can send it to a syslog server.
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
johnnydomotic
Posts: 7
Joined: Tuesday 09 June 2015 20:34
Target OS: Linux
Domoticz version:
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by johnnydomotic »

Thanks,
I managed to edit the file and set the location of domotics.txt to the ram.
The overall caching / swapping location is maybe not set so i will look further to see if it is possible to
Point this aswell but i see usage of space now on the ramdrive,

Is the domoticz.txt the file dat is used for the excessive writes to SD card or is that the location of all sensor logs, temperature etc?
renerene
Posts: 351
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by renerene »

Any updates here?
Interesting topic. I am planning to do the same.
But it is useless to go through ramdrive setup without being sure that it is used by the applications.

Next to the Domoticz setup question in the previous post, I expect to do the same research for my openVPN and WIFI Programs, that run alongside .
Or is there some 'one size fits all' program that that takes care of small Read/write Action and leads them to to the ramdrive instead of wearing the sd card?
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by Egregius »

If you have this in /etc/fstab most of the small writes will be in tmpfs:

Code: Select all

tmpfs   /temp        tmpfs   defaults,noatime,nosuid,mode=777,size=500m      0       0
tmpfs   /var/log        tmpfs   defaults,noatime,nosuid,mode=777,size=500m      0       0
Keep in mind that some services aren't able to create folders in /var/log.
Therefore I use a 'atstartup.sh' script, triggered by cron, to create all nescessary files/folders:
@reboot /home/pi/atstartup.sh

Code: Select all

#!/bin/bash
chmod 777 /var/log
touch /var/log/sbfspot.log
chmod 666 /var/log/sbfspot.log
touch /var/log/pihole.log
chmod 666 /var/log/pihole.log
mkdir /var/log/lighttpd
chmod 777 /var/log/lighttpd
touch /var/log/lighttpd/error.log
chmod 666 /var/log/lighttpd/error.log
touch /var/log/lighttpd/access.log
chmod 666 /var/log/lighttpd/access.log
mkdir /var/log/SBFSPOT
chmod 777 /var/log/SBFSPOT
touch /var/log/cleantelegram.txt
chmod 666 /var/log/cleantelegram.txt
In the time that I ran Domoticz on a Pi (running on Syno now) I also set some symlinks for frequently changed files so they are also on tmpfs.
Think about domoticz.log, ozwcp.poll.XXXXXX.xml, ozwcp.topo.XXXXXX, OZW_Log.txt

Having the domoticz database on tmpfs would also decrease lots of writes, but then you'll risk loosing recent data on a power outage.
renerene
Posts: 351
Joined: Wednesday 03 August 2016 11:36
Target OS: -
Domoticz version:
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by renerene »

Thank you for fast reply. It has raised some further questions.

My current status:
1)My pi with Domoticz, OpenVPN and a wifi service is not stable. It crashes about after two weeks. Do not know the cause. Have to do a hard reset, don't know how to read log files to find the cause. I'm assuming it is because of Sd card wear.
2) my four step plan:
- buy a decent Samsung Sd card, 16 gb
- make domticz use all of the 16gb, spread out the write actions all over the drive. Have to search for the forum issue I found on that topic and make sure it works for all services.
- make a ramdrive to reduce small log writes (this original topic)
- use Monit and/or watchdog
All together one or two days work with my medium Pi skills.

After reading a lot on the internet I'm asking myself
"Is the raspberry more a toy / development tool, or is all guessing and theory's about Sd card wear execurated?" To be honoust, I'm not quite impressed with statements on internet claiming 'my pi runs for over 200 days now' If they would write 20 years....

Your post made me reconsider switching to synologic.
On some forum it was not advices because of lower processor performance.

What made you switch to synologic? And how do you like it? Is the speed the same? Same update frequenc/supporty on Domoticz versions? Do you use multiple USB devices (zwave, rfxcom)?




-
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Ramdrive on raspberry pi and how change location

Post by Egregius »

One of the biggest negative things about tempfs for the logfiles is that they are removed upon reboot. So, you have to get the system stable before moving them to tempfs.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest